Skip to content

Commit

Permalink
ircdb: Fix hostmask conflict resolution in getUserId
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
progval committed Oct 20, 2024
1 parent 54c0980 commit 246f4d3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/ircdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,21 @@ def getUserId(self, s):
elif len(ids) == 0:
raise KeyError(s)
else:
log.error('Multiple matches found in user database. '
'Removing the offending hostmasks.')
# values in 'ids' are strings if user was identified by
# 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():
if hostmask is True:
continue
log.error('Removing %q from user %s.', hostmask, id)
self.users[id].removeHostmask(hostmask)
raise DuplicateHostmask('Ids %r matched.' % ids)
Expand Down

0 comments on commit 246f4d3

Please sign in to comment.