Skip to content

Commit

Permalink
Update to use public Net::DNS API
Browse files Browse the repository at this point in the history
Otherwize user get Net::DNS::....=HASH(0x1a7d060) garbage in place of
resolved hostnames. For example

$ printf  "127.0.0.1\n192.168.34.34\n" | jdresolve  --nostats -
Net::DNS::DomainName1035=HASH(0x21e0920)
192.168.34.34
  • Loading branch information
Pavel Ammosov committed Dec 2, 2015
1 parent fdea5b7 commit 71b9c86
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jdresolve
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,12 @@ sub checkresponse {
# For each DNS answer, check the data received
if ($type eq 'H') {
if (defined $_->{ptrdname}) {
if ($_->isa('Net::DNS::RR::PTR')) {
# Fix for a new version of Net::DNS
$hosts{$query}{NAME} = $_->rdatastr();
} else {
$hosts{$query}{NAME} = $_->{ptrdname};
}
$hosts{$query}{RESOLVED} = 'N';

$resolved = 1;
Expand Down

0 comments on commit 71b9c86

Please sign in to comment.