- Fixed "Feb 29" bug. Thanks to James Andrewartha who pointed this out. Thanks to Yaroslav Halchenko for the fix.

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/branches/FAIL2BAN-0_8@652 a942ae1a-1317-0410-a47c-b1dcaea8d605
_tent/ipv6_via_aInfo
Cyril Jaquier 17 years ago
parent c25790ad36
commit 799f5977c5

@ -31,6 +31,8 @@ ver. 0.8.2 (2008/??/??) - stable
- Print monitored files in status. - Print monitored files in status.
- Create a PID file in /var/run/fail2ban/. Thanks to Julien - Create a PID file in /var/run/fail2ban/. Thanks to Julien
Perez. Perez.
- Fixed "Feb 29" bug. Thanks to James Andrewartha who pointed
this out. Thanks to Yaroslav Halchenko for the fix.
ver. 0.8.1 (2007/08/14) - stable ver. 0.8.1 (2007/08/14) - stable
---------- ----------

@ -129,7 +129,14 @@ class DateStrptime(DateTemplate):
except ValueError: except ValueError:
# Try to convert date string to 'C' locale # Try to convert date string to 'C' locale
conv = self.convertLocale(dateMatch.group()) conv = self.convertLocale(dateMatch.group())
date = list(time.strptime(conv, self.getPattern())) try:
date = list(time.strptime(conv, self.getPattern()))
except ValueError:
# Try to add the current year to the pattern. Should fix
# the "Feb 29" issue.
conv += " %s" % MyTime.gmtime()[0]
pattern = "%s %%Y" % self.getPattern()
date = list(time.strptime(conv, pattern))
if date[0] < 2000: if date[0] < 2000:
# There is probably no year field in the logs # There is probably no year field in the logs
date[0] = MyTime.gmtime()[0] date[0] = MyTime.gmtime()[0]

Loading…
Cancel
Save