Prevent people from adding hostmasks that don't explicitly match other users'

hostmasks but will match when you check hostmaskPatternEqual aka bug #1043045
This commit is contained in:
James Vega 2004-10-08 13:59:45 +00:00
parent 3df40e814a
commit 4557b867fe
2 changed files with 6 additions and 1 deletions

View File

@ -239,7 +239,10 @@ class User(callbacks.Privmsg):
except ValueError, e: except ValueError, e:
irc.error(str(e)) irc.error(str(e))
return return
try:
ircdb.users.setUser(id, user) ircdb.users.setUser(id, user)
except ValueError, e:
irc.error(str(e))
irc.replySuccess() irc.replySuccess()
def removehostmask(self, irc, msg, args): def removehostmask(self, irc, msg, args):

View File

@ -713,9 +713,11 @@ class UsersDictionary(utils.IterableMap):
continue continue
elif u.checkHostmask(hostmask): elif u.checkHostmask(hostmask):
s = '%s is someone else\'s hostmask.' % hostmask s = '%s is someone else\'s hostmask.' % hostmask
user.removeHostmask(hostmask)
raise ValueError, s raise ValueError, s
for otherHostmask in u.hostmasks: for otherHostmask in u.hostmasks:
if ircutils.hostmaskPatternEqual(hostmask, otherHostmask): if ircutils.hostmaskPatternEqual(hostmask, otherHostmask):
user.removeHostmask(hostmask)
s = '%s is someone else\'s hostmask.' % hostmask s = '%s is someone else\'s hostmask.' % hostmask
raise ValueError, s raise ValueError, s
self.invalidateCache(id) self.invalidateCache(id)