]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Test 'rndc dumpdb' with an unwritable dump-file
authorAram Sargsyan <aram@isc.org>
Tue, 24 Sep 2024 09:49:04 +0000 (09:49 +0000)
committerAram Sargsyan <aram@isc.org>
Wed, 25 Sep 2024 08:02:17 +0000 (08:02 +0000)
Check that with a preexisting dump file without a write permission
no actual dump happens, and rndc returns an error result.

Also add a couple of missing entries in the cleaning script.

bin/tests/system/rndc/clean.sh
bin/tests/system/rndc/tests.sh

index 6b4f2fd894768b51b8b108729f5edfabbdc6b028..3b959f5a9ff99d72a756f5827648aac9c17b3916 100644 (file)
@@ -18,6 +18,7 @@ rm -f ns*/named.conf
 rm -f ns*/named.memstats
 rm -f ns*/named.run ns*/named.run.prev
 rm -f ns2/named.stats
+rm -f ns2/named_dump.db*
 rm -f ns2/nil.db ns2/other.db ns2/static.db ns2/*.jnl
 rm -f ns2/secondkey.conf
 rm -f ns2/session.key
@@ -29,5 +30,7 @@ rm -f ns6/huge.zone.db
 rm -f ns7/include.db ns7/test.db ns7/*.jnl
 rm -f ns7/named_dump.db*
 rm -f nsupdate.out.*.test*
+rm -f nsupdate.out.test*
 rm -f python.out.*.test*
 rm -f rndc.out.*.test*
+rm -f rndc.out.test*
index ee9bd1c6b563b26545850b54890ed10411adfcb0..81f05a8cc7eac6032fecc7f46fef4c6b4232b588 100644 (file)
@@ -324,6 +324,16 @@ $RNDC -s 10.53.0.2 -p ${CONTROLPORT} -c ns2/secondkey.conf status >/dev/null ||
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
+n=$((n + 1))
+echo_i "test 'rndc dumpdb' with an unwritable dump-file ($n)"
+ret=0
+touch ns2/named_dump.db
+chmod -w ns2/named_dump.db
+rndc_dumpdb ns2 2>/dev/null && ret=1
+grep -F "failed: permission denied" "rndc.out.test$n" >/dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status + ret))
+
 n=$((n + 1))
 echo_i "test 'rndc dumpdb' on a empty cache ($n)"
 ret=0