From c03a50b44be9c55347508335af42b7671e9e0352 Mon Sep 17 00:00:00 2001 From: Steven Hiscocks Date: Wed, 4 Dec 2013 23:13:27 +0000 Subject: [PATCH] BF: Allow handle case when SKIPLINES lines is not matched Example is when one or more SKIPLINES is optional in a regex --- fail2ban/server/failregex.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fail2ban/server/failregex.py b/fail2ban/server/failregex.py index f7279931..d5732c80 100644 --- a/fail2ban/server/failregex.py +++ b/fail2ban/server/failregex.py @@ -133,7 +133,8 @@ class Regex: n = 0 while True: try: - skippedLines += self._matchCache.group("skiplines%i" % n) + if self._matchCache.group("skiplines%i" % n) is not None: + skippedLines += self._matchCache.group("skiplines%i" % n) n += 1 except IndexError: break