--- dns-browse-1.9.orig/Makefile.in
+++ dns-browse-1.9/Makefile.in
@@ -4,6 +4,7 @@
# $Id: Makefile.in,v 1.5 1997/12/04 20:10:58 johnh Exp $
#
+DESTDIR=
TOSHAR=README dns_browse dns_tree \
Makefile.in configure configure.in install-sh release
PACKAGE=dns_browse
@@ -17,10 +18,8 @@
PERL = @PERL@
install:
- { echo "#!$(WISH) -f"; cat dns_browse; } >t
- $(INSTALL) -m 755 t $(bindir)/dns_browse
- { echo "#!$(PERL) -w"; cat dns_tree; } >t
- $(INSTALL) -m 755 t $(bindir)/dns_tree
+ $(INSTALL) -m 755 dns_browse $(DESTDIR)$(bindir)/
+ $(INSTALL) -m 755 dns_tree $(DESTDIR)$(bindir)/
.tar_files: Makefile release
for i in $(TOSHAR); \
@@ -38,3 +37,8 @@
tar cvf - `cat .tar_files` |gzip >$(PACKAGE)-`cat release`.tar.gz
rm ./$(PACKAGE)-`cat release`
+clean:
+ -rm *~ config.cache config.status config.log t
+
+distclean: clean
+ -rm Makefile
--- dns-browse-1.9.orig/dns_tree
+++ dns-browse-1.9/dns_tree
@@ -1,4 +1,4 @@
-#!/home/johnh/BIN/perl5 -w
+#!/usr/bin/perl -w
#
# dns_tree
@@ -23,9 +23,9 @@
sub usage {
print STDERR <<END;
-usage: $0
+usage: $0 domain
-display a tree-structured view of the dns
+display a tree-structured view of the dns domain 'domain'
Options:
-f override warnings (force)
@@ -34,6 +34,7 @@
-m MATCH show only records whos first component matches the
perl regexp MATCH
-v verbose (show all DNS requests)
+ -d debug output (show internal information of the program)
(Only -f is currently implemented)
@@ -65,6 +66,9 @@
# Temp creation race found by the Debian folks.
# http://bugs.debian.org/146591
# Fix: make the tmp file in the users home directory.
+# Note: the following check is made just in case, we do not
+# want to leave files in the / directory if the environment is messed up
+die "Environment not properly set up for use in dns_tree" if ! defined($ENV{'HOME'});
my($cache_dir) = $ENV{'HOME'} . "/.DNS_TREE";
my(@dangereous_names) = qw(com. edu. org. in-addr.arpa. co.uk.); # all lc
my(@messages) = ();
@@ -189,7 +193,7 @@
sub dig {
my($ah_ref) = @_;
- my($cmd, $name, $server, $cache_duration) = ($ah_ref->{cmd}, $ah_ref->{name}, $ah_ref->{server}, $ah_ref->{cache_duration});
+ my($cmd, $name, $server, $cache_duration, $options) = ($ah_ref->{cmd}, $ah_ref->{name}, $ah_ref->{server}, $ah_ref->{cache_duration}, $ah_ref->{options});
my(@msgs);
# What should we keep from the dig output?
@@ -229,10 +233,16 @@
};
};
if (-f $fn) {
+ print STDERR "Reading dig information fron standard input\n" if defined($opts{'debug'});
open(DIG, "< $fn") || croak "cached dig";
$from_cache = 1;
} else {
- open(DIG, "dig $cmd $name $server |") || croak "dig";
+ print STDERR "Calling dig $options $cmd $name $server\n" if defined($opts{'debug'});
+ if ( defined ($options) ) {
+ open(DIG, "dig $options $cmd $name $server |") || croak "dig";
+ } else {
+ open(DIG, "dig $cmd $name $server |") || croak "dig";
+ }
open(CACHE, "> $fn") || croak "dig to cache $fn";
};
@@ -245,6 +255,7 @@
my($origin) = ".";
my($lasta) = undef;
while (<DIG>) {
+ print STDERR "Reading dig input: $_" if defined($opts{'debug'});
print CACHE $_ if (!$from_cache);
if ($in_soa) {
my($dummy, $n) = split(/\s+/);
@@ -328,9 +339,9 @@
sub fetch_nses {
my($name, $cache_duration) = @_;
- my($res_ref, $msgs_ref) = dig({cmd => 'ns', name => $name, types => [qw(NS)], cache_duration => $cache_duration});
- die "fetch_nses: dig ns failed\n" if (!defined($res_ref));
+ my($res_ref, $msgs_ref) = dig({cmd => 'ns', name => $name, types => [qw(NS)], cache_duration => $cache_duration, options => ''});
push_msgs($msgs_ref) if (defined($opts{'verbose'}));
+ die "fetch_nses: dig ns failed\n" if (!defined($res_ref));
my(@nses);
foreach (@$res_ref) {
@@ -342,7 +353,7 @@
sub fetch_level_from_ns {
my($name, $ns, $types_aref, $cache_duration) = @_;
- my($res_ref, $msgs_ref) = dig({cmd => 'axfr', name => $name, server => $ns, types => $types_aref}, cache_duration => $cache_duration);
+ my($res_ref, $msgs_ref) = dig({cmd => 'axfr', name => $name, server => $ns, types => $types_aref}, cache_duration => $cache_duration, options => '');
push_msgs($msgs_ref);
return $res_ref;
}
@@ -361,9 +372,9 @@
sub fetch_soa {
my($name) = @_;
- my($soa_ref, $msgs_ref) = dig({cmd => 'soa', name => $name, types => [qw(SOA)]});
- die "fetch_soa: dig soa failed\n" if (!defined($soa_ref));
+ my($soa_ref, $msgs_ref) = dig({cmd => 'soa', name => $name, types => [qw(SOA)], options => '+multiline' });
push_msgs($msgs_ref) if (defined($opts{'verbose'}));
+ die "fetch_soa: dig soa failed\n" if (!defined($soa_ref));
return $soa_ref->[0];
}
@@ -390,14 +401,15 @@
}
sub main {
- &usage if ($#ARGV >= 0 && $ARGV[0] eq '-?');
- &GetOptions(\%opts, qw(f m=s t=s@ v));
+ &usage if ($#ARGV >= 0 && ( $ARGV[0] eq '-?' || $ARGV[0] eq '-h' ));
+ &GetOptions(\%opts, qw(f m=s t=s@ v d));
&usage if ($#ARGV != 0);
$opts{'force'} = $opts{'f'};
$opts{'match'} = $opts{'m'};
$opts{'types'} = $opts{'t'};
$opts{'verbose'} = $opts{'v'};
+ $opts{'debug'} = $opts{'d'};
my($types_aref) = $opts{'types'};
if (defined($types_aref) && $#$types_aref == 0 && $types_aref->[0] eq 'all') {
# special case "all"
--- dns-browse-1.9.orig/dns_browse
+++ dns-browse-1.9/dns_browse
@@ -1,4 +1,4 @@
-#!/home/johnh/BIN/wish -f
+#!/usr/bin/wish -f
#
# dns_browse
@@ -20,7 +20,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-global dns_tree types
+global dns_tree types
set dns_tree "dns_tree"
set prog "dns_browse"
set maximal_types {A CNAME HINFO LOC MX NS PTR TXT}
@@ -30,14 +30,14 @@
set www_hosts_only 0
proc usage {} {
- puts {usage: gui [-t TYPE ...] starting_domain_name
-options:
+ global prog dns_tree
+ puts stderr "usage: $prog \[-t TYPE ...\] starting_domain_name"
+ puts stderr {options:
-t TYPE show only records of these TYPE (repeat for multiple types)
(the ``all'' type does everything I know about)
-w match only web hosts
-
-Requires dns_tree to be in the path.
}
+ puts stderr "Requires $dns_tree to be in the path."
exit 1
}
@@ -610,7 +610,7 @@
proc fill_text_line {w place line base_depth} {
if {![regexp "^(\t*)(\[^\t\]+)\t+(\[^\t\]+)(.*)$" $line dummy new_tabs type value rest]} {
- error "fill_text_line: $line"
+ error "fill_text_line: '$line' does not follow expected regular expression for records"
}
set new_depth [string length $new_tabs]
set depth [expr $base_depth+$new_depth]
@@ -718,7 +718,7 @@
set wid [incr window_next_id]
set w [toplevel ".w$wid"]
global prog
- wm iconname $w "$prog: $dir"
+ wm iconname $w "$prog: $dir"
wm title $w "$prog: $dir"
# set options
@@ -765,8 +765,6 @@
set insertion_next_id 0
set window_next_id 0
- wm withdraw .
-
# option processing
global user_types maximal_types default_types www_hosts_only
if {[llength $argv] < 1} {
@@ -781,6 +779,7 @@
set optarg {}
}
switch -exact -- $optc {
+ -h { usage }
-t {
lappend user_types $optarg
set argv [lrange $argv 1 end]
@@ -798,6 +797,12 @@
set user_types $default_types
}
+ if [catch { wm withdraw .} ] {
+ puts stderr "DISPLAY variable not set correctly or not running X"
+ exit 1
+ }
+
+
# argument processing
foreach name $argv {
build_browser $name {}