From f1fddefeacaa75771f6a0ea90d2532dcedb038a5 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 17 Feb 2017 21:36:48 -0800 Subject: [PATCH] protocols: catch S2S messages if they're being routed the wrong way (#405) --- protocols/nefarious.py | 4 ++++ protocols/ts6_common.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/protocols/nefarious.py b/protocols/nefarious.py index b4e7e9b..67adcb1 100644 --- a/protocols/nefarious.py +++ b/protocols/nefarious.py @@ -846,6 +846,10 @@ class P10Protocol(IRCS2SProtocol): return else: # Send a hook with the hook arguments given by the handler function. + if self.irc.isInternalClient(sender) or self.irc.isInternalServer(sender): + log.warning("(%s) Received command %s being routed the wrong way!", self.irc.name, command) + return + parsed_args = func(sender, command, args) if parsed_args is not None: return [sender, command, parsed_args] diff --git a/protocols/ts6_common.py b/protocols/ts6_common.py index de73667..539673f 100644 --- a/protocols/ts6_common.py +++ b/protocols/ts6_common.py @@ -330,6 +330,10 @@ class TS6BaseProtocol(IRCS2SProtocol): command = args[0] args = args[1:] + if self.irc.isInternalClient(numeric) or self.irc.isInternalServer(numeric): + log.warning("(%s) Received command %s being routed the wrong way!", self.irc.name, command) + return + if command == 'ENCAP': # Special case for encapsulated commands (ENCAP), in forms like this: # <- :00A ENCAP * SU 42XAAAAAC :GLolol