3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 14:49:28 +01:00

inspircd, ts6: don't crash when receiving an unrecognized UID

This commit is contained in:
James Lu 2016-01-27 17:49:00 -08:00
parent fdad7c9c16
commit 341c208513
2 changed files with 14 additions and 0 deletions

View File

@ -467,6 +467,13 @@ class InspIRCdProtocol(TS6BaseProtocol):
namelist = []
for user in userlist:
modeprefix, user = user.split(',', 1)
# Don't crash when we get an invalid UID.
if user not in self.irc.users:
log.debug('(%s) handle_fjoin: tried to introduce user %s not in our user list, ignoring...',
self.irc.name, user)
continue
namelist.append(user)
self.irc.users[user].channels.add(channel)
if their_ts <= our_ts:

View File

@ -435,6 +435,13 @@ class TS6Protocol(TS6BaseProtocol):
finalprefix = ''
assert user, 'Failed to get the UID from %r; our regex needs updating?' % userpair
log.debug('(%s) handle_sjoin: got modeprefix %r for user %r', self.irc.name, modeprefix, user)
# Don't crash when we get an invalid UID.
if user not in self.irc.users:
log.debug('(%s) handle_sjoin: tried to introduce user %s not in our user list, ignoring...',
self.irc.name, user)
continue
for m in modeprefix:
# Iterate over the mapping of prefix chars to prefixes, and
# find the characters that match.