Skip to content

Commit 246f4d3

Browse files
committed
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.
1 parent 54c0980 commit 246f4d3

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/ircdb.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,9 +786,21 @@ def getUserId(self, s):
786786
elif len(ids) == 0:
787787
raise KeyError(s)
788788
else:
789-
log.error('Multiple matches found in user database. '
790-
'Removing the offending hostmasks.')
789+
# values in 'ids' are strings if user was identified by
790+
# actual hostmask, or True if they were identified by
791+
# a transient authentication (@identify, NickAuth, GPG,
792+
# etc.)
793+
log.error(
794+
'Multiple matches found in user database: [%s]. '
795+
'Removing the offending hostmasks.',
796+
', '.join(
797+
'<transient>'
798+
if hostmask is True
799+
else repr(hostmask)
800+
for hostmask in ids.values()))
791801
for (id, hostmask) in ids.items():
802+
if hostmask is True:
803+
continue
792804
log.error('Removing %q from user %s.', hostmask, id)
793805
self.users[id].removeHostmask(hostmask)
794806
raise DuplicateHostmask('Ids %r matched.' % ids)

0 commit comments

Comments
 (0)