From 89ef9747f9bdfd2e674671a6da3bd96679a72cc2 Mon Sep 17 00:00:00 2001 From: Ruben van Staveren Date: Thu, 10 Mar 2022 11:20:50 +0100 Subject: [PATCH] Decode as ascii and work from there instead --- jail2ban/auth.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jail2ban/auth.py b/jail2ban/auth.py index 15f577d..d9867bf 100644 --- a/jail2ban/auth.py +++ b/jail2ban/auth.py @@ -6,9 +6,13 @@ def get_users(): if 'users' not in g: users = {} authfile = current_app.config['AUTHFILE'] - with current_app.open_resource(os.path.join(current_app.instance_path, + + current_app.logger.debug('Reading %s for users', authfile) + + with current_app.open_resource(os.path.join("..", authfile)) as f: for entry in f: - users.update({tuple(entry.split(b':', 1))}) + users.update({tuple(entry.decode('ascii').strip().split(':', 1))}) g.users = users + current_app.logger.debug(g.users) return g.users