diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-06-12 06:52:34 +0200 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-06-12 06:52:34 +0200 |
commit | ff0d9bd7436b18aa890c3549a246f2ae1af8c46d (patch) | |
tree | 40aa2f975b3cae02c384233281ae404ec94078a6 /pykolab | |
parent | 73d81a101b3434d0162b3ca961ca5767b84a99af (diff) | |
download | pykolab-ff0d9bd7436b18aa890c3549a246f2ae1af8c46d.tar.gz |
Pass the domain on to the pykolab.base.Base.__init__()
Use the kolab_user_filter if available, allowing us to further restrict valid logins
Use the LDAP base_dn if there is no configured base_dn for authentication requests
Diffstat (limited to 'pykolab')
-rw-r--r-- | pykolab/auth/ldap/__init__.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py index 4df0aa2..29448a5 100644 --- a/pykolab/auth/ldap/__init__.py +++ b/pykolab/auth/ldap/__init__.py @@ -110,7 +110,7 @@ class LDAP(pykolab.base.Base): Initialize the LDAP object for domain. If no domain is specified, domain name space configured as 'kolab'.'primary_domain' is used. """ - pykolab.base.Base.__init__(self) + pykolab.base.Base.__init__(self, domain=domain) self.ldap = None self.bind = False @@ -151,7 +151,10 @@ class LDAP(pykolab.base.Base): self.connect() self._bind() - user_filter = self.config_get('user_filter') + user_filter = self.config_get('kolab_user_filter') + + if user_filter == None: + user_filter = self.config_get('user_filter') _filter = '(&(|' @@ -163,8 +166,16 @@ class LDAP(pykolab.base.Base): _filter += ')%s)' % (user_filter) + config_base_dn = self.config_get('base_dn') + ldap_base_dn = self._kolab_domain_root_dn(self.domain) + + if not ldap_base_dn == None and not ldap_base_dn == config_base_dn: + base_dn = ldap_base_dn + else: + base_dn = config_base_dn + _search = self.ldap.search_ext( - self.config_get('base_dn'), + base_dn, ldap.SCOPE_SUBTREE, _filter, ['entrydn'] |