Hi,
I raised the following bug in the Ubuntu bug tracker:
https://bugs.launchpad.net/ubuntu/+source/pypolicyd-spf/+bug/455991
The problem is code like:
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.
Cheers,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
-------------------------------------------
Sender Policy Framework: http://www.openspf.org [http://www.openspf.org]
Modify Your Subscription: http://www.listbox.com/member/ [http://www.listbox.com/member/]
Archives: https://www.listbox.com/member/archive/1007/=now
RSS Feed: https://www.listbox.com/member/archive/rss/1007/
Powered by Listbox: http://www.listbox.com
I raised the following bug in the Ubuntu bug tracker:
https://bugs.launchpad.net/ubuntu/+source/pypolicyd-spf/+bug/455991
The problem is code like:
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.
Cheers,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
-------------------------------------------
Sender Policy Framework: http://www.openspf.org [http://www.openspf.org]
Modify Your Subscription: http://www.listbox.com/member/ [http://www.listbox.com/member/]
Archives: https://www.listbox.com/member/archive/1007/=now
RSS Feed: https://www.listbox.com/member/archive/rss/1007/
Powered by Listbox: http://www.listbox.com