home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
misc
/
volume44
/
dnswalk
/
patch02
next >
Wrap
Internet Message Format
|
1994-08-10
|
11KB
From: barr@pop.psu.edu (David Barr)
Newsgroups: comp.sources.misc
Subject: v44i018: dnswalk - A DNS database debugger, Patch02
Date: 10 Aug 1994 15:57:46 -0500
Organization: Penn State Population Research Institute
Sender: kent@sparky.sterling.com
Approved: kent@sparky.sterling.com
Message-ID: <32bf0a$dqj@sparky.sterling.com>
X-Md4-Signature: e0e0496dbded9722447a31281c375391
Submitted-by: barr@pop.psu.edu (David Barr)
Posting-number: Volume 44, Issue 18
Archive-name: dnswalk/patch02
Environment: Perl, Dig, DNS
Patch-To: dnswalk: Volume 43, Issue 50
This will give you dnswalk 1.8.2.
This release accounts for Solaris 2.x's unfriendly gethostbyname(),
spelling errors, and some fixes in lame delegation checking.
Of note is that I'm now sure that dnswalk works with Perl 5.
dnswalk is a DNS debugger. It performs zone transfers of specified
domains, and checks the database in numerous ways for internal
consistency, as well as accuracy.
This program may be freely distributed, as long as this notice
and documentation are distributed with the program. This program is
released as-is, with no warranty expressed or implied. Some assembly
required, contents may settle during shipment. This program can be
found in:
ftp.pop.psu.edu:/pub/src/dnswalk/ or the mirrors:
ftp.uu.net:/networking/ip/dns/dnswalk/*
ftp.edu.tw:/UNIX/networking/dns/dnswalk/*
ftp.univ-lyon1.fr:/pub/unix/network/tcpip/dns/dnswalk/*
*** dnswalk.1.8.1/README Sun Jul 24 16:33:15 1994
--- README Sun Jul 24 16:33:57 1994
***************
*** 1,7 ****
! dnswalk 1.8 - June 1994
Author: David Barr <barr@pop.psu.edu>
! $Id: README,v 1.3 1994/06/27 14:13:44 barr Exp barr $
INTRO
--- 1,7 ----
! dnswalk 1.8.2 - June 1994
Author: David Barr <barr@pop.psu.edu>
! $Id: README,v 1.4 1994/07/24 20:33:54 barr Exp barr $
INTRO
*** dnswalk.1.8.1/CHANGES Sun Jul 24 16:33:23 1994
--- CHANGES Sun Jul 24 16:33:50 1994
***************
*** 1,4 ****
! $Id: CHANGES,v 1.4 1994/06/27 14:13:38 barr Exp barr $
Version 1.8.1
One-line fix to remove reference to non-existent parameter to getmaster().
Reported by petri@ibr.cs.tu-bs.de (Stefan Petri).
--- 1,13 ----
! $Id: CHANGES,v 1.7 1994/07/24 20:33:43 barr Exp barr $
! Version 1.8.2
! Fixed spelling errors and shoddy syntax in getauthservers(), from
! Jost Krieger <Jost.Krieger@rz.ruhr-uni-bochum.de>
!
! Accounted for Solaris's broken gethostbyname() which includes trailing
! dots in retuned name.
!
! Minor fixes in lame delegation checking, and getauthservers().
!
Version 1.8.1
One-line fix to remove reference to non-existent parameter to getmaster().
Reported by petri@ibr.cs.tu-bs.de (Stefan Petri).
*** dnswalk.1.8.1/dnswalk Sun Jul 24 16:33:23 1994
--- dnswalk Sun Jul 24 16:34:18 1994
***************
*** 2,8 ****
# dnswalk Walk through a DNS tree, pulling out zone data and
# dumping it in a directory tree
#
! # $Id: dnswalk,v 1.9 1994/06/27 14:13:24 barr Exp barr $
#
# check data collected for legality using standard resolver
#
--- 2,8 ----
# dnswalk Walk through a DNS tree, pulling out zone data and
# dumping it in a directory tree
#
! # $Id: dnswalk,v 1.11 1994/07/24 20:34:14 barr Exp barr $
#
# check data collected for legality using standard resolver
#
***************
*** 65,71 ****
}
}
}
! # try to get a zone transfer, trying each listed authoratative server if
# if fails.
sub doaxfr {
local ($domain)=@_[0];
--- 65,71 ----
}
}
}
! # try to get a zone transfer, trying each listed authoritative server if
# if fails.
sub doaxfr {
local ($domain)=@_[0];
***************
*** 75,81 ****
# error handling
($path=&host2path($domain)) =~ tr/A-Z/a-z/;
local(@servers) = &getauthservers($domain);
! &printerr("warning: $domain has only one authoratative nameserver\n") if (scalar(@servers) == 1);
&printerr("warning: $domain has NO authoritative nameservers!\n") if (scalar(@servers) == 0);
if ((-f "$basedir/$path/axfr") && (!$main'opt_f)) {
open(DIG,"<$basedir/$path/axfr") || die "cannot open $basedir/$path/axfr: $!\n";
--- 75,81 ----
# error handling
($path=&host2path($domain)) =~ tr/A-Z/a-z/;
local(@servers) = &getauthservers($domain);
! &printerr("warning: $domain has only one authoritative nameserver\n") if (scalar(@servers) == 1);
&printerr("warning: $domain has NO authoritative nameservers!\n") if (scalar(@servers) == 0);
if ((-f "$basedir/$path/axfr") && (!$main'opt_f)) {
open(DIG,"<$basedir/$path/axfr") || die "cannot open $basedir/$path/axfr: $!\n";
***************
*** 197,209 ****
local ($s);
open(DIG,"dig +noau ns $_[0] 2>/dev/null|");
local(@servers)=();
! local(@servhash)=();
while (<DIG>) {
chop;
tr/A-Z/a-z/;
if (/\S+\s+\d+\s+ns\s+(\S+)/) {
$s=$1;
! if ($s eq $master) {
$foundmaster=1; # make sure the master is at the top
} else {
push(@servers,$s) if ($servhash{$s}++<1);
--- 197,209 ----
local ($s);
open(DIG,"dig +noau ns $_[0] 2>/dev/null|");
local(@servers)=();
! local(%servhash)=();
while (<DIG>) {
chop;
tr/A-Z/a-z/;
if (/\S+\s+\d+\s+ns\s+(\S+)/) {
$s=$1;
! if (&equal($s,$master)) {
$foundmaster=1; # make sure the master is at the top
} else {
push(@servers,$s) if ($servhash{$s}++<1);
***************
*** 212,218 ****
}
close(DIG);
if ($foundmaster) {
! unshift(servers,$master);
}
return @servers;
}
--- 212,218 ----
}
close(DIG);
if ($foundmaster) {
! unshift(@servers,$master);
}
return @servers;
}
***************
*** 288,294 ****
if (!$name) {
&printerr(" $_[0] PTR $_[3]: unknown host\n");
}
! elsif (!&equal(($name.'.'),$_[3])) {
&printerr(" $_[0] PTR $_[3]: CNAME (to $name)\n");
}
elsif (!&matchaddrlist($_[0])) {
--- 288,294 ----
if (!$name) {
&printerr(" $_[0] PTR $_[3]: unknown host\n");
}
! elsif (!&equal($name,$_[3])) {
&printerr(" $_[0] PTR $_[3]: CNAME (to $name)\n");
}
elsif (!&matchaddrlist($_[0])) {
***************
*** 307,313 ****
if (!$name) {
&printerr(" $_[0] A $_[3]: no PTR record\n");
}
! elsif ($opt_F && !&equal($name.".",$_[0])) {
&printerr(" $_[0] A $_[3]: points to $name\n") if ((split(/\./,$name,1))[0] ne "localhost");
}
if ($main'opt_a) {
--- 307,313 ----
if (!$name) {
&printerr(" $_[0] A $_[3]: no PTR record\n");
}
! elsif ($opt_F && !&equal($name,$_[0])) {
&printerr(" $_[0] A $_[3]: points to $name\n") if ((split(/\./,$name,1))[0] ne "localhost");
}
if ($main'opt_a) {
***************
*** 331,337 ****
else {
if (!$name) {
&printerr(" $_[0] NS $_[3]: unknown host\n");
! } elsif (!&equal(($name.'.'),$_[3])) {
&printerr(" $_[0] NS $_[3]: CNAME (to $name)\n");
}
}
--- 331,337 ----
else {
if (!$name) {
&printerr(" $_[0] NS $_[3]: unknown host\n");
! } elsif (!&equal($name,$_[3])) {
&printerr(" $_[0] NS $_[3]: CNAME (to $name)\n");
}
}
***************
*** 346,352 ****
if (!$name) {
&printerr(" $_[0] MX $_[3]: unknown host\n");
}
! elsif (!&equal(($name.'.'),$mx)) {
&printerr(" $_[0] MX $_[3]: CNAME (to $name)\n");
}
}
--- 346,352 ----
if (!$name) {
&printerr(" $_[0] MX $_[3]: unknown host\n");
}
! elsif (!&equal($name,$mx)) {
&printerr(" $_[0] MX $_[3]: CNAME (to $name)\n");
}
}
***************
*** 358,364 ****
else {
if (!$name) {
&printerr(" $_[0] CNAME $_[3]: unknown host\n");
! } elsif (!&equal(($name.'.'),$_[3])) {
&printerr(" $_[0] CNAME $_[3]: CNAME (to $name)\n");
}
}
--- 358,364 ----
else {
if (!$name) {
&printerr(" $_[0] CNAME $_[3]: unknown host\n");
! } elsif (!&equal($name,$_[3])) {
&printerr(" $_[0] CNAME $_[3]: CNAME (to $name)\n");
}
}
***************
*** 384,389 ****
--- 384,397 ----
# Do case-insensitive string comparisons
local ($one)= $_[0];
local ($two)= $_[1];
+ $stripone=$one;
+ if (chop($stripone) eq '.') {
+ $one=$stripone;
+ }
+ $striptwo=$two;
+ if (chop($striptwo) eq '.') {
+ $two=$striptwo;
+ }
$one =~ tr/A-Z/a-z/;
$two =~ tr/A-Z/a-z/;
return ($one eq $two);
***************
*** 422,428 ****
sub checklamer {
local ($isauth)=0;
local ($error)=0;
! # must check twice, since first query may be authoratative
# trap stderr here and print if non-empty
open(DIG,"dig soa +noaa $_[0] \@$_[1] 2>&1 1>/dev/null |");
while (<DIG>) {
--- 430,436 ----
sub checklamer {
local ($isauth)=0;
local ($error)=0;
! # must check twice, since first query may be authoritative
# trap stderr here and print if non-empty
open(DIG,"dig soa +noaa $_[0] \@$_[1] 2>&1 1>/dev/null |");
while (<DIG>) {
***************
*** 434,439 ****
--- 442,455 ----
return if $error;
open(DIG,"dig soa +noaa $_[0] \@$_[1] 2>/dev/null|");
while (<DIG>) {
+ if (/status: NXDOMAIN/) {
+ $isauth=0;
+ last;
+ }
+ if (/status: SERVFAIL/) {
+ $isauth=0;
+ last;
+ }
if (/;; flags.*aa.*;/) {
$isauth=1;
}
exit 0 # Just in case...