Branch 'pykolab-0.4' - bin/kolab_smtp_access_policy.py

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Wed Jun 6 17:11:18 CEST 2012


 bin/kolab_smtp_access_policy.py |   27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

New commits:
commit ad123156c3e279783a9c132e1382bfa53def12a4
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed Jun 6 17:10:29 2012 +0200

    Accept recipients that are not LDAP entries (#829)

diff --git a/bin/kolab_smtp_access_policy.py b/bin/kolab_smtp_access_policy.py
index d7019fe..d97690a 100755
--- a/bin/kolab_smtp_access_policy.py
+++ b/bin/kolab_smtp_access_policy.py
@@ -784,14 +784,27 @@ class PolicyRequest(object):
                 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")
-                )
+        if isinstance(recipients, list):
+            if 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 len(recipients) == 1:
+                recipient = { 'dn': recipients[0] }
+            else:
+                log.debug(
+                        _("Recipient address %r not found. Allowing since " + \
+                            "the MTA was configured to accept the recipient.") % (
+                                normalize_address(recipient)
+                            ),
+                        level=3
+                    )
+
+                return True
 
-            return True
         elif isinstance(recipients, basestring):
             recipient = {
                     'dn': recipients





More information about the commits mailing list