comparison roundup/mailgw.py @ 4531:ddff9669361b

Fix matching of incoming email addresses to the alternate_addresses field... ...of a user -- this would match substrings, e.g. if the user has discuss-support@example.com as an alternate email and an incoming mail is addressed to support@example.com this would (wrongly) match. Note: I *think* I've seen this discussed somewhere but couldn't find it, neither in the tracker nor in recent discussions on the mailinglists. So if someone remembers an issue which now should be closed, please tell me :-)
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Wed, 24 Aug 2011 14:43:52 +0000
parents a00e0e73bb26
children c246f176e7bb
comparison
equal deleted inserted replaced
4530:c1c395058dee 4531:ddff9669361b
1664 1664
1665 # try the user alternate addresses if possible 1665 # try the user alternate addresses if possible
1666 props = db.user.getprops() 1666 props = db.user.getprops()
1667 if props.has_key('alternate_addresses'): 1667 if props.has_key('alternate_addresses'):
1668 users = db.user.filter(None, {'alternate_addresses': address}) 1668 users = db.user.filter(None, {'alternate_addresses': address})
1669 user = extractUserFromList(db.user, users) 1669 # We want an exact match of the email, not just a substring
1670 # match. Otherwise e.g. support@example.com would match
1671 # discuss-support@example.com which is not what we want.
1672 found_users = []
1673 for u in users:
1674 alt = db.user.get(u, 'alternate_addresses').split('\n')
1675 for a in alt:
1676 if a.strip().lower() == address.lower():
1677 found_users.append(u)
1678 break
1679 user = extractUserFromList(db.user, found_users)
1670 if user is not None: 1680 if user is not None:
1671 return user 1681 return user
1672 1682
1673 # try to match the username to the address (for local 1683 # try to match the username to the address (for local
1674 # submissions where the address is empty) 1684 # submissions where the address is empty)

Roundup Issue Tracker: http://roundup-tracker.org/