mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +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):
|
def normalizeHost(irc, host):
|
||||||
"""Creates a normalized hostname for the given host suitable for
|
"""Creates a normalized hostname for the given host suitable for
|
||||||
introduction to a remote network (as a relay client)."""
|
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'):
|
if irc.protoname not in ('inspircd', 'ts6', 'clientbot', 'nefarious'):
|
||||||
# UnrealIRCd and IRCd-Hybrid don't allow slashes in hostnames
|
# UnrealIRCd and IRCd-Hybrid don't allow slashes in hostnames
|
||||||
host = host.replace('/', '.')
|
host = host.replace('/', '.')
|
||||||
@ -1203,8 +1204,10 @@ def handle_chgclient(irc, source, command, args):
|
|||||||
remoteirc = world.networkobjects[netname]
|
remoteirc = world.networkobjects[netname]
|
||||||
try:
|
try:
|
||||||
if field == 'HOST':
|
if field == 'HOST':
|
||||||
text = normalizeHost(remoteirc, text)
|
newtext = normalizeHost(remoteirc, text)
|
||||||
remoteirc.proto.updateClient(user, field, 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
|
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);'
|
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,
|
' remote IRCd doesn\'t support it', irc.name, field,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user