BF: catch and report exceptions while executing commands in client interactive mode (Close #353)

pull/349/merge
Yaroslav Halchenko 2013-09-15 23:03:18 -04:00
parent f1adf75b59
commit 38b07ca46e
2 changed files with 6 additions and 1 deletions

View File

@ -26,6 +26,8 @@ ver. 0.8.11 (2013/XX/XXX) - loves-unittests
- All backends, possible race condition: do not read from a file - All backends, possible race condition: do not read from a file
initially reported empty. Originally could have lead to initially reported empty. Originally could have lead to
accounting for detected log lines multiple times. accounting for detected log lines multiple times.
- Do not crash if executing a command in fail2ban-client interactive
mode has failed (e.g. due to incorrect syntax). Closes gh-353
Daniel Black & Мернов Георгий Daniel Black & Мернов Георгий
* filter.d/dovecot.conf -- Fix when no TLS enabled - line doesn't end in , * filter.d/dovecot.conf -- Fix when no TLS enabled - line doesn't end in ,
Daniel Black Daniel Black

View File

@ -383,7 +383,10 @@ class Fail2banClient:
if cmd == "help": if cmd == "help":
self.dispUsage() self.dispUsage()
elif not cmd == "": elif not cmd == "":
self.__processCommand(shlex.split(cmd)) try:
self.__processCommand(shlex.split(cmd))
except Exception, e:
logSys.error(e)
except (EOFError, KeyboardInterrupt): except (EOFError, KeyboardInterrupt):
print print
return True return True