summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-07-15 11:56:51 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-07-15 11:56:51 (GMT)
commitade3208d4b0bf5bf36b75d2045026b23213f96c7 (patch)
tree18b1723e6cd78c8487aa39e82bb6a48adffc07f6
parentd2fd54d3cced50400018c46d53ee56598bfcc109 (diff)
downloadpykolab-ade3208d4b0bf5bf36b75d2045026b23213f96c7.tar.gz
Improvide the find_recipient() against a multi-domain environment
-rw-r--r--pykolab/auth/ldap/__init__.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 082484a..cbe4830 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -374,8 +374,16 @@ class LDAP(pykolab.base.Base):
if len(_filter) <= 6:
return None
+ 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
+
_results = self.ldap.search_s(
- self.config_get('base_dn'),
+ base_dn,
scope=ldap.SCOPE_SUBTREE,
filterstr=_filter,
attrlist=result_attributes,
@@ -419,8 +427,6 @@ class LDAP(pykolab.base.Base):
__filter_prefix = "(&%s" % resource_filter
__filter_suffix = ")"
- resource_base_dn = self.config_get('resource_base_dn')
-
recipient_address_attrs = self.config_get_list("mail_attributes")
result_attributes = recipient_address_attrs
@@ -444,6 +450,14 @@ class LDAP(pykolab.base.Base):
if len(_filter) <= 6:
return None
+ config_base_dn = self.config_get('resource_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:
+ resource_base_dn = ldap_base_dn
+ else:
+ resource_base_dn = config_base_dn
+
_results = self.ldap.search_s(
resource_base_dn,
scope=ldap.SCOPE_SUBTREE,