From 1b138a5883912a53c556de3855d94aabc18b49e3 Mon Sep 17 00:00:00 2001 From: Tony Finch Date: Tue, 15 Oct 2019 15:36:55 +0100 Subject: [PATCH 1/2] Fix missing newlines in output of `rndc nta -dump` There were no newlines between each view in the list of negative trust anchors. (cherry picked from commit 61b245e3182a0d940295b0f45cf3dc136fa9ef8b) --- bin/named/server.c | 8 ++++++++ bin/tests/system/rndc/tests.sh | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/bin/named/server.c b/bin/named/server.c index cc874d0f20..bfe6df36c8 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15844,6 +15844,8 @@ named_server_nta(named_server_t *server, isc_lex_t *lex, bool readonly, * If -dump was specified, list NTA's and return */ if (dump) { + size_t last = 0; + for (view = ISC_LIST_HEAD(server->viewlist); view != NULL; view = ISC_LIST_NEXT(view, link)) { @@ -15855,6 +15857,12 @@ named_server_nta(named_server_t *server, isc_lex_t *lex, bool readonly, continue; } + if (last != isc_buffer_usedlength(*text)) { + CHECK(putstr(text, "\n")); + } + + last = isc_buffer_usedlength(*text); + CHECK(dns_ntatable_totext(ntatable, view->name, text)); } CHECK(putnull(text)); diff --git a/bin/tests/system/rndc/tests.sh b/bin/tests/system/rndc/tests.sh index 707c956e42..701e8591a7 100644 --- a/bin/tests/system/rndc/tests.sh +++ b/bin/tests/system/rndc/tests.sh @@ -816,5 +816,14 @@ grep 'include 2' dig.out.2.test$n >/dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) +n=$((n + 1)) +echo_i "check rndc nta -dump reports NTAs in multiple views ($n)" +ret=0 +$RNDCCMD 10.53.0.3 nta -dump >rndc.out.test$n 2>&1 || ret=1 +lines=$(cat rndc.out.test$n | wc -l) +[ ${lines:-0} -eq 2 ] || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) + echo_i "exit status: $status" [ $status -eq 0 ] || exit 1 From 9a4ccdf4fc34b4d730246678473c725b80b89851 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Wed, 1 Nov 2023 17:38:22 +0100 Subject: [PATCH 2/2] CHANGES for [GL !8454] (cherry picked from commit 37b101b6e233af37ce349d7b3d33775908650c3f) --- CHANGES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES b/CHANGES index 94edfa67bd..4ded7119d3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +6280. [bug] Fix missing newlines in the output of "rndc nta -dump". + [GL !8454] + 6277. [bug] Take into account local authoritative zones when falling back to serve-stale. [GL #4355]