diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 23:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 23:51:28 +0000 |
commit | 754c7de1e91eeb28c6d3766900ead0c3e44fdb85 (patch) | |
tree | 51433c0e38731dc9ecd342555a56f876980b1834 /bin/tests/system/pending | |
parent | Adding debian version 1:9.16.44-1~deb11u1. (diff) | |
download | bind9-754c7de1e91eeb28c6d3766900ead0c3e44fdb85.tar.xz bind9-754c7de1e91eeb28c6d3766900ead0c3e44fdb85.zip |
Merging upstream version 1:9.16.48.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin/tests/system/pending')
-rw-r--r-- | bin/tests/system/pending/ns1/sign.sh | 10 | ||||
-rw-r--r-- | bin/tests/system/pending/ns2/sign.sh | 16 | ||||
-rw-r--r-- | bin/tests/system/pending/tests.sh | 105 |
3 files changed, 65 insertions, 66 deletions
diff --git a/bin/tests/system/pending/ns1/sign.sh b/bin/tests/system/pending/ns1/sign.sh index c29ebe2..5f3998a 100644 --- a/bin/tests/system/pending/ns1/sign.sh +++ b/bin/tests/system/pending/ns1/sign.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh # Copyright (C) Internet Systems Consortium, Inc. ("ISC") # @@ -18,19 +18,19 @@ zone=. infile=root.db.in zonefile=root.db -(cd ../ns2 && $SHELL -e sign.sh ) +(cd ../ns2 && $SHELL -e sign.sh) cp ../ns2/dsset-example$TP . cp ../ns2/dsset-example.com$TP . keyname1=$($KEYGEN -q -a ${DEFAULT_ALGORITHM} -n zone $zone) keyname2=$($KEYGEN -q -a ${DEFAULT_ALGORITHM} -f KSK -n zone $zone) -cat $infile $keyname1.key $keyname2.key > $zonefile +cat $infile $keyname1.key $keyname2.key >$zonefile -$SIGNER -g -o $zone $zonefile > /dev/null +$SIGNER -g -o $zone $zonefile >/dev/null # Configure the resolving server with a static key. -keyfile_to_static_ds $keyname2 > trusted.conf +keyfile_to_static_ds $keyname2 >trusted.conf cp trusted.conf ../ns2/trusted.conf cp trusted.conf ../ns3/trusted.conf cp trusted.conf ../ns4/trusted.conf diff --git a/bin/tests/system/pending/ns2/sign.sh b/bin/tests/system/pending/ns2/sign.sh index df408f8..789fff7 100644 --- a/bin/tests/system/pending/ns2/sign.sh +++ b/bin/tests/system/pending/ns2/sign.sh @@ -15,20 +15,20 @@ SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh for domain in example example.com; do - zone=${domain}. - infile=${domain}.db.in - zonefile=${domain}.db + zone=${domain}. + infile=${domain}.db.in + zonefile=${domain}.db - keyname1=$($KEYGEN -q -a ${DEFAULT_ALGORITHM} -n zone $zone) - keyname2=$($KEYGEN -q -a ${DEFAULT_ALGORITHM} -f KSK -n zone $zone) + keyname1=$($KEYGEN -q -a ${DEFAULT_ALGORITHM} -n zone $zone) + keyname2=$($KEYGEN -q -a ${DEFAULT_ALGORITHM} -f KSK -n zone $zone) - cat $infile $keyname1.key $keyname2.key > $zonefile + cat $infile $keyname1.key $keyname2.key >$zonefile - $SIGNER -3 bebe -o $zone $zonefile > /dev/null + $SIGNER -3 bebe -o $zone $zonefile >/dev/null done # remove "removed" record from example.com, causing the server to # send an apparently-invalid NXDOMAIN -sed '/^removed/d' example.com.db.signed > example.com.db.new +sed '/^removed/d' example.com.db.signed >example.com.db.new rm -f example.com.db.signed mv example.com.db.new example.com.db.signed diff --git a/bin/tests/system/pending/tests.sh b/bin/tests/system/pending/tests.sh index 049172f..22f1a0c 100644 --- a/bin/tests/system/pending/tests.sh +++ b/bin/tests/system/pending/tests.sh @@ -15,32 +15,31 @@ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh # replace_data dname RR old_data new_data -replace_data() -{ - if [ $# -ne 4 ]; then - echo_i "unexpected input for replace_data" - return 1 - fi - - _dname=$1 - _rr=$2 - _olddata=$3 - _newdata=$4 - - _ret=0 - $NSUPDATE -d <<END >> nsupdate.out.test 2>&1 || _ret=1 +replace_data() { + if [ $# -ne 4 ]; then + echo_i "unexpected input for replace_data" + return 1 + fi + + _dname=$1 + _rr=$2 + _olddata=$3 + _newdata=$4 + + _ret=0 + $NSUPDATE -d <<END >>nsupdate.out.test 2>&1 || _ret=1 server 10.53.0.2 ${PORT} update delete ${_dname} 30 ${_rr} ${_olddata} update add ${_dname} 30 ${_rr} ${_newdata} send END - if [ $_ret != 0 ]; then - echo_i "failed to update the test data" - return 1 - fi + if [ $_ret != 0 ]; then + echo_i "failed to update the test data" + return 1 + fi - return 0 + return 0 } status=0 @@ -52,18 +51,18 @@ DIGOPTS_CD="$DIGOPTS +cd" echo_i "Priming cache." ret=0 expect="10 mail.example." -ans=`$DIG $DIGOPTS_CD @10.53.0.4 hostile MX` || ret=1 +ans=$($DIG $DIGOPTS_CD @10.53.0.4 hostile MX) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Checking that bogus additional is not returned with +CD." ret=0 expect="10.0.0.2" -ans=`$DIG $DIGOPTS_CD @10.53.0.4 mail.example A` || ret=1 +ans=$($DIG $DIGOPTS_CD @10.53.0.4 mail.example A) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) # # Prime cache with pending additional records. These should not be promoted @@ -72,36 +71,36 @@ status=`expr $status + $ret` echo_i "Priming cache (pending additional A and AAAA)" ret=0 expect="10 mail.example.com." -ans=`$DIG $DIGOPTS @10.53.0.4 example.com MX` || ret=1 +ans=$($DIG $DIGOPTS @10.53.0.4 example.com MX) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Replacing pending A" ret=0 replace_data mail.example.com. A 192.0.2.2 192.0.2.3 || ret=1 -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Replacing pending AAAA" ret=0 replace_data mail.example.com. AAAA 2001:db8::2 2001:db8::3 || ret=1 -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Checking updated data to be returned (without CD)" ret=0 expect="192.0.2.3" -ans=`$DIG $DIGOPTS @10.53.0.4 mail.example.com A` || ret=1 +ans=$($DIG $DIGOPTS @10.53.0.4 mail.example.com A) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Checking updated data to be returned (with CD)" ret=0 expect="2001:db8::3" -ans=`$DIG $DIGOPTS_CD @10.53.0.4 mail.example.com AAAA` || ret=1 +ans=$($DIG $DIGOPTS_CD @10.53.0.4 mail.example.com AAAA) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) # # Prime cache with a pending answer record. It can be returned (without @@ -110,23 +109,23 @@ status=`expr $status + $ret` echo_i "Priming cache (pending answer)" ret=0 expect="192.0.2.2" -ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A` || ret=1 +ans=$($DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Replacing pending data" ret=0 replace_data pending-ok.example.com. A 192.0.2.2 192.0.2.3 || ret=1 -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Confirming cached pending data to be returned with CD" ret=0 expect="192.0.2.2" -ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A` || ret=1 +ans=$($DIG $DIGOPTS_CD @10.53.0.4 pending-ok.example.com A) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) # # Prime cache with a pending answer record. It should not be returned @@ -135,23 +134,23 @@ status=`expr $status + $ret` echo_i "Priming cache (pending answer)" ret=0 expect="192.0.2.102" -ans=`$DIG $DIGOPTS_CD @10.53.0.4 pending-ng.example.com A` || ret=1 +ans=$($DIG $DIGOPTS_CD @10.53.0.4 pending-ng.example.com A) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Replacing pending data" ret=0 replace_data pending-ng.example.com. A 192.0.2.102 192.0.2.103 || ret=1 -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Confirming updated data returned, not the cached one, without CD" ret=0 expect="192.0.2.103" -ans=`$DIG $DIGOPTS @10.53.0.4 pending-ng.example.com A` || ret=1 +ans=$($DIG $DIGOPTS @10.53.0.4 pending-ng.example.com A) || ret=1 test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) # # Try to fool the resolver with an out-of-bailiwick CNAME @@ -159,20 +158,20 @@ status=`expr $status + $ret` echo_i "Trying to Prime out-of-bailiwick pending answer with CD" ret=0 expect="10.10.10.10" -ans=`$DIG $DIGOPTS_CD @10.53.0.4 bad.example. A` || ret=1 -ans=`echo $ans | awk '{print $NF}'` +ans=$($DIG $DIGOPTS_CD @10.53.0.4 bad.example. A) || ret=1 +ans=$(echo $ans | awk '{print $NF}') test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Confirming the out-of-bailiwick answer is not cached or reused with CD" ret=0 expect="10.10.10.10" -ans=`$DIG $DIGOPTS_CD @10.53.0.4 nice.good. A` || ret=1 -ans=`echo $ans | awk '{print $NF}'` +ans=$($DIG $DIGOPTS_CD @10.53.0.4 nice.good. A) || ret=1 +ans=$(echo $ans | awk '{print $NF}') test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) # # Make sure the resolver doesn't cache bogus NXDOMAIN @@ -180,20 +179,20 @@ status=`expr $status + $ret` echo_i "Trying to Prime bogus NXDOMAIN" ret=0 expect="SERVFAIL" -ans=`$DIG +tcp -p ${PORT} @10.53.0.4 removed.example.com. A` || ret=1 -ans=`echo $ans | sed 's/^.*status: \([A-Z][A-Z]*\).*$/\1/'` +ans=$($DIG +tcp -p ${PORT} @10.53.0.4 removed.example.com. A) || ret=1 +ans=$(echo $ans | sed 's/^.*status: \([A-Z][A-Z]*\).*$/\1/') test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "Confirming the bogus NXDOMAIN was not cached" ret=0 expect="SERVFAIL" -ans=`$DIG +tcp -p ${PORT} @10.53.0.4 removed.example.com. A` || ret=1 -ans=`echo $ans | sed 's/^.*status: \([A-Z][A-Z]*\).*$/\1/'` +ans=$($DIG +tcp -p ${PORT} @10.53.0.4 removed.example.com. A) || ret=1 +ans=$(echo $ans | sed 's/^.*status: \([A-Z][A-Z]*\).*$/\1/') test "$ans" = "$expect" || ret=1 test $ret = 0 || echo_i "failed, got '$ans', expected '$expect'" -status=`expr $status + $ret` +status=$(expr $status + $ret) echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 |