fixed issue with crashing on wrong log file

added a cleanup of firewall on emergency exit
debian-releases/etch debian/0.5.4-5.14
Yaroslav Halchenko 19 years ago
parent e9792f95f6
commit 51d453a3d2

6
debian/changelog vendored

@ -1,4 +1,4 @@
fail2ban (0.5.4-5.13) unstable; urgency=low
fail2ban (0.5.4-5.14) unstable; urgency=low
* Added a notification regarding the importance of 0.5.4-5 change of
failregex in the config file.
@ -20,6 +20,10 @@ fail2ban (0.5.4-5.13) unstable; urgency=low
within sections.
* Added -e command line parameter to provide enabled sections from command
line.
* Added a cleanup of firewall rules on emergency shutdown when unknown
exception is catched.
* Fail2ban should not crash now if a wrong file name is specified in
config.
-- Yaroslav Halchenko <debian@onerussian.com> Mon, 3 Oct 2005 22:26:28 -1000

@ -55,6 +55,12 @@ except Exception, e:
logSys.error("Type: " + `type.__name__` + "\n" +
"Value: " + `e.args` + "\n" +
"TB: " + `tbStack`)
# Try to clean up after ourselves
# just for extreme caution - wrapping with try
try:
fail2ban.restoreFwRules()
except Exception:
pass
# Remove the PID lock file. Should close #1239562
pidLock.remove()
logging.shutdown()

@ -97,15 +97,17 @@ class LogReader:
"""
try:
self.logStats = os.stat(self.logPath)
if self.lastModTime == self.logStats.st_mtime:
return False
else:
logSys.debug(self.logPath+" has been modified")
self.lastModTime = self.logStats.st_mtime
return True
except OSError:
logSys.error("Unable to get stat on "+self.logPath)
if self.lastModTime == self.logStats.st_mtime:
return False
else:
logSys.debug(self.logPath+" has been modified")
self.lastModTime = self.logStats.st_mtime
return True
def setFilePos(self, file):
""" Sets the file position. We must take care of log file rotation

Loading…
Cancel
Save