summaryrefslogtreecommitdiffstats
path: root/pykolab/auth/ldap/__init__.py
diff options
context:
space:
mode:
authorPaul Boddie <paul@boddie.org.uk>2014-01-22 17:41:10 +0100
committerPaul Boddie <paul@boddie.org.uk>2014-01-22 17:41:10 +0100
commit5be36e94f27a56bb82acea1caf8a009ada11460d (patch)
treeaf06c44e9256882c80d595e80cc62560ec68b424 /pykolab/auth/ldap/__init__.py
parent20483f4353e164e54c5271829cc770aab57af1bc (diff)
parent70681e3d0c10b5fa9f043cbc62ea56eb645ab313 (diff)
downloadpykolab-5be36e94f27a56bb82acea1caf8a009ada11460d.tar.gz
Merge remote-tracking branch 'origin/master' (with some minor style changes)
Conflicts: pykolab/auth/ldap/__init__.py pykolab/imap/__init__.py
Diffstat (limited to 'pykolab/auth/ldap/__init__.py')
-rw-r--r--pykolab/auth/ldap/__init__.py38
1 files changed, 35 insertions, 3 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index f83cd20..19d4eda 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -196,7 +196,7 @@ class LDAP(pykolab.base.Base):
try:
log.debug(_("Binding with user_dn %s and password %s")
- % (entry_dn, login[1]))
+ % (entry_dn, '*' * len(login[1])))
# Needs to be synchronous or succeeds and continues setting retval
# to True!!
@@ -220,7 +220,7 @@ class LDAP(pykolab.base.Base):
else:
try:
log.debug(_("Binding with user_dn %s and password %s")
- % (entry_dn, login[1]))
+ % (entry_dn, '*' * len(login[1])))
# Needs to be synchronous or succeeds and continues setting retval
# to True!!
@@ -602,6 +602,11 @@ class LDAP(pykolab.base.Base):
if len(mail_attributes) >= 2:
secondary_mail_attribute = mail_attributes[1]
+ daemon_rcpt_policy = self.config_get('daemon_rcpt_policy')
+ if not utils.true_or_false(daemon_rcpt_policy) == False and not daemon_rcpt_policy == None:
+ log.info(_("Applying recipient policy disabled through configuration"))
+ return entry_modifications
+
want_attrs = []
log.debug(_("Applying recipient policy to %r") % (entry_dn), level=8)
@@ -1244,7 +1249,13 @@ class LDAP(pykolab.base.Base):
if mailserver_attribute is 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()
if not entry.has_key(mailserver_attribute):
entry[mailserver_attribute] = \
@@ -1539,7 +1550,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
@@ -1574,9 +1595,20 @@ 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 not entry[mailserver_attribute]:
+ server = None
+ else:
+ server = entry[mailserver_attribute].lower()
+
if entry.get(result_attribute):
+
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" % (