summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-05 12:28:22 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-05 12:28:22 +0200
commitc23db1e5bb446c2737098dde7821a846839b6f25 (patch)
treed150593b3792f621d948ed9693f056a4919b3c4c
parent17d2a7a45e536c449bed16a05ffe47de378eb01d (diff)
downloadpykolab-c23db1e5bb446c2737098dde7821a846839b6f25.tar.gz
Use find_recipient() instead of find_user() to verify delegation. (#826)
-rwxr-xr-xbin/kolab_smtp_access_policy.py24
1 files changed, 17 insertions, 7 deletions
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(