]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test that "named-checkzone -P" detects invalid RPZ IP prefixes 12455/head
authorMark Andrews <marka@isc.org>
Mon, 27 Jul 2026 06:37:33 +0000 (16:37 +1000)
committerMark Andrews <marka@isc.org>
Sun, 2 Aug 2026 23:30:58 +0000 (09:30 +1000)
Also check that a well formed RPZ IP prefix does not generate
an error when in RPZ mode (-P).

bin/tests/system/checkzone/tests.sh
bin/tests/system/checkzone/zones/bad-rpz-prefix.db [new file with mode: 0644]
bin/tests/system/checkzone/zones/good-rpz-prefix.db [new file with mode: 0644]

index 7868869866b7440b201c15cd1c094960a0ab5dba..0806392d928086db0bb33850839f9115e9e686fe 100644 (file)
@@ -28,6 +28,9 @@ for db in zones/good*.db; do
     zones/good-dns-sd-reverse.db)
       $CHECKZONE -k fail -i local 0.0.0.0.in-addr.arpa $db >test.out.$n 2>&1 || ret=1
       ;;
+    zones/good-rpz-prefix.db)
+      $CHECKZONE -P -i local db $db >test.out.$n 2>&1 || ret=1
+      ;;
     *)
       $CHECKZONE -i local example $db >test.out.$n 2>&1 || ret=1
       ;;
@@ -48,6 +51,10 @@ for db in zones/bad*.db; do
       $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-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
+      ;;
     *)
       $CHECKZONE -i local example $db >test.out.$n 2>&1 || v=$?
       ;;
diff --git a/bin/tests/system/checkzone/zones/bad-rpz-prefix.db b/bin/tests/system/checkzone/zones/bad-rpz-prefix.db
new file mode 100644 (file)
index 0000000..6c6e212
--- /dev/null
@@ -0,0 +1,4 @@
+$TTL 0
+@ SOA . . 0 0 0 0 0
+@ NS .
+128.2.0.0.0.0.3.2.2001.rpz-ip    300 CNAME .
diff --git a/bin/tests/system/checkzone/zones/good-rpz-prefix.db b/bin/tests/system/checkzone/zones/good-rpz-prefix.db
new file mode 100644 (file)
index 0000000..935849d
--- /dev/null
@@ -0,0 +1,4 @@
+$TTL 0
+@ SOA . . 0 0 0 0 0
+@ NS .
+128.2.zz.3.2.2001.rpz-ip    300 CNAME .