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-10-23 10:10:55 (GMT)
commit141606a63cb6561e548a4839b998c2103b145377 (patch)
tree46da2960111de7abaae9c5bf4dc85384eb2bfdb3
parent468557e3799b647c3b444ff7c7f8eac07fa55c18 (diff)
downloadpykolab-141606a63cb6561e548a4839b998c2103b145377.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 b1b01bb..f90add1 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -345,7 +345,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 = "(|"
@@ -1640,7 +1645,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.
@@ -1668,6 +1673,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 []
@@ -2133,6 +2141,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(