mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
[9.18] fix: usr: Yaml string not terminated in negative response in delv
Closes #5098 Backport of MR !9922 Merge branch 'backport-5098-missing-yaml-string-termination-delv-9.18' into 'bind-9.18' See merge request isc-projects/bind9!9980
This commit is contained in:
commit
132947c0ba
2 changed files with 45 additions and 4 deletions
|
|
@ -919,7 +919,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
|
||||
|
|
@ -1397,7 +1397,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
|
||||
|
|
@ -1412,6 +1412,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
|
||||
[ "$value" = "ncache nxrrset" ] || ret=1
|
||||
$PYTHON yamlget.py delv.out.test$n query_name >yamlget.out.test$n 2>&1 || ret=1
|
||||
read -r value <yamlget.out.test$n
|
||||
[ "$value" = "ns2.example" ] || ret=1
|
||||
$PYTHON yamlget.py delv.out.test$n records 0 negative_response_answer_not_validated 0 >yamlget.out.test$n 2>&1 || ret=1
|
||||
read -r value <yamlget.out.test$n
|
||||
count=$(echo $value | wc -w)
|
||||
[ ${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 NXDOMAIN output ($n)"
|
||||
ret=0
|
||||
delv_with_opts +yaml @10.53.0.3 a this-does-not-exist.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
|
||||
[ "$value" = "ncache nxdomain" ] || ret=1
|
||||
$PYTHON yamlget.py delv.out.test$n query_name >yamlget.out.test$n 2>&1 || ret=1
|
||||
read -r value <yamlget.out.test$n
|
||||
[ "$value" = "this-does-not-exist.ns2.example" ] || ret=1
|
||||
$PYTHON yamlget.py delv.out.test$n records 0 negative_response_answer_not_validated 0 >yamlget.out.test$n 2>&1 || ret=1
|
||||
read -r value <yamlget.out.test$n
|
||||
count=$(echo $value | wc -w)
|
||||
[ ${count:-0} -eq 5 ] || ret=1
|
||||
if [ $ret -ne 0 ]; then echo_i "failed"; fi
|
||||
status=$((status + ret))
|
||||
fi
|
||||
else
|
||||
echo_i "$DELV is needed, so skipping these delv tests"
|
||||
|
|
|
|||
|
|
@ -766,10 +766,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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue