From d19916bde4c0824c33d599374ea2c7bf0c88728a Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 17 Aug 2022 12:08:16 +1000 Subject: [PATCH] Improve awk tests to prevent false negatives The old code could incorrectly match "INSOA" in the RRSIG rdata when looking for the SOA record. (cherry picked from commit 2fc5f6fb2831697c79f75c50a769449ac561aad0) --- bin/tests/system/dnssec/tests.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/tests/system/dnssec/tests.sh b/bin/tests/system/dnssec/tests.sh index 23a1409482..14451f18ae 100644 --- a/bin/tests/system/dnssec/tests.sh +++ b/bin/tests/system/dnssec/tests.sh @@ -1790,8 +1790,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