mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
- 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-b1dcaea8d605
This commit is contained in:
parent
15f248ee78
commit
cc08e53736
1 changed files with 6 additions and 1 deletions
|
|
@ -201,7 +201,12 @@ class LogReader:
|
|||
Pattern should describe the date construction of
|
||||
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:
|
||||
# There is probably no year field in the logs
|
||||
date[0] = time.gmtime()[0]
|
||||
|
|
|
|||
Loading…
Reference in a new issue