mirror of
https://github.com/progval/Limnoria.git
synced 2025-04-25 12:31:04 -05:00
Fall back to banning host instead of exact mask
This only happens on the newly introduced account extban (in case the user does not have an account, or the server does not provide accounts) so this does not change existing behavior. Falling back to the host instead of the exact mask makes it less easy to evade these bans
This commit is contained in:
parent
54f7b5a5b6
commit
917e3019bc
@ -245,9 +245,9 @@ class ChannelTestCase(ChannelPluginTestCase):
|
||||
'*!user@host.domain.tld')
|
||||
join()
|
||||
with conf.supybot.protocols.irc.banmask.context(['account']):
|
||||
# falls back from --account to config, then to exact hostmask
|
||||
# falls back from --account to config, then to only the host
|
||||
self.assertKban('kban --account foobar',
|
||||
'foobar!user@host.domain.tld')
|
||||
'*!*@host.domain.tld')
|
||||
join()
|
||||
self.assertKban('kban --account --host foobar',
|
||||
'*!*@host.domain.tld')
|
||||
@ -277,9 +277,9 @@ class ChannelTestCase(ChannelPluginTestCase):
|
||||
'*!user@host.domain.tld')
|
||||
join()
|
||||
with conf.supybot.protocols.irc.banmask.context(['account']):
|
||||
# falls back from --account to config, then to exact hostmask
|
||||
# falls back from --account to config, then to only the host
|
||||
self.assertKban('kban --account foobar',
|
||||
'foobar!user@host.domain.tld')
|
||||
'*!*@host.domain.tld')
|
||||
join()
|
||||
self.assertKban('kban --account --host foobar',
|
||||
'*!*@host.domain.tld')
|
||||
|
@ -1316,7 +1316,12 @@ class Banmask(registry.SpaceSeparatedSetOfStrings):
|
||||
if (bnick, buser, bhost) == ('*', '*', '*') and \
|
||||
ircutils.isUserHostmask(hostmask) and \
|
||||
not masks:
|
||||
masks.append(hostmask)
|
||||
# still no ban mask found, fallback to the host, if any
|
||||
if host != '*':
|
||||
masks.append(ircutils.joinHostmask('*', '*', host))
|
||||
else:
|
||||
# if no host, fall back to the exact mask provided
|
||||
masks.append(hostmask)
|
||||
|
||||
return masks
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user