11 commits - configure.ac pykolab/auth pykolab/cli pykolab/logger.py pykolab/setup saslauthd/__init__.py share/templates

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Sat Aug 3 11:49:11 CEST 2013


 configure.ac                             |    2 
 pykolab/auth/ldap/__init__.py            |   31 ++++++++++-
 pykolab/cli/cmd_delete_mailbox_acl.py    |    6 +-
 pykolab/cli/cmd_list_domain_mailboxes.py |   83 +++++++++++++++++++++++++++++++
 pykolab/cli/cmd_transfer_mailbox.py      |   10 +--
 pykolab/logger.py                        |    6 +-
 pykolab/setup/setup_mta.py               |    4 -
 saslauthd/__init__.py                    |    9 ++-
 share/templates/cyrus.conf.tpl           |    2 
 9 files changed, 138 insertions(+), 15 deletions(-)

New commits:
commit 612c27d2dfd422790ca3f246951b40ce57d3b530
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sat Aug 3 10:48:31 2013 +0100

    A standard root dn is the ,dc= version of the parent root domain, and not (potentially) an alias

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index ba9f017..22c3dfa 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -1927,6 +1927,9 @@ class LDAP(pykolab.base.Base):
                 _domain_attrs = utils.normalize(_domain_attrs)
                 if _domain_attrs.has_key(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:
             if conf.has_option('ldap', 'base_dn'):


commit fad96044eba850d871d34987317bd4e1d34e300f
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Aug 2 11:53:50 2013 +0100

    Configure Auth() correctly, or we will not be able to adjust the mailhost attribute

diff --git a/pykolab/cli/cmd_transfer_mailbox.py b/pykolab/cli/cmd_transfer_mailbox.py
index 4a4069a..cef9ec1 100644
--- a/pykolab/cli/cmd_transfer_mailbox.py
+++ b/pykolab/cli/cmd_transfer_mailbox.py
@@ -55,13 +55,13 @@ def execute(*args, **kw):
         domain = mbox_parts['domain']
         user_identifier = "%s@%s" % (mbox_parts['path_parts'][1], mbox_parts['domain'])
 
-    source_server = imap.user_mailbox_server(mailfolder)
-    imap.connect(server=source_server)
-    imap.imap.xfer(mailfolder, target_server)
-
-    auth = Auth()
+    auth = Auth(domain=domain)
     auth.connect()
 
     user = auth.find_recipient(user_identifier)
 
+    source_server = imap.user_mailbox_server(mailfolder)
+    imap.connect(server=source_server)
+    imap.imap.xfer(mailfolder, target_server)
+
     auth.set_entry_attributes(domain, user, {'mailhost': target_server})


commit a7bcbfccf3bb3fc7808ea625075e066f0783b1c8
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Aug 2 11:53:15 2013 +0100

    Use the base_dn obtained unless the proper routine finds different

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 4c4afc4..ba9f017 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -831,8 +831,16 @@ class LDAP(pykolab.base.Base):
 
         _filter = "(%s=%s)" % (attr, value)
 
+        config_base_dn = self.config_get('base_dn')
+        ldap_base_dn = self._kolab_domain_root_dn(self.domain)
+
+        if not ldap_base_dn == None and not ldap_base_dn == config_base_dn:
+            base_dn = ldap_base_dn
+        else:
+            base_dn = config_base_dn
+
         return self._search(
-                self.config_get('base_dn'),
+                base_dn,
                 filterstr=_filter,
                 attrlist=[
                         '*',
@@ -1794,7 +1802,13 @@ class LDAP(pykolab.base.Base):
 
         entry_dn = self.entry_dn(entry_id)
 
-        base_dn = self.config_get('base_dn')
+        config_base_dn = self.config_get('base_dn')
+        ldap_base_dn = self._kolab_domain_root_dn(self.domain)
+
+        if not ldap_base_dn == None and not ldap_base_dn == config_base_dn:
+            base_dn = ldap_base_dn
+        else:
+            base_dn = config_base_dn
 
         for _type in ['user', 'group', 'sharedfolder']:
             __filter = self.config_get('kolab_%s_filter' % (_type))


commit 090bd2f0bfbf2c6dbdde0b1fe915ce2e37f8ead0
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Aug 2 11:32:06 2013 +0100

    When deleting acls from many,many mailboxes in one go, the mailbox that occured in the list may not be around any longer, by the time we get to remove the acl

diff --git a/pykolab/cli/cmd_delete_mailbox_acl.py b/pykolab/cli/cmd_delete_mailbox_acl.py
index 888f882..727b00d 100644
--- a/pykolab/cli/cmd_delete_mailbox_acl.py
+++ b/pykolab/cli/cmd_delete_mailbox_acl.py
@@ -62,4 +62,8 @@ def execute(*args, **kw):
     else:
         folders = imap.lm(folder)
         for folder in folders:
-            imap.set_acl(folder, identifier, '')
\ No newline at end of file
+            try:
+                imap.set_acl(folder, identifier, '')
+            except:
+                # Mailbox no longer exists?
+                pass
\ No newline at end of file


commit a3ed0383ff97f0ab5c03ba26426ea65e4a31f4e6
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Fri Aug 2 11:28:55 2013 +0100

    Add a command to list mailboxes for a specific domain including its alias domains (for they may be different realms)

diff --git a/pykolab/cli/cmd_list_domain_mailboxes.py b/pykolab/cli/cmd_list_domain_mailboxes.py
new file mode 100644
index 0000000..684f1c8
--- /dev/null
+++ b/pykolab/cli/cmd_list_domain_mailboxes.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+# Copyright 2010-2013 Kolab Systems AG (http://www.kolabsys.com)
+#
+# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 3 or, at your option, any later version
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+import commands
+
+import pykolab
+
+from pykolab import imap_utf7
+from pykolab.auth import Auth
+from pykolab.imap import IMAP
+from pykolab.translate import _
+
+log = pykolab.getLogger('pykolab.cli')
+conf = pykolab.getConf()
+
+def __init__():
+    commands.register('list_domain_mailboxes', execute)
+
+def cli_options():
+    my_option_group = conf.add_cli_parser_option_group(_("CLI Options"))
+    my_option_group.add_option( '--raw',
+                                dest    = "raw",
+                                action  = "store_true",
+                                default = False,
+                                help    = _("Display raw IMAP UTF-7 folder names"))
+
+    my_option_group.add_option( '--server',
+                                dest    = "connect_server",
+                                action  = "store",
+                                default = None,
+                                metavar = "SERVER",
+                                help    = _("List mailboxes on server SERVER only."))
+
+def execute(*args, **kw):
+    """
+        List deleted mailboxes
+    """
+
+    try:
+        domain = conf.cli_args.pop(0)
+    except:
+        domain = utils.ask_question(_("Domain"))
+
+    imap = IMAP()
+    imap.connect()
+
+    auth = Auth()
+    auth.connect()
+
+    domains = auth.list_domains()
+
+    folders = []
+    for primary,secondaries in domains:
+        if not domain == primary and not domain in secondaries:
+            continue
+
+        folders.extend(imap.lm("user/%%@%s" % (primary)))
+        for secondary in secondaries:
+            folders.extend(imap.lm("user/%%@%s" % (secondary)))
+
+    print "Deleted folders:"
+
+    for folder in folders:
+        if not conf.raw:
+            print imap_utf7.decode(folder)
+        else:
+            print folder


commit c97a99192dd74dcf67fca1d35f03042d84cd5fa3
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jul 31 20:25:23 2013 +0100

    0.6.3

diff --git a/configure.ac b/configure.ac
index 0c5aa2c..fef68a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([pykolab], 0.6.2)
+AC_INIT([pykolab], 0.6.3)
 AC_SUBST([RELEASE], 1)
 
 AC_CONFIG_SRCDIR(pykolab/constants.py.in)


commit c632938b0ce07d8d7e15585424573ae4a8f10d9f
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jul 31 20:25:04 2013 +0100

    Catch LDAP errors

diff --git a/saslauthd/__init__.py b/saslauthd/__init__.py
index f04a232..4eaba67 100644
--- a/saslauthd/__init__.py
+++ b/saslauthd/__init__.py
@@ -194,7 +194,14 @@ class SASLAuthDaemon(object):
             auth = Auth(domain=realm)
             auth.connect()
 
-            if auth.authenticate(login):
+            success = False
+
+            try:
+                success = auth.authenticate(login)
+            except:
+                success = False
+
+            if success:
                 # #1170: Catch broken pipe error (incomplete authentication request)
                 try:
                     clientsocket.send(struct.pack("!H2s", 2, "OK"))


commit 264e5351ef719d78c6b487483748283801db53ce
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jul 31 20:23:21 2013 +0100

    Use a dynamic user filter

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 8b2e841..4c4afc4 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -151,7 +151,15 @@ class LDAP(pykolab.base.Base):
         self.connect()
         self._bind()
 
-        user_filter = self.config_get('user_filter')
+        config_base_dn = self.config_get('base_dn')
+        ldap_base_dn = self._kolab_domain_root_dn(self.domain)
+
+        if not ldap_base_dn == None and not ldap_base_dn == config_base_dn:
+            base_dn = ldap_base_dn
+        else:
+            base_dn = config_base_dn
+
+        user_filter = self.config_get_raw('user_filter') % ({'base_dn':base_dn})
 
         _filter = '(&(|'
 


commit 71f1d48c648f70734a2b4fee90544e9ffafb8e25
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jul 31 20:22:52 2013 +0100

    Make sure to exclude groupofurls from distgroups searches

diff --git a/pykolab/setup/setup_mta.py b/pykolab/setup/setup_mta.py
index 8b33ef2..9004e6b 100644
--- a/pykolab/setup/setup_mta.py
+++ b/pykolab/setup/setup_mta.py
@@ -114,7 +114,7 @@ bind_dn = %(service_bind_dn)s
 bind_pw = %(service_bind_pw)s
 
 # This finds the mail enabled distribution group LDAP entry
-query_filter = (&(mail=%%s)(objectClass=kolabgroupofuniquenames)(objectclass=groupofuniquenames))
+query_filter = (&(|(mail=%%s)(alias=%%s))(objectClass=kolabgroupofuniquenames)(objectclass=groupofuniquenames)(!(objectclass=groupofurls)))
 # From this type of group, get all uniqueMember DNs
 special_result_attribute = uniqueMember
 # Only from those DNs, get the mail
@@ -139,7 +139,7 @@ bind_dn = %(service_bind_dn)s
 bind_pw = %(service_bind_pw)s
 
 # This finds the mail enabled dynamic distribution group LDAP entry
-query_filter = (&(mail=%%s)(objectClass=kolabgroupofuniquenames)(objectClass=groupOfURLs))
+query_filter = (&(|(mail=%%s)(alias=%%s))(objectClass=kolabgroupofuniquenames)(objectClass=groupOfURLs))
 # From this type of group, get all memberURL searches/references
 special_result_attribute = memberURL
 # Only from those DNs, get the mail


commit 42b408fcc6ca18ff9d6fb685a53448de6632de3b
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jul 31 20:22:36 2013 +0100

    Disable squatter for new setups, or messages go missing

diff --git a/share/templates/cyrus.conf.tpl b/share/templates/cyrus.conf.tpl
index 8746bdb..9a4a17a 100644
--- a/share/templates/cyrus.conf.tpl
+++ b/share/templates/cyrus.conf.tpl
@@ -50,5 +50,5 @@ EVENTS {
     tlsprune	cmd="tls_prune" at=0400
 
     # Create search indexes regularly
-    squatter    cmd="squatter -s -i" at=0530
+    #squatter    cmd="squatter -s -i" at=0530
 }


commit 0cf9188421d5c66ec0e2405854e5e06b610218be
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jul 24 11:35:05 2013 +0100

    Make sure a -d option value that is not an integer is just skipped entirely

diff --git a/pykolab/logger.py b/pykolab/logger.py
index e16c6eb..6f82d5d 100644
--- a/pykolab/logger.py
+++ b/pykolab/logger.py
@@ -41,7 +41,11 @@ class Logger(logging.Logger):
     if hasattr(sys, 'argv'):
         for arg in sys.argv:
             if debuglevel == -1:
-                debuglevel = int(arg)
+                try:
+                    debuglevel = int(arg)
+                except ValueError, errmsg:
+                    continue
+
                 loglevel = logging.DEBUG
                 break
 




More information about the commits mailing list