From f7b93e474c8d80ac99ca9e47693779f58b283ee3 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 8 Aug 2016 17:05:28 -0700 Subject: [PATCH] unreal: request VHP capability so cloaked hosts for Unreal3.2 users are sent (cherry picked from commit 671d6d1893629fbd05b09b301aa8c134a9772c78) --- protocols/unreal.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/protocols/unreal.py b/protocols/unreal.py index ae50279..70282ae 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -323,7 +323,11 @@ class UnrealProtocol(TS6BaseProtocol): # EAUTH - Early auth? (Unreal 4 linking protocol) # NICKIP - Extends the NICK command used for introduction (for Unreal 3.2 servers) # to include user IPs. - f('PROTOCTL SJ3 NOQUIT NICKv2 VL UMODE2 PROTOCTL NICKIP EAUTH=%s SID=%s' % (self.irc.serverdata["hostname"], self.irc.sid)) + # VHP - Sends cloaked hosts of UnrealIRCd 3.2 users as the hostname. This is important + # because UnrealIRCd 3.2 only has one vHost field in its NICK command, and not two + # like UnrealIRCd 4.0 (cloaked host + displayed host). Without VHP, cloaking does + # not work for any UnrealIRCd 3.2 users. + f('PROTOCTL SJ3 NOQUIT NICKv2 VL UMODE2 PROTOCTL NICKIP EAUTH=%s SID=%s VHP' % (self.irc.serverdata["hostname"], self.irc.sid)) sdesc = self.irc.serverdata.get('serverdesc') or self.irc.botdata['serverdesc'] f('SERVER %s 1 U%s-h6e-%s :%s' % (host, self.proto_ver, self.irc.sid, sdesc)) f('NETINFO 1 %s %s * 0 0 0 :%s' % (self.irc.start_ts, self.proto_ver, self.irc.serverdata.get("netname", self.irc.name))) @@ -596,9 +600,10 @@ class UnrealProtocol(TS6BaseProtocol): # internally by their nicks. In other words, we need to convert from this: # <- NICK Global 3 1456843578 services novernet.com services.novernet.com 0 +ioS * :Global Noticer # & nick hopcount timestamp username hostname server service-identifier-token :realname - # <- NICK GL32 2 1460221959 gl localhost unreal32.midnight.vpn 0 +iowx * fwAAAQ== :realname (with NICKIP enabled) + # With NICKIP and VHP enabled: + # <- NICK GL32 2 1470699865 gl localhost unreal32.midnight.vpn GL +iowx hidden-1C620195 AAAAAAAAAAAAAAAAAAAAAQ== :realname # to this: - # <- :001 UID GL 0 1441306929 gl localhost 0018S7901 0 +iowx * midnight-1C620195 fwAAAQ== :realname + # <- :001 UID GL 0 1441306929 gl localhost 0018S7901 0 +iowx * hidden-1C620195 fwAAAQ== :realname log.debug('(%s) got legacy NICK args: %s', self.irc.name, ' '.join(args)) new_args = args[:] # Clone the old args list @@ -609,7 +614,9 @@ class UnrealProtocol(TS6BaseProtocol): self.legacy_nickcount += 1 new_args[5] = fake_uid - # Insert a fake cloaked host (just make it equal the real host, I don't care) + # This adds a dummy cloaked host (equal the real host) to put the displayed host in the + # right position. As long as the VHP capability is respected, this will propagate +x cloaked + # hosts from UnrealIRCd 3.2 users. Otherwise, +x host cloaking won't work! new_args.insert(-2, args[4]) log.debug('(%s) translating legacy NICK args to: %s', self.irc.name, ' '.join(new_args))