- Fixed some bugs

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@363 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 2006-09-17 22:31:55 +00:00
parent f3a90b9021
commit 2bcf1bb359
2 changed files with 7 additions and 11 deletions

View File

@ -131,7 +131,7 @@ class BanManager:
def addBanTicket(self, ticket): def addBanTicket(self, ticket):
try: try:
self.lock.acquire() self.lock.acquire()
if not self.inBanList(ticket): if not self.__inBanList(ticket):
self.banList.append(ticket) self.banList.append(ticket)
self.banTotal += 1 self.banTotal += 1
return True return True
@ -168,15 +168,11 @@ class BanManager:
# @param ticket the ticket # @param ticket the ticket
# @return True if a ticket already exists # @return True if a ticket already exists
def inBanList(self, ticket): def __inBanList(self, ticket):
try:
self.lock.acquire()
for i in self.banList: for i in self.banList:
if ticket.getIP() == i.getIP(): if ticket.getIP() == i.getIP():
return True return True
return False return False
finally:
self.lock.release()
## ##
# Get the list of IP address to unban. # Get the list of IP address to unban.

View File

@ -118,7 +118,7 @@ class FailManager:
for ip in self.failList: for ip in self.failList:
data = self.failList[ip] data = self.failList[ip]
if data.getRetry() >= self.maxRetry: if data.getRetry() >= self.maxRetry:
self.delFailure(ip) self.__delFailure(ip)
# Create a FailTicket from BanData # Create a FailTicket from BanData
failTicket = FailTicket(ip, data.getLastTime()) failTicket = FailTicket(ip, data.getLastTime())
failTicket.setAttempt(data.getRetry()) failTicket.setAttempt(data.getRetry())