From 6c4e0423074ba1f70718f57801a57dee5b1fcb6d Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 24 Mar 2017 01:08:01 -0700 Subject: [PATCH] networks.remote: break if the target network is the same as the source (#437) _remote_reply() otherwise gets sent into a loop when remoteirc and irc is the same here. --- plugins/networks.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/networks.py b/plugins/networks.py index cda6839..3d79f5c 100644 --- a/plugins/networks.py +++ b/plugins/networks.py @@ -64,6 +64,13 @@ def remote(irc, source, args): args = remote_parser.parse_args(args) netname = args.network + + if netname == irc.name: + # This would actually throw _remote_reply() into a loop, so check for it here... + # XXX: properly fix this. + irc.error("Cannot remote-send a command to the local network; use a normal command!") + return + try: remoteirc = world.networkobjects[netname] except KeyError: # Unknown network. @@ -85,6 +92,9 @@ def remote(irc, source, args): """ reply() rerouter for the 'remote' command. """ + assert irc.name != placeholder_self.name, \ + "Refusing to route reply back to the same " \ + "network, as this would cause a recursive loop" log.debug('(%s) networks.remote: re-routing reply %r from network %s', irc.name, text, placeholder_self.name)