]> 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 05:38:55 +0000 (22:38 -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".

(cherry picked from commit 78af071c11d21e2ce18ae2af0b384548c65a47e0)

bin/tests/system/rpz/tests.sh

index e5e30da11de0b5d26056bcffca5fe84e31dc035b..fda730823307a8927dcdd20bfe286d056e4e35fe 100644 (file)
@@ -316,22 +316,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 $SYSTEMTESTTOP/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
 }
 
@@ -526,7 +529,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