Use of regexp/domain matching in per_user config?

Asked by Jonas Jonsson

The policyd-spf.peruser.5 man page mentions regexp for user matching.
"
       In addition to specifying individual users, regular expression matching
       is also available, but may have performance implications since the
       entire user table has to be traversed for each message recipient.
"

However, the code does a simple string comparison.
http://bazaar.launchpad.net/~kitterman/pypolicyd-spf/trunk/view/head:/policydspfuser.py#L78

A simple implementation would be have it check the domain as well so that I could specify something like

example.net,Domain_Whitelist=google.com

So that mails sent to any recipient of the domain example.net is allowed to be forwarded via google.com but any other recipients sent from google.com are subject to the regular SPF checks.

A simple additional test on line 78 would probably solve this.
if user != recipient and user != recipient.split("@")[1]:

Question information

Language:
English Edit question
Status:
Solved
For:
pypolicyd-spf Edit question
Assignee:
No assignee Edit question
Solved by:
Jonas Jonsson
Solved:
Last query:
Last reply:
Revision history for this message
Scott Kitterman (kitterman) said :
#1

Thanks. I generally write the documentation first to get an idea where I'm headed. I guess in this case I didn't get there. I think this is better as a bug report, so I'm going to make a bug from this.

Revision history for this message
Jonas Jonsson (jonas-websystem) said :
#2

This went from a question to a bug report/feature request as I wrote it :)

I agree, this is better as bug report. Let's close this question and only keep the bug report.