On Sat, 01 Nov 2008 10:56:18 +0100 Felix Knecht <[EMAIL PROTECTED]> 
wrote:
>Thanks for identifying the problem! I agree that it is not exactly a 
>bug, but I guess python-spf shouldn't crash on this and get the incoming 
>mail rejected.
>
>Anyway, heres the info you requested:
>
>
>Scott Kitterman wrote:
>> What output do you get from:
>> 
>> python /usr/share/python-support/python-spf/spf.py amazon.com
>
>Traceback (most recent call last):
>   File "/usr/share/python-support/python-spf/spf.py", line 1621, in ?
>     print q.dns_spf(sys.argv[1])
>   File "/usr/share/python-support/python-spf/spf.py", line 1010, in 
dns_spf
>     a = [t for t in self.dns_txt(domain) if RE_SPF.match(t)]
>   File "/usr/share/python-support/python-spf/spf.py", line 1045, in 
dns_txt
>     return [''.join(a) for a in self.dns(domainname, 'TXT')]
>   File "/usr/share/python-support/python-spf/spf.py", line 1150, in dns
>     for k, v in DNSLookup(name, qtype, self.strict):
>   File "/usr/share/python-support/python-spf/spf.py", line 95, in 
DNSLookup
>     resp = req.req()
>   File "/var/lib/python-support/python2.4/DNS/Base.py", line 193, in req
>     self.sendUDPRequest(server)
>   File "/var/lib/python-support/python2.4/DNS/Base.py", line 213, in
>sendUDPRequest
>     r=self.processUDPReply()
>   File "/var/lib/python-support/python2.4/DNS/Base.py", line 99, in
>processUDPReply
>     return self.processReply()
>   File "/var/lib/python-support/python2.4/DNS/Base.py", line 119, in
>processReply
>     r=Lib.DnsResult(u,self.args)
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 522, in 
>__init__
>     self.storeM(u)
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 578, in storeM
>     self.answers.append(self.storeRR(u))
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 595, in 
storeRR
>     r['name'],r['type'],r['class'],r['ttl'],r['rdlength'] = 
u.getRRheader()
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 376, in
>getRRheader
>     name = self.getname()
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 189, in 
getname
>     c = self.getbyte()
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 171, in 
getbyte
>     c = self.buf[self.offset]
>IndexError: string index out of range
>
>
>> python /usr/share/python-support/python-spf/spf.py aol.com
>
>Traceback (most recent call last):
>   File "/usr/share/python-support/python-spf/spf.py", line 1621, in ?
>     print q.dns_spf(sys.argv[1])
>   File "/usr/share/python-support/python-spf/spf.py", line 1010, in 
dns_spf
>     a = [t for t in self.dns_txt(domain) if RE_SPF.match(t)]
>   File "/usr/share/python-support/python-spf/spf.py", line 1045, in 
dns_txt
>     return [''.join(a) for a in self.dns(domainname, 'TXT')]
>   File "/usr/share/python-support/python-spf/spf.py", line 1150, in dns
>     for k, v in DNSLookup(name, qtype, self.strict):
>   File "/usr/share/python-support/python-spf/spf.py", line 95, in 
DNSLookup
>     resp = req.req()
>   File "/var/lib/python-support/python2.4/DNS/Base.py", line 193, in req
>     self.sendUDPRequest(server)
>   File "/var/lib/python-support/python2.4/DNS/Base.py", line 213, in
>sendUDPRequest
>     r=self.processUDPReply()
>   File "/var/lib/python-support/python2.4/DNS/Base.py", line 99, in
>processUDPReply
>     return self.processReply()
>   File "/var/lib/python-support/python2.4/DNS/Base.py", line 119, in
>processReply
>     r=Lib.DnsResult(u,self.args)
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 522, in 
>__init__
>     self.storeM(u)
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 578, in storeM
>     self.answers.append(self.storeRR(u))
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 595, in 
storeRR
>     r['name'],r['type'],r['class'],r['ttl'],r['rdlength'] = 
u.getRRheader()
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 376, in
>getRRheader
>     name = self.getname()
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 189, in 
getname
>     c = self.getbyte()
>   File "/var/lib/python-support/python2.4/DNS/Lib.py", line 171, in 
getbyte
>     c = self.buf[self.offset]
>IndexError: string index out of range
>
>
>
>> python /usr/share/python-support/python-spf/spf.py usbank.com
>v=spf1 mx a:mail5.usbank.com a:mail10.usbank.com a:mail14.usbank.com 
>a:mail9.usbank.com a:mail13.usbank.com -all
>
Actually it turns out the problem is more complex.  I was wrong about TCP 
fallback not being supported (I went back and tested after my last reply).  
Something in your network is corrupting TCP DNS replies.

First, I agree a crash is always a bug.

Second when I run those tests in Etch (with the backports.org python-spf) I 
don't get the crash.  If I do it where DNS TCP is blocked, I get a response 
of None.  If I do it where it's not blocked, I get a correct answer.

The first two tests I asked you to run use TCP.  The third one fits in UDP.

I think what would be most useful now would be if you could capture port FT 
both UDP and TCP with Wireshark, tcpdump, etc. when doing the above tests.  
I need to see what's in the packet that's causing the crash.

Scott K



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to