From b8e8a87ee93985d36c8f53bf5089650b34c874e1 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 24 Nov 2020 20:21:49 +0100 Subject: [PATCH] small amend to 0f27a8add82dd75c9cb984505732b56c1f625313 - datedetector, strptime: token `%Z` recognizes all known zone abbreviation besides Z, GMT, UTC correctly, if it is matching (`%z` remains unchanged for backwards-compatibility, see comment in code); test cases fixed (PDT zone will be found now). --- fail2ban/server/strptime.py | 2 +- fail2ban/tests/files/logs/monit | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fail2ban/server/strptime.py b/fail2ban/server/strptime.py index 5fcfb959..7f11402a 100644 --- a/fail2ban/server/strptime.py +++ b/fail2ban/server/strptime.py @@ -238,7 +238,7 @@ def reGroupDictStrptime(found_dict, msec=False, default_tz=None): z = val if z in ("Z", "UTC", "GMT"): tzoffset = 0 - elif key == 'z': + else: tzoffset = zone2offset(z, 0); # currently offset-based only # Fail2Ban will assume it's this year diff --git a/fail2ban/tests/files/logs/monit b/fail2ban/tests/files/logs/monit index 8dbddaf6..36f1c1e4 100644 --- a/fail2ban/tests/files/logs/monit +++ b/fail2ban/tests/files/logs/monit @@ -1,7 +1,7 @@ # Previous version -- -# failJSON: { "time": "2005-04-16T21:05:29", "match": true , "host": "69.93.127.111" } +# failJSON: { "time": "2005-04-17T06:05:29", "match": true , "host": "69.93.127.111" } [PDT Apr 16 21:05:29] error : Warning: Client '69.93.127.111' supplied unknown user 'foo' accessing monit httpd -# failJSON: { "time": "2005-04-16T20:59:33", "match": true , "host": "97.113.189.111" } +# failJSON: { "time": "2005-04-17T05:59:33", "match": true , "host": "97.113.189.111" } [PDT Apr 16 20:59:33] error : Warning: Client '97.113.189.111' supplied wrong password for user 'admin' accessing monit httpd # Current version -- corresponding "https://bitbucket.org/tildeslash/monit/src/6905335aa903d425cae732cab766bd88ea5f2d1d/src/http/processor.c?at=master&fileviewer=file-view-default#processor.c-728"