pykolab/auth
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Thu Dec 11 14:33:57 CET 2014
pykolab/auth/ldap/__init__.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit cdfc34e7de1d8174d97d5ba2e1caf828a7f6bae7
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Thu Dec 11 14:33:16 2014 +0100
Use the configured [ldap] domain_filter setting in _kolab_find_root_dn() (#4076)
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')
More information about the commits
mailing list