mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-25 20:41:18 -05:00
ircdb: Fix hostmask conflict resolution in getUserId
When the first of the two conflicts comes from a transient hostmask set by NickAuth, the first value in the 'ids' dict would be True, which causes a silly log message, then Limnoria silently crashes to self.users[id].removeHostmask(hostmask) and then does not remove the next hostmask which is responsible for the conflict.
This commit is contained in:
parent
54c0980978
commit
246f4d3e62
16
src/ircdb.py
16
src/ircdb.py
@ -786,9 +786,21 @@ class UsersDictionary(utils.IterableMap):
|
|||||||
elif len(ids) == 0:
|
elif len(ids) == 0:
|
||||||
raise KeyError(s)
|
raise KeyError(s)
|
||||||
else:
|
else:
|
||||||
log.error('Multiple matches found in user database. '
|
# values in 'ids' are strings if user was identified by
|
||||||
'Removing the offending hostmasks.')
|
# actual hostmask, or True if they were identified by
|
||||||
|
# a transient authentication (@identify, NickAuth, GPG,
|
||||||
|
# etc.)
|
||||||
|
log.error(
|
||||||
|
'Multiple matches found in user database: [%s]. '
|
||||||
|
'Removing the offending hostmasks.',
|
||||||
|
', '.join(
|
||||||
|
'<transient>'
|
||||||
|
if hostmask is True
|
||||||
|
else repr(hostmask)
|
||||||
|
for hostmask in ids.values()))
|
||||||
for (id, hostmask) in ids.items():
|
for (id, hostmask) in ids.items():
|
||||||
|
if hostmask is True:
|
||||||
|
continue
|
||||||
log.error('Removing %q from user %s.', hostmask, id)
|
log.error('Removing %q from user %s.', hostmask, id)
|
||||||
self.users[id].removeHostmask(hostmask)
|
self.users[id].removeHostmask(hostmask)
|
||||||
raise DuplicateHostmask('Ids %r matched.' % ids)
|
raise DuplicateHostmask('Ids %r matched.' % ids)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user