[Bug 455991] Re: policyd-spf crashing with IndexError
Erik de Castro Lopo
erikd+ubuntu at mega-nerd.com
Tue Oct 20 21:40:22 UTC 2009
The problem is This code:
sender_domain = string.split(sender, '@', 1)
if spf.domainmatch(reject_domain_list, sender_domain[1]):
If sender has no '@' character, sender_domain ends up as a single
element list and trying to index it by [1] results in an IndexError
exception.
A robust solution to this (available for python >= 2.5) is:
sender_domain = sender.partition ('@')[2]
if spf.domainmatch(reject_domain_list, sender_domain):
The parition method applied to the sender string is guaranteed to return
a 3 element tuple of which the [2] indexing grabs the last element.
I've hacked the policy-spf script on my incoming mail gateway as above
and its been running for 20 plus hours without a hitch.
--
policyd-spf crashing with IndexError
https://bugs.launchpad.net/bugs/455991
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
More information about the universe-bugs
mailing list