Branch 'pykolab-0.6' - 5 commits - configure.ac conf/kolab.conf pykolab/auth pykolab/imap

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Tue Jan 14 23:35:31 CET 2014


 conf/kolab.conf               |    4 ++++
 configure.ac                  |    2 +-
 pykolab/auth/ldap/__init__.py |   33 ++++++++++++++++++++++++++++++++-
 pykolab/imap/__init__.py      |   22 +++++++++++-----------
 4 files changed, 48 insertions(+), 13 deletions(-)

New commits:
commit 725498a2b16c32aa6866c138c20b0da8c7768829
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Jan 14 13:27:53 2014 +0100

    Release 0.6.10

diff --git a/configure.ac b/configure.ac
index c1a3399..f13c3b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([pykolab], 0.6.9)
+AC_INIT([pykolab], 0.6.10)
 AC_SUBST([RELEASE], 1)
 
 AC_CONFIG_SRCDIR(pykolab/constants.py.in)


commit 97b7cafdfb589717409606c911dad231a09ce276
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Jan 14 13:26:20 2014 +0100

    Add a configuration option to disable the application of the recipient policy by the kolabd daemon -- so the web administration panel can continue to suggest a generated value but allow read/write access to the attribute in its form(s).

diff --git a/conf/kolab.conf b/conf/kolab.conf
index 0abe802..30c75a2 100644
--- a/conf/kolab.conf
+++ b/conf/kolab.conf
@@ -52,6 +52,10 @@ secondary_mail = {
         }
     }
 
+; To disable the application of the recipient policy by the daemon ('kolabd' service),
+; uncomment the next line.
+;daemon_rcpt_policy = False
+
 ; A global default for folders to create in addition to the INBOX
 ; folder.
 autocreate_folders = {
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index d9cf0d0..bf75489 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -562,6 +562,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)


commit 289936c3a6e010853e909c3b7677ef3ed9fa07aa
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Jan 14 13:20:22 2014 +0100

    .lower() both the mailserver_attribute as well as the result_attribute

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index e59b36d..d9cf0d0 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1277,7 +1277,13 @@ class LDAP(pykolab.base.Base):
         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()
 
         if not entry.has_key(mailserver_attribute):
             entry[mailserver_attribute] = \


commit 30774baad63ce2eaab4a1af3369aa94cd99ca88f
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Jan 14 13:18:12 2014 +0100

    Verbose logging about the tests we execute to see if a user needs to be subscribed to a particular (additional) folder.
    Attempt to subscribe, but fail without a traceback should subscribing not succeed.
    Verbose logging on the server address found for a mailbox, for the purpose of troubleshooting deployments that exploit case-sensitivity of server addresses.

diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index b154476..fbaaf28 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -559,6 +559,10 @@ class IMAP(object):
             for _shared in shared:
                 _tests.append(_shared)
 
+        log.debug(_("Using the following tests for folder subscriptions:"), level=8)
+        for _test in _tests:
+            log.debug(_("    %r") % (_test), level=8)
+
         for _folder in self.lm():
             log.debug(_("Folder %s") % (_folder), level=8)
 
@@ -571,18 +575,12 @@ class IMAP(object):
                 if _folder.startswith(_test):
                     _subscribe = False
 
-                    # If the namespace prefix for "shared" is "", we need to
-                    # catch this.
-                    for __test in _tests:
-                        if _subscribe:
-                            continue
-
-                        if _folder.startswith(__test):
-                            _subscribe = True
-
             if _subscribe:
                 log.debug(_("Subscribing %s to folder %s") % (folder, _folder), level=8)
-                self.subscribe(_folder)
+                try:
+                    self.subscribe(_folder)
+                except Exception, errmsg:
+                    log.error(_("Subscribing %s to folder %s failed: %r") % (folder, _folder, errmsg))
 
         self.logout()
         self.connect(domain=self.domain)
@@ -647,7 +645,9 @@ 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.lower())
+        server = self.imap.find_mailfolder_server(mailbox.lower()).lower()
+        log.debug(_("Server for mailbox %r is %r") % (mailbox, server), level=8)
+        return server
 
     def has_folder(self, folder):
         """


commit 1263bc72d593c991c11d05fdba75225d7ecf078a
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Jan 14 13:02:33 2014 +0100

    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.

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" % (




More information about the commits mailing list