summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-11-23 07:48:22 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-11-23 07:48:22 +0100
commita430b182291a687f361507db5ec0bbaf56d1966e (patch)
treeecc50fbfb0a5a8352a01812da8856b0eeef6c4b7
parentc60d32d283e6005ea6eaf32a0589bc1ae582e734 (diff)
downloadpykolab-a430b182291a687f361507db5ec0bbaf56d1966e.tar.gz
Lowercase rules and sender/recipient addresses when parsing the policy, or the policy values may not match the input values.
It is safe to lowercase both as exploiting case-sensitivity in mail address local parts or domain name spaces is not allowed. Demo Python code: >>> address = "Jeroen.vanMeeuwen@kolab.org" >>> address.startswith('jeroen') False Solves #496.
-rwxr-xr-xbin/kolab_smtp_access_policy.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bin/kolab_smtp_access_policy.py b/bin/kolab_smtp_access_policy.py
index a1e6639..f0773d3 100755
--- a/bin/kolab_smtp_access_policy.py
+++ b/bin/kolab_smtp_access_policy.py
@@ -304,7 +304,11 @@ def parse_policy(sender, recipient, policy):
rules = { 'allow': [], 'deny': [] }
+ sender = sender.lower()
+ recipient = recipient.lower()
+
for rule in policy:
+ rule = rule.lower()
if rule.startswith("-"):
rules['deny'].append(rule[1:])
else: