fixed little things

pull/193/merge
Enrico Labedzki 2013-04-28 22:18:55 +02:00 committed by Yaroslav Halchenko
parent 24a8d07c20
commit ba8f012637
3 changed files with 16 additions and 6 deletions

View File

@ -4,10 +4,10 @@
|_| \__,_|_|_/___|_.__/\__,_|_||_|
================================================================================
Fail2Ban (version 0.8.9) 2013/04/28
Fail2Ban (version 0.8.9) 2013/04/XX
================================================================================
ver. 0.8.9 (2013/04/28) - wanna-be-stable
ver. 0.8.9 (2013/04/XX) - wanna-be-stable
----------
Although primarily a bugfix release, it incorporates many new
@ -69,7 +69,7 @@ Borreli, blotus:
* [f336d9f] Add filter for webmin. Closes gh-99.
- Enhancements:
Enrico Labedzki
* [???????] Added Datew format for ASSP SMTP Proxy.
* [1524b07] Added Datew format for ASSP SMTP Proxy.
Steven Hiscocks
* [3d6791f] Ensure restart of Actions after a check fails occurs
consistently. Closes gh-172.

View File

@ -165,6 +165,7 @@ class DateDetector:
template = DateASSPlike()
template.setName("ASSP like date format")
template.setRegex("^[a-zA-Z]{3}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}")
template.setPattern("%b-%d-%y %H:%M:%S")
self._appendTemplate(template)
finally:
self.__lock.release()

View File

@ -224,9 +224,18 @@ class DateASSPlike(DateTemplate):
def __init__(self):
DateTemplate.__init__(self)
self.__pattern = ""
def setPattern(self, pattern):
self.__pattern = pattern.strip()
def getPattern(self):
return self.__pattern
def getDate(self, line):
# there is no need to parse the date.
# ASSP doesn't buffer the log output.
return MyTime.gmtime()
date = None
dateMatch = self.matchDate(line)
if dateMatch:
date = list(time.strptime(dateMatch.group(), self.getPattern()))
return date