Module: check_mk
Branch: master
Commit: d5bc3faa0283cd9a7597bd2eff905d44a26f6009
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d5bc3faa0283cd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 31 12:00:24 2017 +0200
5169 FIX LDAP: Fixed syncing contact groups / roles of users with special characters in
their name
Change-Id: If925e8feeaee377b4d9c9a531cb076cb3e2cae31
---
.werks/5169 | 11 +++++++++++
web/plugins/userdb/ldap.py | 6 +++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/.werks/5169 b/.werks/5169
new file mode 100644
index 0000000..18d400c
--- /dev/null
+++ b/.werks/5169
@@ -0,0 +1,11 @@
+Title: LDAP: Fixed syncing contact groups / roles of users with special characters in
their name
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1504173591
+
+
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 6f82493..2559766 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -908,7 +908,7 @@ class LDAPUserConnector(UserConnector):
self._config['group_scope']):
groups[dn] = {
'cn' : obj['cn'][0],
- 'members' : [ m.encode('utf-8').lower() for m in
obj.get(member_attr,[]) ],
+ 'members' : [ m.lower() for m in obj.get(member_attr,[]) ],
}
else:
# Special handling for OpenLDAP when searching for groups by DN
@@ -917,7 +917,7 @@ class LDAPUserConnector(UserConnector):
['cn', member_attr],
'base'):
groups[f_dn] = {
'cn' : obj['cn'][0],
- 'members' : [ m.encode('utf-8').lower() for m in
obj.get(member_attr,[]) ],
+ 'members' : [ m.lower() for m in obj.get(member_attr,[])
],
}
return groups
@@ -1481,7 +1481,7 @@ def get_connection_choices(add_this=True):
# This is either the user id or the user distinguished name,
# depending on the LDAP server to communicate with
def get_group_member_cmp_val(connection, user_id, ldap_user):
- return connection.member_attr().lower() == 'memberuid' and user_id or
ldap_user['dn']
+ return user_id if connection.member_attr().lower() == 'memberuid' else
ldap_user['dn']
def get_groups_of_user(connection, user_id, ldap_user, cg_names, nested,
other_connection_ids):