From d0bcacd97be8d2eac24c048d0f58b5b93ee90340 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Fri, 2 Jan 2015 02:55:40 -0500 Subject: [PATCH 1/5] Fix strptime thread safety issue strptime thread safety hack-around - http://bugs.python.org/issue7980 --- bin/fail2ban-client | 3 +++ bin/fail2ban-regex | 3 +++ bin/fail2ban-server | 3 +++ 3 files changed, 9 insertions(+) diff --git a/bin/fail2ban-client b/bin/fail2ban-client index 866a52874..b91c339c0 100755 --- a/bin/fail2ban-client +++ b/bin/fail2ban-client @@ -430,6 +430,9 @@ class ServerExecutionException(Exception): pass if __name__ == "__main__": # pragma: no cover - can't test main + from time import strptime + # strptime thread safety hack-around - http://bugs.python.org/issue7980 + strptime("2012", "%Y") client = Fail2banClient() # Exit with correct return value if client.start(sys.argv): diff --git a/bin/fail2ban-regex b/bin/fail2ban-regex index 5644dd37f..96aca926b 100755 --- a/bin/fail2ban-regex +++ b/bin/fail2ban-regex @@ -474,6 +474,9 @@ class Fail2banRegex(object): if __name__ == "__main__": + from time import strptime + # strptime thread safety hack-around - http://bugs.python.org/issue7980 + strptime("2012", "%Y") parser = get_opt_parser() (opts, args) = parser.parse_args() diff --git a/bin/fail2ban-server b/bin/fail2ban-server index ec0c0dbe2..dc8d81b49 100755 --- a/bin/fail2ban-server +++ b/bin/fail2ban-server @@ -131,6 +131,9 @@ class Fail2banServer: return False if __name__ == "__main__": + from time import strptime + # strptime thread safety hack-around - http://bugs.python.org/issue7980 + strptime("2012", "%Y") server = Fail2banServer() if server.start(sys.argv): sys.exit(0) From b26725f654f2c58a219367f5221da0c148a5cd55 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Sat, 3 Jan 2015 13:45:06 -0500 Subject: [PATCH 2/5] Move strptime workaround to fail2ban/__init__.py --- bin/fail2ban-client | 3 --- bin/fail2ban-regex | 3 --- bin/fail2ban-server | 3 --- fail2ban/__init__.py | 4 ++++ 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/bin/fail2ban-client b/bin/fail2ban-client index b91c339c0..866a52874 100755 --- a/bin/fail2ban-client +++ b/bin/fail2ban-client @@ -430,9 +430,6 @@ class ServerExecutionException(Exception): pass if __name__ == "__main__": # pragma: no cover - can't test main - from time import strptime - # strptime thread safety hack-around - http://bugs.python.org/issue7980 - strptime("2012", "%Y") client = Fail2banClient() # Exit with correct return value if client.start(sys.argv): diff --git a/bin/fail2ban-regex b/bin/fail2ban-regex index 96aca926b..5644dd37f 100755 --- a/bin/fail2ban-regex +++ b/bin/fail2ban-regex @@ -474,9 +474,6 @@ class Fail2banRegex(object): if __name__ == "__main__": - from time import strptime - # strptime thread safety hack-around - http://bugs.python.org/issue7980 - strptime("2012", "%Y") parser = get_opt_parser() (opts, args) = parser.parse_args() diff --git a/bin/fail2ban-server b/bin/fail2ban-server index dc8d81b49..ec0c0dbe2 100755 --- a/bin/fail2ban-server +++ b/bin/fail2ban-server @@ -131,9 +131,6 @@ class Fail2banServer: return False if __name__ == "__main__": - from time import strptime - # strptime thread safety hack-around - http://bugs.python.org/issue7980 - strptime("2012", "%Y") server = Fail2banServer() if server.start(sys.argv): sys.exit(0) diff --git a/fail2ban/__init__.py b/fail2ban/__init__.py index cbaaf757d..b79060991 100644 --- a/fail2ban/__init__.py +++ b/fail2ban/__init__.py @@ -68,3 +68,7 @@ logging.notice = _root_notice # add NOTICE to the priority map of all the levels logging.handlers.SysLogHandler.priority_map['NOTICE'] = 'notice' + +from time import strptime +# strptime thread safety hack-around - http://bugs.python.org/issue7980 +strptime("2012", "%Y") From 541a747d7949e42844c2637d8e94cf92aedf8075 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Sat, 3 Jan 2015 15:19:58 -0500 Subject: [PATCH 3/5] Update Changelog with strptime fix --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index c80dac5a9..5bf5a084b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,6 +21,7 @@ ver. 0.9.2 (2014/XX/XXX) - wanna-be-released * filters.d/exim.conf - cover different settings of exim logs details. Thanks bes.internal * filter.d/postfix-sasl.conf - failregex is now case insensitive + * fail2ban/__init__.py - Added strptime thread safety hack-around - New Features: - New interpolation feature for config readers - `%(known/parameter)s`. From 2f360ce44724a570f18e20b79f528e1ea947606e Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Sat, 3 Jan 2015 15:26:34 -0500 Subject: [PATCH 4/5] Update Changelog with strptime fix --- ChangeLog | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e686adb4..040ff48cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -21,11 +21,8 @@ ver. 0.9.2 (2014/XX/XXX) - wanna-be-released * filters.d/exim.conf - cover different settings of exim logs details. Thanks bes.internal * filter.d/postfix-sasl.conf - failregex is now case insensitive -<<<<<<< HEAD - * fail2ban/__init__.py - Added strptime thread safety hack-around -======= * filters.d/postfix.conf - add 'Client host rejected error message' failregex ->>>>>>> 8fc32bb33f6f8c43fa107f1a6fc3a71bf000a767 + * fail2ban/__init__.py - Added strptime thread safety hack-around - New Features: - New interpolation feature for config readers - `%(known/parameter)s`. From 4714028c69412018498f469837238f0f7b793f53 Mon Sep 17 00:00:00 2001 From: Lee Clemens Date: Sat, 3 Jan 2015 16:16:23 -0500 Subject: [PATCH 5/5] Change case and tense for consistency --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 040ff48cc..73a3693b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,7 +22,7 @@ ver. 0.9.2 (2014/XX/XXX) - wanna-be-released details. Thanks bes.internal * filter.d/postfix-sasl.conf - failregex is now case insensitive * filters.d/postfix.conf - add 'Client host rejected error message' failregex - * fail2ban/__init__.py - Added strptime thread safety hack-around + * fail2ban/__init__.py - add strptime thread safety hack-around - New Features: - New interpolation feature for config readers - `%(known/parameter)s`.