Module: check_mk
Branch: master
Commit: 1aee94e80c947bf3ab0fd5c4f43d6900bd2fb985
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1aee94e80c947b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Jan 17 13:08:43 2013 +0100
FIX: LDAP: Fixed encoding problem of ldap retrieved usernames
---
ChangeLog | 1 +
web/htdocs/userdb.py | 3 +++
web/plugins/userdb/ldap.py | 4 ++--
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e09e3fe..f009631 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,7 @@
contactgroup sync plugin enabled
* FIX: LDAP: OpenLDAP - Changed default filter for users
* FIX: LDAP: OpenLDAP - Using uniqueMember instead of member when searching for
groups of a user
+ * FIX: LDAP: Fixed encoding problem of ldap retrieved usernames
* LDAP: Role sync plugin validates the given group DNs with the group base dn now
* LDAP: Using roles defined in default user profile in role sync plugin processing
* LDAP: Improved error handling in case of misconfigurations
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index 843994c..2699f6c 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -472,6 +472,9 @@ def hook_login(username, password):
# False -> failed
if result not in [ False, None ]:
username = result
+ if type(username) != str:
+ raise MKInternalError(_("The username returned by the %s "
+ "connector is not of type string (%r).") %
(connector['id'], username))
# Check wether or not the user exists (and maybe create it)
create_non_existing_user(connector['id'], username)
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index bc5469a..b812658 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -35,7 +35,7 @@ except:
pass
from lib import *
-g_ladp_user_cache = {}
+g_ldap_user_cache = {}
g_ldap_group_cache = {}
# File for storing the time of the last success event
@@ -571,7 +571,7 @@ def ldap_login(username, password):
# authentication which should be rebound again after trying this.
try:
ldap_bind(user_dn, password)
- result = username
+ result = username.encode('utf-8')
except:
result = False