summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-01-14 13:02:33 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-01-14 13:03:35 +0100
commit7748c269ca10c1ca966af6c46fb9a8ed863c03f8 (patch)
tree68f914039df6d8454fc985bfb73e524bac94b43e
parent38fad0deb17238733021846374d66ea2f0a1c764 (diff)
downloadpykolab-7748c269ca10c1ca966af6c46fb9a8ed863c03f8.tar.gz
Entry Change Notifications of type None (such as during the initial synchronization using persistent search) may still have a mail server attribute value on their entry.
-rw-r--r--pykolab/auth/ldap/__init__.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 54d667c..e59b36d 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1757,7 +1757,17 @@ class LDAP(pykolab.base.Base):
"""
A user entry as part of the initial search result set.
"""
+ mailserver_attribute = self.config_get('mailserver_attribute')
+ if mailserver_attribute == None:
+ mailserver_attribute = 'mailhost'
+
+ mailserver_attribute = mailserver_attribute.lower()
+
result_attribute = conf.get('cyrus-sasl', 'result_attribute')
+ if result_attribute == None:
+ result_attribute = 'mail'
+
+ result_attribute = result_attribute.lower()
old_canon_attr = None
@@ -1792,11 +1802,21 @@ class LDAP(pykolab.base.Base):
self.imap.connect(domain=self.domain)
+ server = None
+
+ if not entry.has_key(mailserver_attribute):
+ entry[mailserver_attribute] = self.get_entry_attribute(entry, mailserver_attribute)
+
+ if entry[mailserver_attribute] == "" or entry[mailserver_attribute] == None:
+ server = None
+ else:
+ server = entry[mailserver_attribute].lower()
+
if entry.has_key(result_attribute) and \
not entry.has_key(result_attribute) == None:
if not self.imap.user_mailbox_exists(entry[result_attribute]):
- folder = self.imap.user_mailbox_create(entry[result_attribute])
+ folder = self.imap.user_mailbox_create(entry[result_attribute], server=server)
server = self.imap.user_mailbox_server(folder)
else:
folder = "user%s%s" % (