Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.7

Bug #16502 Warnings while parsing answer signed with TSIG
Submitted: 2009-08-09 19:32 UTC
From: dmitrystolyarov Assigned: bate
Status: Closed Package: Net_DNS (version 1.0.1)
PHP Version: 5.2.10 OS: Gentoo Linux
Roadmaps: (Not assigned)    
Subscription  


 [2009-08-09 19:32 UTC] dmitrystolyarov (Dmitry Stolyarov)
Description: ------------ There are two erros in TSIG_RR's constructor's part that deals with binary data parsing: * line 64 (with unpack): in the beginning of format string we can see backslash ("\") that should not be here; * line 82: "other_data" is empty if BADTIME error didn't occur (according to RFC2845). Patch tested against ISC BIND (9.4.2 & 9.4.3) attached. Test script: --------------- $resolver = new Net_DNS_Resolver(array('nameservers' => array('192.168.0.1'))); $packet = new Net_DNS_Packet(); $packet->header = new Net_DNS_Header(); $packet->header->id = $resolver->nextid(); $packet->header->qr = 0; $packet->header->opcode = "UPDATE"; $packet->question[0] = new Net_DNS_Question('example.com', 'SOA', 'IN'); $packet->answer = array(); $packet->authority[0] = Net_DNS_RR::factory('example.com. 0 ANY A'); $packet->authority[1] = Net_DNS_RR::factory('example.com. 1800 IN A 192.168.0.2'); $tsig = Net_DNS_RR::factory('example-key TSIG 6i7jUkH1LXDnMKc7ElBKXQ=='); $packet->additional = array($tsig); $packet->header->qdcount = count($packet->question); $packet->header->ancount = count($packet->answer); $packet->header->nscount = count($packet->authority); $packet->header->arcount = count($packet->additional); $response = $resolver->send_tcp($packet, $packet->data()); echo $response->header->rcode . "\n"; Expected result: ---------------- NOERROR Actual result: -------------- Warning: unpack(): Invalid format type \ in /usr/share/php/Net/DNS/RR/TSIG.php on line 64 Call Stack: 0.0002 118120 1. {main}() /home/mrms-dos/Desktop/test.php:0 0.0122 1530800 2. Net_DNS_Resolver->send_tcp() /home/mrms-dos/Desktop/test.php:28 0.0154 1544520 3. Net_DNS_Packet->parse() /usr/share/php/Net/DNS/Resolver.php:805 0.0155 1547728 4. Net_DNS_Packet->parse_rr() /usr/share/php/Net/DNS/Packet.php:290 0.0157 1550328 5. Net_DNS_RR->factory() /usr/share/php/Net/DNS/Packet.php:568 0.0157 1551336 6. Net_DNS_RR->new_from_data() /usr/share/php/Net/DNS/RR.php:81 0.0157 1555064 7. Net_DNS_RR_TSIG->Net_DNS_RR_TSIG() /usr/share/php/Net/DNS/RR.php:101 0.0158 1555808 8. unpack() /usr/share/php/Net/DNS/RR/TSIG.php:64 Warning: unpack(): Type n: not enough input, need 2, have 0 in /usr/share/php/Net/DNS/RR/TSIG.php on line 82 Call Stack: 0.0002 118120 1. {main}() /home/mrms-dos/Desktop/test.php:0 0.0127 1530800 2. Net_DNS_Resolver->send_tcp() /home/mrms-dos/Desktop/test.php:28 0.0153 1544520 3. Net_DNS_Packet->parse() /usr/share/php/Net/DNS/Resolver.php:805 0.0153 1547728 4. Net_DNS_Packet->parse_rr() /usr/share/php/Net/DNS/Packet.php:290 0.0155 1550328 5. Net_DNS_RR->factory() /usr/share/php/Net/DNS/Packet.php:568 0.0155 1551336 6. Net_DNS_RR->new_from_data() /usr/share/php/Net/DNS/RR.php:81 0.0155 1555064 7. Net_DNS_RR_TSIG->Net_DNS_RR_TSIG() /usr/share/php/Net/DNS/RR.php:101 0.0156 1557088 8. unpack() /usr/share/php/Net/DNS/RR/TSIG.php:82 NOERROR

Comments

 [2009-08-09 19:32 UTC] dmitrystolyarov (Dmitry Stolyarov)
The following patch has been added/updated: Patch Name: tsig-parse-binary.patch Revision: 1249828376 URL: http://pear.php.net/bugs/patch-display.php?bug=16502&patch=tsig-parse-binary.patch&revision=1249828376&display=1
 [2009-08-09 19:35 UTC] dmitrystolyarov (Dmitry Stolyarov)
-PHP Version: 5.2.5 +PHP Version: 5.2.10
 [2010-02-22 03:50 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Analyzed
Unit test coverage added
 [2010-02-22 03:58 UTC] doconnor (Daniel O'Connor)
So, I applied this patch by itself, and the unit test behaviour is unchanged. I assume its because you have fixed other problems with other patches.
 [2010-02-22 04:13 UTC] doconnor (Daniel O'Connor)
Well; that's applied in SVN. No difference on my windows machine - can you try the latest SVN and see if that works for you.
 [2010-03-18 23:12 UTC] dmitrystolyarov (Dmitry Stolyarov)
It works fine (revision 296354)!
 [2010-08-09 20:19 UTC] bate (Marco Kaiser)
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: bate
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.