Module: check_mk
Branch: master
Commit: 9240615db7d6c0b730b380dc94654d25a1914743
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9240615db7d6c0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Mar 17 09:28:27 2017 +0100
4502 FIX LDAP: Fixed setting default values for user/group filters and attributes
Change-Id: Ie044104addcea9b3a778629624de34aefc6a077a
---
.werks/4502 | 11 +++++++++++
web/plugins/userdb/ldap.py | 8 ++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/.werks/4502 b/.werks/4502
new file mode 100644
index 0000000..d692886
--- /dev/null
+++ b/.werks/4502
@@ -0,0 +1,11 @@
+Title: LDAP: Fixed setting default values for user/group filters and attributes
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1489739280
+
+
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index d747f94..fa3e2b9 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -1244,7 +1244,9 @@ g_editing_connection_id = None
def ldap_attr_of_connection(connection_id, attr):
connection = get_connection(connection_id)
if not connection:
- return None
+ # Handle "new connection" situation where there is no connection object
existant yet.
+ # The default type is "Active directory", so we use it here.
+ return ldap_attr_map["ad"].get(attr, attr).lower()
return connection.ldap_attr(attr)
@@ -1253,7 +1255,9 @@ def ldap_attr_of_connection(connection_id, attr):
def ldap_filter_of_connection(connection_id, *args, **kwargs):
connection = get_connection(connection_id)
if not connection:
- return None
+ # Handle "new connection" situation where there is no connection object
existant yet.
+ # The default type is "Active directory", so we use it here.
+ return ldap_filter_map["ad"].get(args[0], '(objectclass=*)')
return connection.ldap_filter(*args, **kwargs)