#
# Copyright (C) 2005, 2007, 2011-2014, 2016, 2017 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
$PERL -e 'binmode STDIN;
read(STDIN, $input, 8);
($style, $version) = unpack("NN", $input);
exit 1 if ($style != 3 || $version > 1);' < $1
return $?
}
$PERL -e 'binmode STDIN;
read(STDIN, $input, 8);
($style, $version) = unpack("NN", $input);
exit 1 if ($style != 2 || $version > 1);' < $1
return $?
}
# there should be no whitespace at the beginning of a line
return 1
else
return 0
fi
}
$PERL -e 'binmode STDIN;
read(STDIN, $input, 8);
if (length($input) < 8) { print "not raw\n"; exit 0; };
($style, $version) = unpack("NN", $input);
print ($style == 2 || $style == 3 ? "$version\n" :
"not raw or map\n");' < $1
}
$PERL -e 'binmode STDIN;
read(STDIN, $input, 20);
if (length($input) < 20) { print "UNSET\n"; exit; };
($format, $version, $dumptime, $flags, $sourceserial) =
unpack("NNNNN", $input);
if ($format != 2 || $version < 1) { print "UNSET\n"; exit; };
if ($flags & 02) {
print $sourceserial . "\n";
} else {
print "UNSET\n";
}' < $1
}
$PERL -e 'open(my $file, "+<", $ARGV[0]);
binmode $file;
seek($file, $ARGV[1], 0);
for (my $i = 0; $i < $ARGV[2]; $i++) {
print $file pack('C', $ARGV[3]);
}
close($file);' $1 $2 $3 $4
}
sleep 1
}
DIGOPTS="+tcp +noauth +noadd +nosea +nostat +noquest +nocomm +nocmd"
status=0
echo "I:checking that master files in raw format loaded"
ret=0
set -- 1 2 3
echo
done
if [ $zone = "example" ]; then
set -- 1 2
fi
done
echo "I:checking raw format versions"
ret=0
echo "I:checking source serial numbers"
ret=0
echo "I:waiting for transfers to complete"
do
sleep 1
done
echo "I:checking that slave was saved in raw format by default"
ret=0
echo "I:checking that slave was saved in text format when configured"
ret=0
echo "I:checking that slave was saved in 'full' style when configured"
ret=0
echo "I:checking that slave formerly in text format is now raw"
do
ret=0
sleep 1
done
echo "I:checking that large rdatasets loaded"
do
ret=0
for a in a b c
do
done
sleep 1
done
echo "I:checking format transitions: text->raw->map->text"
ret=0
echo "I:checking format transitions: text->map->raw->text"
ret=0
echo "I:checking map format loading with journal file rollforward"
ret=0
$NSUPDATE <<END > /dev/null || status=1
server 10.53.0.3 5300
ttl 600
update add newtext.dynamic IN TXT "added text"
update delete aaaa.dynamic
send
END
# using "rndc halt" ensures that we don't dump the zone file
lret=0
done
echo "I:checking map format file dumps correctly"
ret=0
$NSUPDATE <<END > /dev/null || status=1
server 10.53.0.3 5300
ttl 600
update add moretext.dynamic IN TXT "more text"
send
END
# using "rndc stop" will cause the zone file to flush before shutdown
lret=0
done
# stomp on the file header
echo "I:checking corrupt map files fail to load (bad file header)"
ret=0
# stomp on the file data so it hashes differently.
# these are small and subtle changes, so that the resulting file
# would appear to be a legitimate map file and would not trigger an
# assertion failure if loaded into memory, but should still fail to
# load because of a SHA1 hash mismatch.
echo "I:checking corrupt map files fail to load (bad node header)"
ret=0
echo "I:checking corrupt map files fail to load (bad node data)"
ret=0
echo "I:checking map format zone is scheduled for resigning (compilezone)"
ret=0
echo "I:checking map format zone is scheduled for resigning (signzone)"
ret=0
cd ns1
cd ..
echo "I:exit status: $status"