summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-12-11 14:33:16 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-12-11 14:33:16 +0100
commitcdfc34e7de1d8174d97d5ba2e1caf828a7f6bae7 (patch)
tree314cd4064d1440a1b3d1c7ac4586a4d26c52a470
parenta48d1eb0ddfe2bece439344aedaecae2770d3a79 (diff)
downloadpykolab-cdfc34e7de1d8174d97d5ba2e1caf828a7f6bae7.tar.gz
Use the configured [ldap] domain_filter setting in _kolab_find_root_dn() (#4076)
-rw-r--r--pykolab/auth/ldap/__init__.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index c5b98c3..e6f43b3 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -2140,19 +2140,22 @@ class LDAP(pykolab.base.Base):
domain_base_dn = conf.get('ldap', 'domain_base_dn', quiet=True)
- if not domain_base_dn == "":
+ domain_filter = conf.get('ldap', 'domain_filter')
+
+ if not domain == None:
+ domain_filter = domain_filter.replace('*', domain)
- # If we haven't returned already, let's continue searching
- domain_name_attribute = conf.get('ldap', 'domain_name_attribute')
+ if not domain_base_dn == "":
_results = self._search(
domain_base_dn,
ldap.SCOPE_SUBTREE,
- "(%s=%s)" % (domain_name_attribute,domain),
+ domain_filter,
override_search='_regular_search'
)
domains = []
+
for _domain in _results:
(domain_dn, _domain_attrs) = _domain
domain_rootdn_attribute = conf.get(
@@ -2163,11 +2166,13 @@ class LDAP(pykolab.base.Base):
if _domain_attrs.has_key(domain_rootdn_attribute):
self.domain_rootdns[domain] = _domain_attrs[domain_rootdn_attribute]
return _domain_attrs[domain_rootdn_attribute]
+
else:
if isinstance(_domain_attrs[domain_name_attribute], list):
domain = _domain_attrs[domain_name_attribute][0]
else:
domain = _domain_attrs[domain_name_attribute]
+
else:
if conf.has_option('ldap', 'base_dn'):
return conf.get('ldap', 'base_dn')