mirror of https://github.com/fail2ban/fail2ban
- Fixed some bugs
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@363 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
f3a90b9021
commit
2bcf1bb359
|
@ -131,7 +131,7 @@ class BanManager:
|
|||
def addBanTicket(self, ticket):
|
||||
try:
|
||||
self.lock.acquire()
|
||||
if not self.inBanList(ticket):
|
||||
if not self.__inBanList(ticket):
|
||||
self.banList.append(ticket)
|
||||
self.banTotal += 1
|
||||
return True
|
||||
|
@ -168,15 +168,11 @@ class BanManager:
|
|||
# @param ticket the ticket
|
||||
# @return True if a ticket already exists
|
||||
|
||||
def inBanList(self, ticket):
|
||||
try:
|
||||
self.lock.acquire()
|
||||
for i in self.banList:
|
||||
if ticket.getIP() == i.getIP():
|
||||
return True
|
||||
return False
|
||||
finally:
|
||||
self.lock.release()
|
||||
def __inBanList(self, ticket):
|
||||
for i in self.banList:
|
||||
if ticket.getIP() == i.getIP():
|
||||
return True
|
||||
return False
|
||||
|
||||
##
|
||||
# Get the list of IP address to unban.
|
||||
|
|
|
@ -118,7 +118,7 @@ class FailManager:
|
|||
for ip in self.failList:
|
||||
data = self.failList[ip]
|
||||
if data.getRetry() >= self.maxRetry:
|
||||
self.delFailure(ip)
|
||||
self.__delFailure(ip)
|
||||
# Create a FailTicket from BanData
|
||||
failTicket = FailTicket(ip, data.getLastTime())
|
||||
failTicket.setAttempt(data.getRetry())
|
||||
|
|
Loading…
Reference in New Issue