- Fixed bug with "<failures>" tag

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@264 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 2006-08-06 21:25:23 +00:00
parent f248c460f2
commit d4c9d92ae1
4 changed files with 15 additions and 3 deletions

View File

@ -134,7 +134,7 @@ class Actions(JailThread):
aInfo = dict()
bTicket = BanManager.createBanTicket(ticket)
aInfo["ip"] = bTicket.getIP()
aInfo["failures"] = bTicket.getTime()
aInfo["failures"] = bTicket.getAttempt()
logSys.info("Ban %s" % aInfo["ip"])
for action in self.actions:
action.execActionBan(aInfo)

View File

@ -101,7 +101,9 @@ class BanManager:
ip = ticket.getIP()
#lastTime = ticket.getTime()
lastTime = time.time()
return BanTicket(ip, lastTime)
banTicket = BanTicket(ip, lastTime)
banTicket.setAttempt(ticket.getAttempt())
return banTicket
##
# Add a ban ticket.

View File

@ -97,7 +97,10 @@ class FailManager:
if data.getRetry() >= self.maxRetry:
self.delFailure(ip)
self.lock.release()
return FailTicket(ip, data.getLastTime())
# Create a FailTicket from BanData
failTicket = FailTicket(ip, data.getLastTime())
failTicket.setAttempt(data.getRetry())
return failTicket
self.lock.release()
raise FailManagerEmpty

View File

@ -34,6 +34,7 @@ class Ticket:
def __init__(self, ip, time):
self.ip = ip
self.time = time
self.attempt = 0
def setIP(self, value):
self.ip = value
@ -46,4 +47,10 @@ class Ticket:
def getTime(self):
return self.time
def setAttempt(self, value):
self.attempt = value
def getAttempt(self):
return self.attempt