mirror of https://github.com/fail2ban/fail2ban
- Fixed crash when time format does not match data
git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@223 a942ae1a-1317-0410-a47c-b1dcaea8d6050.6
parent
15806fc3da
commit
9cd787c50e
|
@ -201,7 +201,12 @@ class LogReader:
|
||||||
Pattern should describe the date construction of
|
Pattern should describe the date construction of
|
||||||
value.
|
value.
|
||||||
"""
|
"""
|
||||||
date = list(time.strptime(value, self.timepattern))
|
try:
|
||||||
|
date = list(time.strptime(value, self.timepattern))
|
||||||
|
except ValueError, e:
|
||||||
|
logSys.error(e)
|
||||||
|
logSys.error("Please check the format and your locale settings.")
|
||||||
|
return None
|
||||||
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] = time.gmtime()[0]
|
date[0] = time.gmtime()[0]
|
||||||
|
|
Loading…
Reference in New Issue