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-15 16:19:51 +0100
commite771aa6abbc258c13772211028dcdf525cab4ba9 (patch)
tree84fa72d968e91bbf74d6bc00aeed300ce469fa8e
parent7f579ade3fd1607eecb113228d8636aa91da58a1 (diff)
downloadpykolab-e771aa6abbc258c13772211028dcdf525cab4ba9.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 f90add1..e988f1b 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1386,7 +1386,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
@@ -1424,11 +1434,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" % (