pykolab/auth

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Wed Jun 12 06:55:50 CEST 2013


 pykolab/auth/ldap/__init__.py |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit ff0d9bd7436b18aa890c3549a246f2ae1af8c46d
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jun 12 06:52:34 2013 +0200

    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

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']





More information about the commits mailing list