From 38b07ca46e96eeabccf1ef3081063ac5e85f168e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Sun, 15 Sep 2013 23:03:18 -0400 Subject: [PATCH] BF: catch and report exceptions while executing commands in client interactive mode (Close #353) --- ChangeLog | 2 ++ fail2ban-client | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 633bebbb1..5a7ce8fb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,8 @@ ver. 0.8.11 (2013/XX/XXX) - loves-unittests - All backends, possible race condition: do not read from a file initially reported empty. Originally could have lead to 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 & Мернов Георгий * filter.d/dovecot.conf -- Fix when no TLS enabled - line doesn't end in , Daniel Black diff --git a/fail2ban-client b/fail2ban-client index be48a613e..c18b7d555 100755 --- a/fail2ban-client +++ b/fail2ban-client @@ -383,7 +383,10 @@ class Fail2banClient: if cmd == "help": self.dispUsage() elif not cmd == "": - self.__processCommand(shlex.split(cmd)) + try: + self.__processCommand(shlex.split(cmd)) + except Exception, e: + logSys.error(e) except (EOFError, KeyboardInterrupt): print return True