fix actions problem

Give the BanManager a new method returning a list of banned ips, which
can be used to check if a specific ip is currently banned. All testcases
pass again.
This commit is contained in:
Marko Hauptvogel 2025-11-11 10:54:08 +01:00
parent fffa65c249
commit be6885d82d
2 changed files with 4 additions and 1 deletions

View file

@ -288,7 +288,7 @@ class Actions(JailThread, Mapping):
if not isinstance(ip, IPAddr):
ipa = IPAddr(ip)
if not ipa.isSingle: # subnet (mask/cidr) or raw (may be dns/hostname):
ips = list(filter(ipa.contains, self.banManager.getBanList()))
ips = list(filter(ipa.contains, self.banManager.getBannedIPs()))
if ips:
return self.removeBannedIP(ips, db, ifexists)
# not found:

View file

@ -115,6 +115,9 @@ class BanManager:
) for t in lst]
return [t[0].getID() for t in lst]
def getBannedIPs(self):
return list(sorted(ticket.getIP() for ticket in self.__banList.values()))
##
# Returns a iterator to ban list (used in reload, so idle).
#