/* We don't need trust anchors for the _bind view */
if (strcmp(view->name, "_bind") == 0 &&
- view->rdclass == dns_rdataclass_chaos) {
+ view->rdclass == dns_rdataclass_chaos)
+ {
return (ISC_R_SUCCESS);
}
view != NULL;
view = ISC_LIST_NEXT(view, link))
{
- if (viewname != NULL &&
- strcmp(view->name, viewname) != 0)
+ static bool first = true;
+
+ if (viewname != NULL && strcmp(view->name, viewname) != 0) {
continue;
+ }
- if (view->nta_lifetime == 0)
+ if (view->nta_lifetime == 0) {
continue;
+ }
- if (!ttlset)
+ if (!ttlset) {
ntattl = view->nta_lifetime;
+ }
- if (ntatable != NULL)
+ if (ntatable != NULL) {
dns_ntatable_detach(&ntatable);
+ }
result = dns_view_getntatable(view, &ntatable);
if (result == ISC_R_NOTFOUND) {
isc_time_set(&t, when, 0);
isc_time_formattimestamp(&t, tbuf, sizeof(tbuf));
+ if (!first) {
+ CHECK(putstr(text, "\n"));
+ }
+ first = false;
+
CHECK(putstr(text, "Negative trust anchor added: "));
CHECK(putstr(text, namebuf));
CHECK(putstr(text, "/"));
} else {
CHECK(dns_ntatable_delete(ntatable, ntaname));
+ if (!first) {
+ CHECK(putstr(text, "\n"));
+ }
+ first = false;
+
CHECK(putstr(text, "Negative trust anchor removed: "));
CHECK(putstr(text, namebuf));
CHECK(putstr(text, "/"));
"for view '%s': %s",
view->name, isc_result_totext(result));
}
-
- CHECK(putnull(text));
-
}
+ CHECK(putnull(text));
+
cleanup:
if (msg != NULL) {
(void) putstr(text, msg);
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`
+n=`expr $n + 1`
+echo_i "check rndc nta reports adding to multiple views ($n)"
+ret=0
+$RNDCCMD 10.53.0.3 nta test.com > 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=`expr $status + $ret`
+
echo_i "exit status: $status"
[ $status -eq 0 ] || exit 1