]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Improve awk tests to prevent false negatives
authorMark Andrews <marka@isc.org>
Wed, 17 Aug 2022 02:08:16 +0000 (12:08 +1000)
committerMark Andrews <marka@isc.org>
Thu, 18 Aug 2022 02:56:57 +0000 (02:56 +0000)
The old code could incorrectly match "INSOA" in the RRSIG rdata
when looking for the SOA record.

bin/tests/system/dnssec/tests.sh

index f1be7c0b5682c495abe3ab23e96367be94e20246..9f36160c8a08bb981f1c95857d4db3e1b77da771 100644 (file)
@@ -1804,8 +1804,12 @@ $SIGNER -O raw -f signer.out.5 -Sxt -o example example.db > /dev/null
 $SIGNER -O raw=0 -f signer.out.6 -Sxt -o example example.db > /dev/null
 $SIGNER -O raw -f - -Sxt -o example example.db > signer.out.7 2> /dev/null
 ) || ret=1
-awk '/IN *SOA/ {if (NF != 11) exit(1)}' signer/signer.out.3 || ret=1
-awk '/IN *SOA/ {if (NF != 7) exit(1)}' signer/signer.out.4 || ret=1
+awk 'BEGIN { found = 0; }
+     $1 == "example." && $3 == "IN" && $4 == "SOA" { found = 1; if (NF != 11) exit(1); }
+     END { if (!found) exit(1); }' signer/signer.out.3 || ret=1
+awk 'BEGIN { found = 0; }
+     $1 == "example." && $3 == "IN" && $4 == "SOA" { found = 1; if (NF != 7) exit(1); }
+     END { if (!found) exit(1); }' signer/signer.out.4 || ret=1
 israw1 signer/signer.out.5 || ret=1
 israw0 signer/signer.out.6 || ret=1
 israw1 signer/signer.out.7 || ret=1