summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-09-20 14:03:08 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-09-20 14:03:08 (GMT)
commit91d7125c2e2b64634dfc376e7b9856fda6bddfa7 (patch)
treedf92adabb522e85a4c57680bb8144d62f13bc66d
parent25a56ceb45e3195835995803f9893d539df2ad93 (diff)
downloadpykolab-91d7125c2e2b64634dfc376e7b9856fda6bddfa7.tar.gz
Increase the efficiency of three frequently used queries:
- The search for recipients does not have to include the nsuniqueid attribute, - Not all domains list have to include all domains, - There's no need to search for supported controls if we already know what controls are supported.
-rw-r--r--pykolab/auth/ldap/__init__.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 78a505f..042592b 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -393,7 +393,12 @@ class LDAP(pykolab.base.Base):
kolab_filter = self._kolab_filter()
recipient_address_attrs = self.config_get_list("mail_attributes")
- result_attributes = recipient_address_attrs
+
+ result_attributes = []
+
+ for recipient_address_attr in recipient_address_attrs:
+ result_attributes.append(recipient_address_attr)
+
result_attributes.append(self.config_get('unique_attribute'))
_filter = "(|"
@@ -2000,7 +2005,7 @@ class LDAP(pykolab.base.Base):
return _filter
- def _list_domains(self):
+ def _list_domains(self, domain=None):
"""
Find the domains related to this Kolab setup, and return a list of
DNS domain names.
@@ -2028,6 +2033,9 @@ class LDAP(pykolab.base.Base):
# If we haven't returned already, let's continue searching
domain_filter = conf.get('ldap', 'domain_filter')
+ if not domain == None:
+ domain_filter = domain_filter.replace('*', domain)
+
if domain_base_dn == None or domain_filter == None:
return []
@@ -2502,6 +2510,14 @@ class LDAP(pykolab.base.Base):
the first one supported.
"""
+ supported_controls = conf.get_list('ldap', 'supported_controls')
+
+ if not supported_controls == None and not len(supported_controls) < 1:
+ for control_num in [(int)(x) for x in supported_controls]:
+ self.ldap.supported_controls.append(
+ SUPPORTED_LDAP_CONTROLS[control_num]['func']
+ )
+
if len(self.ldap.supported_controls) < 1:
for control_num in SUPPORTED_LDAP_CONTROLS.keys():
log.debug(