fix: usr: Fix the 'rndc dumpdb' command's error reporting

The 'rndc dumpdb' command wasn't reporting errors which
occurred when starting up the database dump process by named,
like, for example, a permission denied error for the
'dump-file' file. This has been fixed. Note, however, that
'rndc dumpdb' performs asynchronous writes, so errors can
also occur during the dumping process, which will not be
reported back to 'rndc', but which will still be logged by
named.

Closes #4944

Merge branch '4944-rndc-dumpdb-do-not-ignore-errors' into 'main'

See merge request isc-projects/bind9!9547
This commit is contained in:
Arаm Sаrgsyаn
2024-09-25 09:07:46 +00:00
3 changed files with 14 additions and 2 deletions

View File

@@ -214,8 +214,7 @@ named_control_docommand(isccc_sexpr_t *message, bool readonly,
{
result = named_server_dnstap(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DUMPDB)) {
named_server_dumpdb(named_g_server, lex, text);
result = ISC_R_SUCCESS;
result = named_server_dumpdb(named_g_server, lex, text);
} else if (command_compare(command, NAMED_COMMAND_DUMPSTATS)) {
result = named_server_dumpstats(named_g_server);
} else if (command_compare(command, NAMED_COMMAND_FETCHLIMIT)) {

View 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*

View 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