Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 18958
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: djhale [...] lok.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.57
Fixed in: (no value)



Subject: SIGZERO type fails in typesbyname function
when the function typebyname is called with the paramater of 'SIGZERO' it fails. The problem: the typebyname hash looks like this: %typesbyname = ( 'SIGZERO' => 0, # RFC2931 consider this a pseudo type 'A' => 1, # RFC 1035, Section 3.4.1 ... } Here is the function: Notice, if the $name is 'SIGZERO', $typesbyname{$name} evaluates to 0 which if put into an if statement will return false. The first return in this case will fail, and because SIGZERO is not of the form TYPE###, the confess statement will be called causing the server to die. You can fix this problem by replacing the return line with the one I have commented in the code below. sub typesbyname { my $name = uc shift; return $typesbyname{$name} if $typesbyname{$name}; # should be #return $typesbyname{$name} if defined $typesbyname{$name}; confess "Net::DNS::typesbyname() argument ($name) is not TYPE###" unless $name =~ m/^\s*TYPE(\d+)\s*$/o; ... } The exception is below: Uncaught exception from user code: Net::DNS::typesbyname() argument (SIGZERO) is not TYPE### at /usr/local/libdata/perl5/site_perl/amd64-openb sd/Net/DNS.pm line 171 Net::DNS::typesbyname('SIGZERO') called at /usr/local/libdata/perl5/site_perl/amd64-openbsd/Net/DNS/Questio n.pm line 181 Net::DNS::Question::data('Net::DNS::Question=HASH(0x45fd2770)', 'Net::DNS::Packet=HASH(0x463c60d0)', 12) ca lled at /usr/local/libdata/perl5/site_perl/amd64-openbsd/Net/DNS/Packet.pm line 288 Net::DNS::Packet::data('Net::DNS::Packet=HASH(0x463c60d0)') called at /usr/local/libdata/perl5/site_perl/am d64-openbsd/Net/DNS/Resolver/Base.pm line 525 Net::DNS::Resolver::Base::send('Net::DNS::Resolver=HASH(0x4bb048f0)', 'EAGLELAKEDRUGS', 'SIGZERO', 'CLASS25 6') called at /var/www/bin/proxydnsserver.pl line 61 main::reply_handler('EAGLELAKEDRUGS', 'CLASS256', 'SIGZERO', 172.16.0.113, 'Net::DNS::Packet=HASH(0x4b52db2 0)') called at /usr/local/libdata/perl5/site_perl/amd64-openbsd/Net/DNS/Nameserver.pm line 216 Net::DNS::Nameserver::make_reply('Net::DNS::Nameserver=HASH(0x4fae9630)', 'Net::DNS::Packet=HASH(0x4b52db20 )', 172.16.0.113) called at /usr/local/libdata/perl5/site_perl/amd64-openbsd/Net/DNS/Nameserver.pm line 370 Net::DNS::Nameserver::udp_connection('Net::DNS::Nameserver=HASH(0x4fae9630)', 'IO::Socket::INET=GLOB(0x4735 38a0)') called at /usr/local/libdata/perl5/site_perl/amd64-openbsd/Net/DNS/Nameserver.pm line 420 Net::DNS::Nameserver::loop_once('Net::DNS::Nameserver=HASH(0x4fae9630)', 10) called at /usr/local/libdata/p erl5/site_perl/amd64-openbsd/Net/DNS/Nameserver.pm line 493 Net::DNS::Nameserver::main_loop('Net::DNS::Nameserver=HASH(0x4fae9630)') called at /var/www/bin/proxydnsser ver.pl line 101
Show quoted text
> sub typesbyname { > my $name = uc shift; > > return $typesbyname{$name} if $typesbyname{$name}; > # should be > #return $typesbyname{$name} if defined $typesbyname{$name}; >
Thanks for the extensive bug report, with fix. The fix lives on the trunk. --Olaf