Have a 64bit Gentoo Hardened box, python 3.2 installed on it. I tried to get rid of python 2.7 but I just can't seem to make it work.
Used versions (system is pure 64bit):
Python 3.2.3
pypolicyd-spf 1.1.2
pyspf CVS 1.108.2.85 ( http://pymilter.cvs.sourceforge.net/viewvc/pymilter/pyspf/spf.py?revision=1.108.2.85&content-type=text%2Fplain )
pydns 3.0.1
I would like to know which pyspf version used for pypolicd-spf 1.1.2 testing on python 3.2, as the latest pyspf stable 2.0.7 is not python3 compatible (that's why i'm using a CVS version).
I think some of these bugs come from regression, but it would be cool, if we could nail them for python3. I'm happy to help, but I'm not a pyhton programmer, I don't have much experience.
The bugs I encountered are these:
1)
May 21 05:03:09 devon policyd-spf-python3.2[9238]: Traceback (most recent call last):
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/DNS/Base.py", line 181, in getSource
May 21 05:03:09 devon policyd-spf-python3.2[9238]: self.s.bind(('', source_port))
May 21 05:03:09 devon policyd-spf-python3.2[9238]: socket.error: [Errno 98] Address already in use
May 21 05:03:09 devon policyd-spf-python3.2[9238]:
May 21 05:03:09 devon policyd-spf-python3.2[9238]: During handling of the above exception, another exception occurred:
May 21 05:03:09 devon policyd-spf-python3.2[9238]: Traceback (most recent call last):
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/bin/policyd-spf-python3.2", line 684, in <module>
May 21 05:03:09 devon policyd-spf-python3.2[9238]: instance_dict, configData, peruser)
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/bin/policyd-spf-python3.2", line 530, in _spfcheck
May 21 05:03:09 devon policyd-spf-python3.2[9238]: res = spf.check2(ip, sender, helo)
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/spf.py", line 310, in check2
May 21 05:03:09 devon policyd-spf-python3.2[9238]: receiver=receiver,timeout=timeout,verbose=verbose,querytime=querytime).check()
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/spf.py", line 538, in check
May 21 05:03:09 devon policyd-spf-python3.2[9238]: spf = self.dns_spf(self.d)
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/spf.py", line 1094, in dns_spf
May 21 05:03:09 devon policyd-spf-python3.2[9238]: a = [t for t in self.dns_txt(domain) if RE_SPF.match(t)]
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/spf.py", line 1131, in dns_txt
May 21 05:03:09 devon policyd-spf-python3.2[9238]: for a in self.dns(domainname, 'TXT')]
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/spf.py", line 1255, in dns
May 21 05:03:09 devon policyd-spf-python3.2[9238]: for k, v in DNSLookup(name, qtype, self.strict, timeout):
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/spf.py", line 140, in DNSLookup
May 21 05:03:09 devon policyd-spf-python3.2[9238]: resp = req.req()
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/DNS/Base.py", line 227, in req
May 21 05:03:09 devon policyd-spf-python3.2[9238]: self.sendUDPRequest(server)
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/DNS/Base.py", line 253, in sendUDPRequest
May 21 05:03:09 devon policyd-spf-python3.2[9238]: self.conn()
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/DNS/Base.py", line 188, in conn
May 21 05:03:09 devon policyd-spf-python3.2[9238]: self.getSource()
May 21 05:03:09 devon policyd-spf-python3.2[9238]: File "/usr/lib64/python3.2/site-packages/DNS/Base.py", line 185, in getSource
May 21 05:03:09 devon policyd-spf-python3.2[9238]: if msg[0] != 98: raise
May 21 05:03:09 devon policyd-spf-python3.2[9238]: TypeError: 'error' object does not support indexing
2)
May 25 11:08:38 devon policyd-spf-python3.2[21264]: Traceback (most recent call last):
May 25 11:08:38 devon policyd-spf-python3.2[21264]: File "/usr/bin/policyd-spf-python3.2", line 684, in <module>
May 25 11:08:38 devon policyd-spf-python3.2[21264]: instance_dict, configData, peruser)
May 25 11:08:38 devon policyd-spf-python3.2[21264]: File "/usr/bin/policyd-spf-python3.2", line 420, in _spfcheck
May 25 11:08:38 devon policyd-spf-python3.2[21264]: foo = string.split(sender, '@', 1)
May 25 11:08:38 devon policyd-spf-python3.2[21264]: AttributeError: 'module' object has no attribute 'split'
It's 2.0.7 with some patches (roughly equivalent to what's in CVS). Perhaps more importantly it's py3dns 3.0.2 and it did have an incompatible change from 3.0.1.
There is a known issue (as of yesterday) with IPv6 processing in pyspf on python 3 that I'm still trying to figure out.