From 7e2ab36d86998575853150c0a57de5e22518cf66 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 21 Jun 2022 16:55:57 +0200 Subject: [PATCH] move global groups to start of expression (python 3.11 compat) --- fail2ban/client/fail2banregex.py | 2 +- fail2ban/server/datetemplate.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fail2ban/client/fail2banregex.py b/fail2ban/client/fail2banregex.py index 8c03b2dd..de7cde60 100644 --- a/fail2ban/client/fail2banregex.py +++ b/fail2ban/client/fail2banregex.py @@ -334,7 +334,7 @@ class Fail2banRegex(object): fltFile = None fltOpt = {} if regextype == 'fail': - if re.search(r'^(?ms)/{0,3}[\w/_\-.]+(?:\[.*\])?$', value): + if re.search(r'(?ms)^/{0,3}[\w/_\-.]+(?:\[.*\])?$', value): try: fltName, fltOpt = extractOptions(value) if "." in fltName[~5:]: diff --git a/fail2ban/server/datetemplate.py b/fail2ban/server/datetemplate.py index 8f1aaeb4..e02772d8 100644 --- a/fail2ban/server/datetemplate.py +++ b/fail2ban/server/datetemplate.py @@ -35,6 +35,7 @@ logSys = getLogger(__name__) # check already grouped contains "(", but ignores char "\(" and conditional "(?(id)...)": RE_GROUPED = re.compile(r'(?