]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix a typo in rpz test
authorEvan Hunt <each@isc.org>
Thu, 29 Oct 2020 01:01:49 +0000 (18:01 -0700)
committerEvan Hunt <each@isc.org>
Thu, 29 Oct 2020 04:39:35 +0000 (21:39 -0700)
"tcp-only" was not being tested correctly in the RPZ system test
because the option to the "digcmd" function that causes queries to
be sent via TCP was misspelled in one case, and was being interpreted
as a query name.

the "ckresult" function has also been changed to be case sensitive
for consistency with "digcmd".

bin/tests/system/rpz/tests.sh

index c728c45d5c8a798486a749103277314d28b1a773..a151a3af977b0e93e52c172e4d923dbb1d0dd9c9 100644 (file)
@@ -315,22 +315,25 @@ clean_result () {
 # $2=other dig output file
 ckresult () {
     #ckalive "$1" "server crashed by 'dig $1'" || return 1
+    expr "$1" : 'TCP ' > /dev/null && tcp=1 || tcp=0
+    digarg=${1#TCP }
+
     if grep "flags:.* aa .*ad;" $DIGNM; then
-       setret "'dig $1' AA and AD set;"
+       setret "'dig $digarg' AA and AD set;"
     elif grep "flags:.* aa .*ad;" $DIGNM; then
-       setret "'dig $1' AD set;"
+       setret "'dig $digarg' AD set;"
     fi
+
     if $PERL ../digcomp.pl $DIGNM $2 >/dev/null; then
-       NEED_TCP=`echo "$1" | sed -n -e 's/[Tt][Cc][Pp].*/TCP/p'`
-       RESULT_TCP=`sed -n -e 's/.*Truncated, retrying in TCP.*/TCP/p' $DIGNM`
-       if test "$NEED_TCP" != "$RESULT_TCP"; then
-           setret "'dig $1' wrong; no or unexpected truncation in $DIGNM"
+       grep -q 'Truncated, retrying in TCP' $DIGNM && trunc=1 || trunc=0
+       if [ "$tcp" -ne "$trunc" ]; then
+           setret "'dig $digarg' wrong; no or unexpected truncation in $DIGNM"
            return 1
        fi
        clean_result ${DIGNM}*
        return 0
     fi
-    setret "'dig $1' wrong; diff $DIGNM $2"
+    setret "'dig $digarg' wrong; diff $DIGNM $2"
     return 1
 }
 
@@ -525,7 +528,7 @@ for mode in native dnsrps; do
   nochange a0-1.tld2s srv +auth +dnssec                # 30 no write for DNSSEC and no record
   nxdomain a0-1.tld2s srv +nodnssec            # 31
   drop a3-8.tld2 any                           # 32 drop
-  nochange tcp a3-9.tld2                       # 33 tcp-only
+  nochange TCP a3-9.tld2                       # 33 tcp-only
   here x.servfail <<'EOF'                      # 34 qname-wait-recurse yes
     ;; status: SERVFAIL, x
 EOF