4 commits - bin/kolab_smtp_access_policy.py pykolab/setup

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Tue Jun 5 12:44:19 CEST 2012


 bin/kolab_smtp_access_policy.py |   49 ++++++++++++++++++++++++++++------------
 pykolab/setup/setup_mysql.py    |    2 -
 2 files changed, 36 insertions(+), 15 deletions(-)

New commits:
commit 6e6f603f9351e64920ab5b4b71340347d3528f2f
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Jun 5 12:42:14 2012 +0200

    sys.exit(0) on timeout waiting for DATA request state, or logs will show the policy in error (#817)

diff --git a/bin/kolab_smtp_access_policy.py b/bin/kolab_smtp_access_policy.py
index 7e226d4..f2f7116 100755
--- a/bin/kolab_smtp_access_policy.py
+++ b/bin/kolab_smtp_access_policy.py
@@ -1253,7 +1253,7 @@ def read_request_input():
     while not end_of_request:
         if (time.time()-start_time) >= conf.timeout:
             log.warning(_("Timeout for policy request reading exceeded"))
-            sys.exit(1)
+            sys.exit(0)
 
         request_line = sys.stdin.readline()
         if request_line.strip() == '':


commit 721ed5bb6a54b0aa817fcab9cae78a13e2d9f3f4
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Jun 5 12:40:27 2012 +0200

    Quote the password entered to the temporary defaults file (#825)

diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index ac63add..093d187 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -80,7 +80,7 @@ def execute(*args, **kw):
     data = """
 [mysql]
 user=root
-password=%s
+password='%s'
 """ % (mysql_root_password)
 
     fp = open('/tmp/kolab-setup-my.cnf', 'w')


commit dc65e08a6acfdf239b8089153e2025d1c80a50ad
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Tue Jun 5 12:28:22 2012 +0200

    Use find_recipient() instead of find_user() to verify delegation. (#826)

diff --git a/bin/kolab_smtp_access_policy.py b/bin/kolab_smtp_access_policy.py
index 14aea56..7e226d4 100755
--- a/bin/kolab_smtp_access_policy.py
+++ b/bin/kolab_smtp_access_policy.py
@@ -516,13 +516,23 @@ class PolicyRequest(object):
         if self.sender == self.sasl_username:
             return
 
-        self.sender_user = {
-                'dn': auth.find_user(
-                        search_attrs,
-                        self.sender,
-                        domain=self.sender_domain
-                    )
-            }
+        sender_users = auth.find_recipient(
+                self.sender,
+                domain=self.sender_domain
+            )
+
+        if isinstance(sender_users, list):
+            if len(sender_users) > 1:
+                # More then one sender user with this recipient address.
+                # TODO: check each of the sender users found.
+                self.sender_user = { 'dn': sender_users[0] }
+            elif len(sender_users) == 1:
+                self.sender_user = { 'dn': sender_users }
+            else:
+                self.sender_user = { 'dn': False }
+
+        elif isinstance(sender_users, basestring):
+            self.sender_user = { 'dn': sender_users }
 
         if not self.sender_user['dn']:
             cache_update(


commit f66e8f9a9d1a5f1a620f450c4c1f1c109d5747d7
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Sun Jun 3 18:36:54 2012 +0200

    Multiple recipient entries to be found associated with the recipient email address to result in the SMTP Access Policy not being applied. (#816)

diff --git a/bin/kolab_smtp_access_policy.py b/bin/kolab_smtp_access_policy.py
index ed1ce21..14aea56 100755
--- a/bin/kolab_smtp_access_policy.py
+++ b/bin/kolab_smtp_access_policy.py
@@ -731,12 +731,23 @@ class PolicyRequest(object):
 
             return True
 
-        recipient = {
-                'dn': auth.find_recipient(
-                        normalize_address(recipient),
-                        domain=sasl_domain,
-                    )
-            }
+        recipients = auth.find_recipient(
+                normalize_address(recipient),
+                domain=sasl_domain,
+            )
+
+        if isinstance(recipients, list) and len(recipients) > 1:
+            log.info(
+                    _("This recipient address is related to multiple " + \
+                        "object entries and the SMTP Access Policy can " + \
+                        "therefore not restrict message flow")
+                )
+
+            return True
+        elif isinstance(recipients, basestring):
+            recipient = {
+                    'dn': recipients
+                }
 
         # We have gotten an invalid recipient. We need to catch this case,
         # because testing can input invalid recipients, and so can faulty





More information about the commits mailing list