summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-05-23 15:37:07 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-05-23 15:37:07 +0200
commitc915487867d227617f8ae7d996af51e5470ff54e (patch)
treec3048fd1db9f4d6704230272e2e71c372ac8ce1c /pykolab
parentcdf8599b29826b815bc14f7a4c6b07c628678366 (diff)
downloadpykolab-c915487867d227617f8ae7d996af51e5470ff54e.tar.gz
Make sure that in a multi-domain environment, we get the base dn for additional domain name spaces right.
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/auth/__init__.py15
-rw-r--r--pykolab/auth/ldap/__init__.py12
-rw-r--r--pykolab/base.py5
3 files changed, 22 insertions, 10 deletions
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index f4de1e1..b75f9c3 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -37,15 +37,10 @@ class Auth(pykolab.base.Base):
"""
Initialize the authentication class.
"""
- pykolab.base.Base.__init__(self)
+ pykolab.base.Base.__init__(self, domain=domain)
self._auth = None
- if not domain == None:
- self.domain = domain
- else:
- self.domain = conf.get('kolab', 'primary_domain')
-
def authenticate(self, login):
"""
Verify login credentials supplied in login against the appropriate
@@ -97,8 +92,12 @@ class Auth(pykolab.base.Base):
return
if domain == None:
- section = 'kolab'
- domain = conf.get('kolab', 'primary_domain')
+ if not self.domain == None:
+ section = self.domain
+ domain = self.domain
+ else:
+ section = 'kolab'
+ domain = conf.get('kolab', 'primary_domain')
else:
self.list_domains()
section = domain
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 6559ea0..a6a1044 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -868,8 +868,18 @@ class LDAP(pykolab.base.Base):
else:
override_search = False
+ 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
+
+ log.debug(_("Synchronization is searching against base DN: %s") % (base_dn), level=8)
+
self._search(
- self.config_get('base_dn'),
+ base_dn,
filterstr=_filter,
attrlist=[
'*',
diff --git a/pykolab/base.py b/pykolab/base.py
index b63ca2d..207783c 100644
--- a/pykolab/base.py
+++ b/pykolab/base.py
@@ -26,7 +26,10 @@ class Base(object):
Abstraction class for functions commonly shared between auth, imap, etc.
"""
def __init__(self, *args, **kw):
- self.domain = conf.get('kolab', 'primary_domain')
+ if kw.has_key('domain') and not kw['domain'] == None:
+ self.domain = kw['domain']
+ else:
+ self.domain = conf.get('kolab', 'primary_domain')
# Placeholder primary_domain => [secondary_domains]. Should be updated
# on auth backend _connect().