From 89afc1138992def8d03a6cf59e3c9b4ea2185bbb Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 16 Dec 2024 09:57:30 +1100 Subject: [PATCH 1/2] Terminate yaml string after negative comment --- lib/dns/masterdump.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index db5c1a0feb..fa892c148a 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -767,10 +767,17 @@ rdataset_totext(dns_rdataset_t *rdataset, const dns_name_t *owner_name, INDENT_TO(rdata_column); if ((rdataset->attributes & DNS_RDATASETATTR_NEGATIVE) != 0) { if (NXDOMAIN(rdataset)) { - RETERR(str_totext(";-$NXDOMAIN\n", target)); + RETERR(str_totext(";-$NXDOMAIN", target)); } else { - RETERR(str_totext(";-$NXRRSET\n", target)); + RETERR(str_totext(";-$NXRRSET", target)); } + if (start != NULL) { + RETERR(yaml_stringify(target, start)); + RETERR(str_totext("'\n", target)); + } else { + RETERR(str_totext("\n", target)); + } + /* * Print a summary of the cached records which make * up the negative response. From 9c04640def525f04c0ff8a1fe796b521bb7547cb Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 16 Dec 2024 10:29:26 +1100 Subject: [PATCH 2/2] Check delv +yaml negative response output --- bin/tests/system/digdelv/tests.sh | 38 +++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index e147912a1b..e5c28faf79 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -938,7 +938,7 @@ if [ -x "$DIG" ]; then if [ $HAS_PYYAML -ne 0 ]; then n=$((n + 1)) - echo_i "check dig +yaml output ($n)" + echo_i "check dig +yaml ANY output ($n)" ret=0 dig_with_opts +qr +yaml @10.53.0.3 any ns2.example >dig.out.test$n 2>&1 || ret=1 $PYTHON yamlget.py dig.out.test$n 0 message query_message_data status >yamlget.out.test$n 2>&1 || ret=1 @@ -1430,7 +1430,7 @@ if [ -x "$DELV" ]; then if [ $HAS_PYYAML -ne 0 ]; then n=$((n + 1)) - echo_i "check delv +yaml output ($n)" + echo_i "check delv +yaml ANY output ($n)" ret=0 delv_with_opts +yaml @10.53.0.3 any ns2.example >delv.out.test$n || ret=1 $PYTHON yamlget.py delv.out.test$n status >yamlget.out.test$n 2>&1 || ret=1 @@ -1445,6 +1445,40 @@ if [ -x "$DELV" ]; then [ ${count:-0} -eq 5 ] || ret=1 if [ $ret -ne 0 ]; then echo_i "failed"; fi status=$((status + ret)) + + n=$((n + 1)) + echo_i "check delv +yaml NODATA output ($n)" + ret=0 + delv_with_opts +yaml @10.53.0.3 type500 ns2.example >delv.out.test$n || ret=1 + $PYTHON yamlget.py delv.out.test$n status >yamlget.out.test$n 2>&1 || ret=1 + read -r value yamlget.out.test$n 2>&1 || ret=1 + read -r value yamlget.out.test$n 2>&1 || ret=1 + read -r value delv.out.test$n || ret=1 + $PYTHON yamlget.py delv.out.test$n status >yamlget.out.test$n 2>&1 || ret=1 + read -r value yamlget.out.test$n 2>&1 || ret=1 + read -r value yamlget.out.test$n 2>&1 || ret=1 + read -r value