Module: check_mk
Branch: master
Commit: a6edf6239a3a5554b6ed81cb33b86451b865fac9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a6edf6239a3a55…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 25 13:54:45 2016 +0200
3767 FIX Fixed possible UnicodeDecodeError when having users with umlauts in the user ID
---
.werks/3767 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/config.py | 2 +-
web/htdocs/userdb.py | 3 ++-
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.werks/3767 b/.werks/3767
new file mode 100644
index 0000000..919ecfd
--- /dev/null
+++ b/.werks/3767
@@ -0,0 +1,10 @@
+Title: Fixed possible UnicodeDecodeError when having users with umlauts in the user ID
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1472126075
+
+
diff --git a/ChangeLog b/ChangeLog
index 369e1ae..07ddcfe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -455,6 +455,7 @@
* 3561 FIX: Removing a comment now also removes any linked acknowledgements...
* 3763 FIX: Fixed playing sounds in views when using current Firefox...
* 3779 FIX: availability: added validation of availability options
+ * 3767 FIX: Fixed possible UnicodeDecodeError when having users with umlauts in the
user ID
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index 90fb6f6..a9175de 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -337,7 +337,7 @@ def roles_of_user(user):
return [ "guest" ]
elif users != None and user in users:
return [ "user" ]
- elif os.path.exists(config_dir + "/" + user +
"/automation.secret"):
+ elif os.path.exists(config_dir + "/" + user.encode("utf-8") +
"/automation.secret"):
return [ "guest" ] # unknown user with automation account
elif 'roles' in default_user_profile:
return existing_role_ids(default_user_profile['roles'])
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index 043df3c..6890de4 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -229,7 +229,8 @@ def _user_exists_according_to_profile(username):
def _user_exists_htpasswd(username):
for line in open(defaults.htpasswd_file):
- if line.startswith("%s:" % username):
+ l = line.decode("utf-8")
+ if l.startswith("%s:" % username):
return True
return False