4 commits - pykolab/auth pykolab/imap
Jeroen van Meeuwen
vanmeeuwen at kolabsys.com
Wed Sep 18 16:35:04 CEST 2013
pykolab/auth/__init__.py | 2 +-
pykolab/auth/ldap/__init__.py | 17 +++++++++++++----
pykolab/imap/__init__.py | 2 +-
3 files changed, 15 insertions(+), 6 deletions(-)
New commits:
commit 65e8189af3c1cb9bb9c623cd7592eddeb356f5e8
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Sep 18 15:34:31 2013 +0100
Store a domain's root dn once it is found, so that subsequent actions against the same base sub-class instance do not need to search again and again
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index cdb9ade..78a505f 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1933,6 +1933,12 @@ class LDAP(pykolab.base.Base):
return _user_dn
def _kolab_domain_root_dn(self, domain):
+ if not hasattr(self, 'domain_rootdns'):
+ self.domain_rootdns = {}
+
+ if self.domain_rootdns.has_key(domain):
+ return self.domain_rootdns[domain]
+
self._bind()
log.debug(_("Finding domain root dn for domain %s") % (domain), level=8)
@@ -1963,16 +1969,19 @@ class LDAP(pykolab.base.Base):
)
_domain_attrs = utils.normalize(_domain_attrs)
if _domain_attrs.has_key(domain_rootdn_attribute):
+ self.domain_rootdns[domain] = _domain_attrs[domain_rootdn_attribute]
return _domain_attrs[domain_rootdn_attribute]
else:
if isinstance(_domain_attrs[domain_name_attribute], list):
domain = _domain_attrs[domain_name_attribute][0]
-
+ else:
+ domain = _domain_attrs[domain_name_attribute]
else:
if conf.has_option('ldap', 'base_dn'):
return conf.get('ldap', 'base_dn')
- return utils.standard_root_dn(domain)
+ self.domain_rootdns[domain] = utils.standard_root_dn(domain)
+ return self.domain_rootdns[domain]
def _kolab_filter(self):
"""
commit 9017334c9304b945d6838816cc4d6fab731df6a4
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Sep 18 14:36:10 2013 +0100
Avoid duplicating the search for a domain root dn / domain connection
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index fd02083..f07d383 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -180,7 +180,7 @@ class Auth(pykolab.base.Base):
"""
Find one or more entries corresponding to the recipient address.
"""
- if not domain == None:
+ if not domain == None and not self.domain == domain:
self.connect(domain=domain)
result = self._auth.find_recipient(address)
commit a4bbb85b2e377d0fe1bb76f127dc7d5f58d964a3
Merge: 1dad011 5f76c88
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Wed Sep 18 14:17:47 2013 +0100
Merge branch 'master' of ssh://git.kolabsys.com/git/pykolab
commit 1dad011fd3005577481b359426cebe5fb41743fa
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date: Sun Sep 15 11:49:16 2013 +0100
Make sure the user mailbox name is lower-cased when comparing to normalized user mailbox names in IMAP
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index e0128cc..e3ca936 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1184,14 +1184,14 @@ class LDAP(pykolab.base.Base):
self.imap.connect(domain=self.domain)
- if not self.imap.user_mailbox_exists(entry[result_attribute]):
+ if not self.imap.user_mailbox_exists(entry[result_attribute].lower()):
folder = self.imap.user_mailbox_create(
entry[result_attribute],
entry[mailserver_attribute]
)
else:
- folder = "user%s%s" % (self.imap.separator,entry[result_attribute])
+ folder = "user%s%s" % (self.imap.separator,entry[result_attribute].lower())
server = self.imap.user_mailbox_server(folder)
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 20e284b..adf0006 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -602,7 +602,7 @@ class IMAP(object):
log.warning(_("Moving INBOX folder %s won't succeed as target folder %s already exists") % (old_name,new_name))
def user_mailbox_server(self, mailbox):
- return self.imap.find_mailfolder_server(mailbox)
+ return self.imap.find_mailfolder_server(mailbox.lower())
def has_folder(self, folder):
"""
More information about the commits
mailing list