Subject: | dn_comp crash during verify |
perl v5.8.5 on Mandrake 10
Net-DNS-SEC-0.12_02
Net-DNS-0.53
bind 9.3.1
Using verify on some types of RR records fails with a die.
works ok with eg. NS and MX records, but fails with eg. NAPTR and AAAA records:
Can't call method "dn_comp" on an undefined value at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Net/DNS/RR/NAPTR.pm line 103.
at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Net/DNS/RR/NAPTR.pm line 103
Net::DNS::RR::NAPTR::rr_rdata('Net::DNS::RR::NAPTR=HASH(0x8aa4a44)') called at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Net/DNS/RR.pm line 693
Net::DNS::RR::_canonicalRdata('Net::DNS::RR::NAPTR=HASH(0x8aa4a44)') called at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Net/DNS/RR.pm line 675
Net::DNS::RR::_canonicaldata('Net::DNS::RR::NAPTR=HASH(0x8aa4a44)') called at /usr/lib/perl5/site_perl/5.8.5/Net/DNS/RR/RRSIG.pm line 844
Net::DNS::RR::RRSIG::_CreateSigData('Net::DNS::RR::RRSIG=HASH(0x8aafc5c)', 'ARRAY(0x89a0970)') called at /usr/lib/perl5/site_perl/5.8.5/Net/DNS/RR/RRSIG.pm line 512
Net::DNS::RR::RRSIG::verify('Net::DNS::RR::RRSIG=HASH(0x8aafc5c)', 'ARRAY(0x89a0970)', 'Net::DNS::RR::DNSKEY=HASH(0x8aa61ac)') called at /tmp/dns2.pl line 40
problem seems to be that eg Net::DNS::RR::NAPTR::rr_rdata() requires that $packet and $offset be defined, but they are not being passed by someone higher in the calling stack.
See attached example dns2.pl
use Net::DNS;
use IO::Select;
use strict;
# see RFC 2915 for format of NAPTR records
my $res = Net::DNS::Resolver->new(nameservers => [qw(localhost)],
debug => 1,
recurse => 0,
tcp_timeout => 5,
udp_timeout => 5,
dnssec => 1,
);
my $q = $res->query('open.com.au', 'DNSKEY');
my $keyrr;
foreach ($q->answer)
{
$keyrr = $_, last if $_->type eq 'DNSKEY';
}
my $type = 'MX';
$type = 'NS';
$type = 'NAPTR';
$q = $res->query('open.com.au.', $type);
my @answer;
my $sigrr;
foreach ($q->answer)
{
if ($_->type eq $type)
{
push(@answer, $_);
print "pushing $_\n";
}
elsif ($_->type eq 'RRSIG')
{
$sigrr = $_;
}
}
print "verify error: " . $sigrr->vrfyerrstr unless $sigrr->verify(\@answer, $keyrr);