From 4557b867fe063d667ed67162dd888044e83b1b34 Mon Sep 17 00:00:00 2001 From: James Vega Date: Fri, 8 Oct 2004 13:59:45 +0000 Subject: [PATCH] Prevent people from adding hostmasks that don't explicitly match other users' hostmasks but will match when you check hostmaskPatternEqual aka bug #1043045 --- src/User.py | 5 ++++- src/ircdb.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/User.py b/src/User.py index e8c25bd00..de5f883b7 100755 --- a/src/User.py +++ b/src/User.py @@ -239,7 +239,10 @@ class User(callbacks.Privmsg): except ValueError, e: irc.error(str(e)) return - ircdb.users.setUser(id, user) + try: + ircdb.users.setUser(id, user) + except ValueError, e: + irc.error(str(e)) irc.replySuccess() def removehostmask(self, irc, msg, args): diff --git a/src/ircdb.py b/src/ircdb.py index 8bf1a6582..7ee963d73 100644 --- a/src/ircdb.py +++ b/src/ircdb.py @@ -713,9 +713,11 @@ class UsersDictionary(utils.IterableMap): continue elif u.checkHostmask(hostmask): s = '%s is someone else\'s hostmask.' % hostmask + user.removeHostmask(hostmask) raise ValueError, s for otherHostmask in u.hostmasks: if ircutils.hostmaskPatternEqual(hostmask, otherHostmask): + user.removeHostmask(hostmask) s = '%s is someone else\'s hostmask.' % hostmask raise ValueError, s self.invalidateCache(id)