[Pymilter] pyspf SPF checking raises TypeError exception when checking erroneous record

Kazuhiro Ogura kazuhiro.ogura at hde.co.jp
Sun Mar 17 22:47:43 EDT 2013


2013/3/15 Stuart D Gathman <stuart at bmsi.com>:

>> I created a test case for this, and unless I'm missing something,
>> pyspf-2.0.7 doesn't have this problem: it simply doesn't match.
>> What version are you running?
>
>
> Also, it could be a dnspython or pydns problem/incompatibility.  Are
> you running pydns or dnspython?

Thank you for your investigation.

I'm using pydns 2.3.6 and pyspf 2.0.7, but I found that it doesn't
simply occur by the case I provided. Sorry.

Can you try it with a zonedata like this?

zonedata:
  e3.example.com:
  - SPF: v=spf1 a:mx1.example.com mx:mx1.example.com -all
  mx1.example.com:
  - CNAME: .

Below is a actual case I'm facing, domain name replaced to "example.com".

Python 2.6.5 (r265:79063, Feb 28 2011, 21:55:45)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import DNS
>>> DNS.__version__
'2.3.6'
>>> import spf
>>> spf.__version__
'2.0.7: Jan 19, 2012'
>>> q = spf.query(s="exchange.example.com", h="exchange.example.com", i="1.2.3.4")
>>> q.check(spf="v=spf1 mx a:exchange.example.com a:relay.example.com a:host05.example.com a:smtp1.example.com mx:exchange.example.com mx:relay.example.com mx:host05.example.com mx:smtp1.example.com mx:sqrelay02.example.com ~all")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/spf.py", line 543, in check
    rc = self.check1(spf, self.d, 0)
  File "/usr/lib/python2.6/site-packages/spf.py", line 582, in check1
    return self.check0(spf, recursion)
  File "/usr/lib/python2.6/site-packages/spf.py", line 871, in check0
    if self.cidrmatch(self.dns_a(arg,self.A), cidrlength):
  File "/usr/lib/python2.6/site-packages/spf.py", line 1295, in cidrmatch
    for ip in [bin(ip) for ip in ipaddrs]:
TypeError: 'NoneType' object is not iterable

I thought I should give you the actual domain name, but I can't decide
whether it is ok to post it to the list, so I'll send you the
information personally in another mail.

-- 
Kazuhiro Ogura <kazuhiro.ogura at hde.co.jp>
Representative Director, Chief Executive Officer
HDE, Inc.
http://www.hde.co.jp/
GPG Key Id: 0xFA80C875
We support Karesansui Project: http://karesansui-project.info



More information about the Pymilter mailing list