]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Check that restored catalog zone works
authorMark Andrews <marka@isc.org>
Wed, 30 Nov 2022 08:32:11 +0000 (19:32 +1100)
committerMark Andrews <marka@isc.org>
Wed, 7 Dec 2022 01:55:42 +0000 (12:55 +1100)
Using a restored catalog zone excercised a use-after-free bug.
The test checks that the use-after-free bug is gone and is just
a reasonable behaviour check in its own right.

(cherry picked from commit bca84c8601a82d1f7d75b670a9ea8922ebecb4d6)

bin/tests/system/catz/ns1/named.conf.in
bin/tests/system/catz/ns2/named1.conf.in
bin/tests/system/catz/ns2/named2.conf.in
bin/tests/system/catz/tests.sh

index 376fccadc93da7bdc640fe61c35130e5957e0fbd..b64b4d5dbfadac3c4e569222b1f4c122a61e4245 100644 (file)
@@ -63,7 +63,7 @@ zone "catalog4.example" {
 
 key tsig_key. {
        secret "LSAnCU+Z";
-       algorithm hmac-md5;
+       algorithm @DEFAULT_HMAC@;
 };
 
 key next_key. {
index a1d40082b2e4df12b0e2f0386c656618edb36497..14cb8e01462bc2de153d73d2bb5f5abaa12193e1 100644 (file)
@@ -80,7 +80,7 @@ zone "catalog4.example" {
 
 key tsig_key. {
        secret "LSAnCU+Z";
-       algorithm hmac-md5;
+       algorithm @DEFAULT_HMAC@;
 };
 
 key next_key. {
index b6f0745ffcf87f4f680d0c3605e680d3a015bef9..c167310e8df748e243fca9b4c3813aa6e0fb51e3 100644 (file)
@@ -58,5 +58,5 @@ zone "catalog4.example" {
 
 key tsig_key. {
        secret "LSAnCU+Z";
-       algorithm hmac-md5;
+       algorithm @DEFAULT_HMAC@;
 };
index e24b602b30774e7cd50091f036b4ae52f5be2b12..99db4497a5ce445f1073297c41c3f4ac5772fdd2 100644 (file)
@@ -1816,5 +1816,44 @@ rndccmd 10.53.0.2 reconfig || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
+#########################################################################
+
+nextpart ns2/named.run >/dev/null
+
+n=$((n+1))
+echo_i "Adding a dom19.example. to primary via RNDC ($n)"
+ret=0
+# enough initial content for IXFR response when TXT record is added below
+echo "@ 3600 IN SOA . . 1 3600 3600 3600 3600" > ns1/dom19.example.db
+echo "@ 3600 IN NS invalid." >> ns1/dom19.example.db
+echo "foo 3600 IN TXT some content here" >> ns1/dom19.example.db
+echo "bar 3600 IN TXT some content here" >> ns1/dom19.example.db
+echo "xxx 3600 IN TXT some content here" >> ns1/dom19.example.db
+echo "yyy 3600 IN TXT some content here" >> ns1/dom19.example.db
+rndccmd 10.53.0.1 addzone dom19.example. '{ type primary; file "dom19.example.db"; allow-transfer { key tsig_key; }; allow-update { any; }; notify explicit; also-notify { 10.53.0.2; }; };' || ret=1
+if [ $ret -ne 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+n=$((n+1))
+echo_i "add an entry to the restored catalog zone ($n)"
+ret=0
+$NSUPDATE -d <<END >> nsupdate.out.test$n 2>&1 || ret=1
+    server 10.53.0.1 ${PORT}
+    update add 09da0a318e5333a9a7f6c14c385d69f6933e8b72.zones.catalog1.example. 3600 IN PTR dom19.example.
+    update add label1.masters.09da0a318e5333a9a7f6c14c385d69f6933e8b72.zones.catalog1.example. 3600 IN A 10.53.0.1
+    update add label1.masters.09da0a318e5333a9a7f6c14c385d69f6933e8b72.zones.catalog1.example. 3600 IN TXT "tsig_key"
+    send
+END
+if [ $ret -ne 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
+n=$((n+1))
+echo_i "waiting for secondary to sync up ($n)"
+ret=0
+wait_for_message ns2/named.run "catz: adding zone 'dom19.example' from catalog 'catalog1.example'" &&
+wait_for_message ns2/named.run "transfer of 'dom19.example/IN' from 10.53.0.1#${PORT}: Transfer status: success" || ret=1
+if [ $ret -ne 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
 echo_i "exit status: $status"
 [ $status -eq 0 ] || exit 1