Fix to global hostmask. Fix bug #SF3088559 and submitted as patch #SF3163843

This commit is contained in:
Valentin Lorentz 2011-01-22 10:17:32 +01:00
parent e6fc429701
commit 720b6d23eb
2 changed files with 5 additions and 1 deletions

View File

@ -196,7 +196,7 @@ def banmask(hostmask):
L[-1] = '*'
return '*!*@' + ':'.join(L)
else:
if '.' in host:
if len(host.split('.')) > 2: # If it is a subdomain
return '*!*@*%s' % host[host.find('.'):]
else:
return '*!*@' + host

View File

@ -233,6 +233,10 @@ class FunctionsTestCase(SupyTestCase):
msg.prefix),
'%r didn\'t match %r' % (msg.prefix, banmask))
self.assertEqual(ircutils.banmask('foobar!user@host'), '*!*@host')
self.assertEqual(ircutils.banmask('foobar!user@host.tld'),
'*!*@host.tld')
self.assertEqual(ircutils.banmask('foobar!user@sub.host.tld'),
'*!*@*.host.tld')
self.assertEqual(ircutils.banmask('foo!bar@2001::'), '*!*@2001::*')
def testSeparateModes(self):