From: SourceForge.net <no...@so...> - 2007-11-19 02:45:57
|
Patches item #863364, was opened at 2003-12-19 23:16 Message generated for change (Comment added) made by kitterma You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=403047&aid=863364&group_id=31674 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Bug fixes Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Mac OS X, Win2000 DHCP, addr2bin and bin2addr. Initial Comment: Hi! I wrote an application using PyDNS - SPF queries (Sender-Permitted-From) neat anti-spam technology. This uses PyDNS pretty thoroughly, and I discovered some issues, which I've fixed. 1. On Windows 2000 using DHCP, or using multiple name servers; 2. DNS.bin2addr() and DNS.addr2bin() don't parse IP addresses to spec. 3. On Mac OS X, which decides for some reason to leave 'domain' blank in /etc/resolv.conf, causing DNS.DiscoverNameServers() to fail. So I fixed them all, with minimal code changes. Patches are attached. To fix Windows 2000 DHCP, I added a registry query for 'DhcpNameServer' I also put in a split() so multiple space- separated names on the list get stuck into defaults['server'] correctly... as a list. To fix DNS.bin2addr() and DNS.addr2bin(), I use socket.inet_ntoa() and socket.inet_aton(). The old stuff couldn't parse perfectly legitimate IP addresses like: 0x7e.0.0.1, 127.1 The old stuff also didn't barf on incorrect addresses like: 127.0.0.256 The upside is that the new code is about twice as fast. 100000 iterations of the new code takes 14.4 seconds on my G3 powerbook, 100000 iterations of the old code takes 28.0 seconds. The downside is that now DNS.addr2bin('255.255.255.255') barfs, cuz the C code for inet_aton cannot differentiate between error (return -1) and the broadcast addr. To fix the rude Mac OS X problem, just test to see if len(fields) > 1. I also updated the test code so the headers read #!/usr/bin/ env python The code has been tested on both byte-orderings (Mac PowerPC and Intel) and Windows 2000 DHCP (1 and 2 servers) and non DHCP, The patch is attached, you'll probably also get an email about a patch submission via SourceForge. Cheers! te...@wa... ---------------------------------------------------------------------- Comment By: Scott Kitterman (kitterma) Date: 2007-11-18 21:46 Message: Logged In: YES user_id=1300068 Originator: NO Fixed in 2.3.1 ---------------------------------------------------------------------- Comment By: Scott Kitterman (kitterma) Date: 2007-02-16 08:50 Message: Logged In: YES user_id=1300068 Originator: NO A fix for this issue has been included in the latest python-dns update in Ubuntu Linux. See https://launchpad.net/ubuntu/+source/python-dns/2.3.0-5.1ubuntu2 for details. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=403047&aid=863364&group_id=31674 |