From: Mark Andrews Date: Thu, 6 Aug 2026 02:29:28 +0000 (+1000) Subject: Check for expected error messages from named-checkzone X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5d822f565dbf0ea74876c76c76a7e2b9f4cf4e3b;p=thirdparty%2Fbind9.git Check for expected error messages from named-checkzone Also fail any zone of with name bad-* that does not have a expected error message. --- diff --git a/bin/tests/system/checkzone/tests.sh b/bin/tests/system/checkzone/tests.sh index e01807256e2..bd2be2223d5 100644 --- a/bin/tests/system/checkzone/tests.sh +++ b/bin/tests/system/checkzone/tests.sh @@ -44,19 +44,126 @@ for db in zones/bad*.db; do echo_i "checking $db ($n)" ret=0 v=0 case $db in - zones/bad-dns-sd-reverse.db | zones/bad-svcb-servername.db) - $CHECKZONE -k fail -i local 0.0.0.0.in-addr.arpa $db >test.out.$n 2>&1 || v=$? + zones/bad-_dns-svcb*.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "SVCB record not valid:" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-caa-rr.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "dns_rdata_fromtext: zones/bad-caa-rr\.db:6: near .*: syntax error" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-cdnskey.db | zones/bad-cds.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "CDS/CDNSKEY consistency checks failed" test.out.$n >/dev/null || ret=1 ;; zones/bad-cname-and*.db) $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? grep "CNAME and other data" test.out.$n >/dev/null || ret=1 ;; + zones/bad-dhcid.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "zones/bad-dhcid\.db:1: near eol: unexpected end of input" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-dns-sd-reverse.db) + $CHECKZONE -k fail -i local 0.0.0.0.in-addr.arpa $db >test.out.$n 2>&1 || v=$? + grep "${db}:8: near '!@#3.': bad name (check-names)" test.out.$n >/dev/null || ret=1 + grep "${db}:9: near '!@#3.': bad name (check-names)" test.out.$n >/dev/null || ret=1 + grep "${db}:10: near '!@#3.': bad name (check-names)" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-ds.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "DS record at top of zone (example)" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-ds-2.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "DS not at delegation point" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-eid.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "zones/bad-eid.db:1: near eol: unexpected end of input" test.out.$n >/dev/null || ret=1 + grep "zones/bad-eid.db:2: near eol: unexpected end of input" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-generate-garbage.db | zones/bad-generate-missing-brace.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "\$GENERATE: ${db}:6: syntax error" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-generate-range.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "\$GENERATE: ${db}:7: out of range" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-generate-tkey.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "\$GENERATE: ${db}:6: meta RR type 'TKEY'" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-include-directory.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "dns_master_load: .:1: isc_lex_gettoken() failed: not a file" test.out.$n >/dev/null || ret=1 + grep "dns_master_load: ..:1: isc_lex_gettoken() failed: not a file" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-nsap-empty.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "near '0x': unexpected end of input" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-nsap-odd-nibble.db) + $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "near '0x47000580005a0000000001e133ffffff000161000': unexpected end of input" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-nsec3-length.db) + $CHECKZONE -P -i local example $db >test.out.$n 2>&1 || v=$? + grep "zones/bad-nsec3-length.db:6: near 'IMQ912BREQP1POLAH3RMONG': out of range" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-nsec3-padded.db) + $CHECKZONE -P -i local example $db >test.out.$n 2>&1 || v=$? + grep "zones/bad-nsec3-padded.db:8: near 'CPNMU===': bad base32 encoding" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-nsec3owner-padded.db) + $CHECKZONE -P -i local example $db >test.out.$n 2>&1 || v=$? + grep "zones/bad-nsec3owner-padded.db:7: CPNMU===.example: bad owner name (check-names)" test.out.$n >/dev/null || ret=1 + ;; zones/bad-rpz-prefix.db) $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || v=$? grep 'invalid rpz IP address "128.2.0.0.0.0.3.2.2001.rpz-ip.db" is not in canonical form 128.2.zz.3.2.2001.rpz-nsdname.db' test.out.$n >/dev/null || ret=1 ;; - *) + zones/bad-svcb-alpn[123456].db) + $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || v=$? + grep "${db}:6: near 'alpn=.*': syntax error" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-svcb-mandatory.db) + $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || v=$? + grep "zones/bad-svcb-mandatory.db:6: near eol: disallowed (by application policy)" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-svcb-servername.db) + $CHECKZONE -k fail -i local 0.0.0.0.in-addr.arpa $db >test.out.$n 2>&1 || v=$? + grep "${db}:6: near '_underscore.example.': bad name (check-names)" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-svcb.db) + $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || v=$? + grep "zones/bad-svcb.db:6: near 'unknown=wha': syntax error" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-tkey.db | zones/bad-tsig.db) + $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || v=$? + grep "type '[A-Z]*': invalid use of a meta type" test.out.$n >/dev/null || ret=1 + ;; + zones/bad-unspec.db) + $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || v=$? + grep "zones/bad-unspec.db:5: near '^#': unknown class/type" test.out.$n >/dev/null || ret=1 + ;; + zones/bad1.db) + $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || v=$? + grep "zones/bad1.db:6: extra input text" test.out.$n >/dev/null || ret=1 + ;; + zones/bad[234].db) + $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || v=$? + grep "\$GENERATE: ${db}:8: invalid range" test.out.$n >/dev/null || ret=1 + ;; + zones/badttl.db) $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$? + grep "zones/badttl.db:1: unexpected end of line" test.out.$n >/dev/null || ret=1 + ;; + *) + ret=1 + echo "add case entry for $db" + $CHECKZONE -i local example $db || v=$? ;; esac test $v = 1 || ret=1 diff --git a/bin/tests/system/checkzone/zones/bad-nimloc.db b/bin/tests/system/checkzone/zones/bad-nimloc.db deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/bin/tests/system/checkzone/zones/bad-nsap-empty.db b/bin/tests/system/checkzone/zones/bad-nsap-empty.db index dea29304eb0..e4051f565fd 100644 --- a/bin/tests/system/checkzone/zones/bad-nsap-empty.db +++ b/bin/tests/system/checkzone/zones/bad-nsap-empty.db @@ -3,5 +3,5 @@ $TTL 600 NS ns ns A 192.0.2.1 -; NSAP with an odd number of hex digits -example NSAP 0x47000580005a0000000001e133ffffff000161000 +; empty NSAP address +example NSAP 0x diff --git a/bin/tests/system/checkzone/zones/bad-nsap-odd-nibble.db b/bin/tests/system/checkzone/zones/bad-nsap-odd-nibble.db index e4051f565fd..dea29304eb0 100644 --- a/bin/tests/system/checkzone/zones/bad-nsap-odd-nibble.db +++ b/bin/tests/system/checkzone/zones/bad-nsap-odd-nibble.db @@ -3,5 +3,5 @@ $TTL 600 NS ns ns A 192.0.2.1 -; empty NSAP address -example NSAP 0x +; NSAP with an odd number of hex digits +example NSAP 0x47000580005a0000000001e133ffffff000161000 diff --git a/bin/tests/system/checkzone/zones/bad-nsec3-length.db b/bin/tests/system/checkzone/zones/bad-nsec3-length.db index e2ff7821a92..fcf0493f2bf 100644 --- a/bin/tests/system/checkzone/zones/bad-nsec3-length.db +++ b/bin/tests/system/checkzone/zones/bad-nsec3-length.db @@ -3,4 +3,4 @@ $TTL 600 NS ns ns A 192.0.2.1 -I7A7A184GGMI35K1E3IR650LKO7NOB5R.dyn.example.net. 7200 IN NSEC3 1 0 10 76931F IMQ912BREQP1POLAH3RMONG;UED541AS A RRSIG +I7A7A184GGMI35K1E3IR650LKO7NOB5R 7200 IN NSEC3 1 0 10 76931F IMQ912BREQP1POLAH3RMONG;UED541AS A RRSIG