5 commits - bin/kolab_smtp_access_policy.py pykolab/auth pykolab/cli pykolab/utils.py saslauthd/__init__.py

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Sat Nov 3 17:20:39 CET 2012


 bin/kolab_smtp_access_policy.py |   10 ++---
 pykolab/auth/ldap/__init__.py   |    2 -
 pykolab/cli/cmd_acl_cleanup.py  |   68 ++++++++++++++++++++++++++++++++++++++++
 pykolab/utils.py                |    1 
 saslauthd/__init__.py           |   12 +++++--
 5 files changed, 84 insertions(+), 9 deletions(-)

New commits:
commit 78be79252f67aff61cabc4abee054217efae7cad
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sat Nov 3 16:18:40 2012 +0000

    Initialize auth before any work begins

diff --git a/bin/kolab_smtp_access_policy.py b/bin/kolab_smtp_access_policy.py
index e19d156..52ce566 100755
--- a/bin/kolab_smtp_access_policy.py
+++ b/bin/kolab_smtp_access_policy.py
@@ -743,6 +743,11 @@ class PolicyRequest(object):
         else:
             sasl_domain = conf.get('kolab', 'primary_domain')
 
+        if self.auth == None:
+            self.auth = Auth(sasl_domain)
+        elif not self.auth.domain == sasl_domain:
+            self.auth = Auth(sasl_domain)
+
         if verify_domain(sasl_domain):
             if self.auth.secondary_domains.has_key(sasl_domain):
                 log.debug(
@@ -771,11 +776,6 @@ class PolicyRequest(object):
 
             return True
 
-        if self.auth == None:
-            self.auth = Auth(sasl_domain)
-        elif not self.auth.domain == sasl_domain:
-            self.auth = Auth(sasl_domain)
-
         recipients = self.auth.find_recipient(
                 normalize_address(recipient),
                 domain=sasl_domain,


commit 72da10f4ccb5de84accf71dd5e22eaedde586947
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sat Nov 3 16:18:12 2012 +0000

    Catch Broken Pipe error (#1170)

diff --git a/saslauthd/__init__.py b/saslauthd/__init__.py
index 84024e3..edbca94 100644
--- a/saslauthd/__init__.py
+++ b/saslauthd/__init__.py
@@ -195,9 +195,17 @@ class SASLAuthDaemon(object):
             auth.connect()
 
             if auth.authenticate(login):
-                clientsocket.send(struct.pack("!H2s", 2, "OK"))
+                # #1170: Catch broken pipe error (incomplete authentication request)
+                try:
+                    clientsocket.send(struct.pack("!H2s", 2, "OK"))
+                except:
+                    pass
             else:
-                clientsocket.send(struct.pack("!H2s", 2, "NO"))
+                # #1170: Catch broken pipe error (incomplete authentication request)
+                try:
+                    clientsocket.send(struct.pack("!H2s", 2, "NO"))
+                except:
+                    pass
 
             clientsocket.close()
 


commit 171fbba960ab71675cade960beefd1a6a805b3a7
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu Nov 1 19:21:12 2012 +0000

    Add a command to clean up ACLs

diff --git a/pykolab/cli/cmd_acl_cleanup.py b/pykolab/cli/cmd_acl_cleanup.py
new file mode 100644
index 0000000..80d5396
--- /dev/null
+++ b/pykolab/cli/cmd_acl_cleanup.py
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+# Copyright 2010-2012 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.imap import IMAP
+from pykolab.translate import _
+
+log = pykolab.getLogger('pykolab.cli')
+conf = pykolab.getConf()
+
+def __init__():
+    commands.register('acl_cleanup', execute, description=description())
+
+def description():
+    return _("Clean up ACLs that use identifiers that no longer exist")
+
+def execute(*args, **kw):
+    """
+        List mailboxes
+    """
+
+    try:
+        aci_subject = conf.cli_args.pop(0)
+    except:
+        aci_subject = None
+
+    imap = IMAP()
+    imap.connect()
+
+    folders = imap.lm()
+
+    for folder in folders:
+        acls = imap.list_acls(folder)
+
+        if not aci_subject == None:
+            if aci_subject in acls.keys():
+                log.debug(_("Deleting ACL %s for subject %s on folder %s") % (
+                        acls[aci_subject],
+                        aci_subject,
+                        folder
+                    ), level=8)
+
+                imap.set_acl(folder, aci_subject, '')
+
+        #else:
+            #for _aci_subject in acls.keys():
+                # connect to auth(!)
+                # find recipient result_attr=aci_subject
+                # if no entry, expire acl
\ No newline at end of file


commit 66db6abe42a2514c829b9a8e0b5c65610a784571
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu Nov 1 13:59:48 2012 +0000

    Include the modlist in the error message not being able to modify an entry

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 57026aa..d9c6709 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -830,7 +830,7 @@ class LDAP(pykolab.base.Base):
             try:
                 self.ldap.modify_s(dn, modlist)
             except:
-                log.error(_("Could not update dn %r") % (dn))
+                log.error(_("Could not update dn %r:\n%r") % (dn, modlist))
 
     def synchronize(self):
         """


commit 75fa7110488a0c674200177a7a30025bbea42b81
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Thu Nov 1 13:59:12 2012 +0000

    Remove log.error() call as no log is available in pykolab.utils

diff --git a/pykolab/utils.py b/pykolab/utils.py
index c74759b..d4b1a09 100644
--- a/pykolab/utils.py
+++ b/pykolab/utils.py
@@ -353,7 +353,6 @@ def translate(mystring, locale_name='en_US'):
     try:
         locale.setlocale(locale.LC_ALL, (locale_name,locale_charset))
     except:
-        log.error(_("Could not set locale to %r,%r") % (local_name,locale_charset))
         pass
 
     command = [ '/usr/bin/iconv',





More information about the commits mailing list