mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-23 19:19:31 +01:00
relay: fix overzealous host normalization due to variable replacement during iteration
This commit is contained in:
parent
29bfe108fe
commit
09c98f66ff
@ -178,6 +178,7 @@ def normalizeNick(irc, netname, nick, times_tagged=0, uid=''):
|
||||
def normalizeHost(irc, host):
|
||||
"""Creates a normalized hostname for the given host suitable for
|
||||
introduction to a remote network (as a relay client)."""
|
||||
log.debug('(%s) relay.normalizeHost: IRCd=%s, host=%s', irc.name, irc.protoname, host)
|
||||
if irc.protoname not in ('inspircd', 'ts6', 'clientbot', 'nefarious'):
|
||||
# UnrealIRCd and IRCd-Hybrid don't allow slashes in hostnames
|
||||
host = host.replace('/', '.')
|
||||
@ -1203,8 +1204,10 @@ def handle_chgclient(irc, source, command, args):
|
||||
remoteirc = world.networkobjects[netname]
|
||||
try:
|
||||
if field == 'HOST':
|
||||
text = normalizeHost(remoteirc, text)
|
||||
remoteirc.proto.updateClient(user, field, text)
|
||||
newtext = normalizeHost(remoteirc, text)
|
||||
else: # Don't overwrite the original text variable on every iteration.
|
||||
newtext = text
|
||||
remoteirc.proto.updateClient(user, field, newtext)
|
||||
except NotImplementedError: # IRCd doesn't support changing the field we want
|
||||
log.debug('(%s) relay.handle_chgclient: Ignoring changing field %r of %s on %s (for %s/%s);'
|
||||
' remote IRCd doesn\'t support it', irc.name, field,
|
||||
|
Loading…
Reference in New Issue
Block a user