diff --git a/bin/tests/system/checkconf/tests.sh b/bin/tests/system/checkconf/tests.sh index 795ab56d57..63052e3e21 100644 --- a/bin/tests/system/checkconf/tests.sh +++ b/bin/tests/system/checkconf/tests.sh @@ -75,6 +75,15 @@ EOF $CHECKCONF badzero.conf > /dev/null 2>&1 [ $? -eq 1 ] || { echo "I: view $field failed" ; ret=1; } cat > badzero.conf << EOF +options { + $field 0; +}; +view dummy { +}; +EOF + $CHECKCONF badzero.conf > /dev/null 2>&1 + [ $? -eq 1 ] || { echo "I: options + view $field failed" ; ret=1; } + cat > badzero.conf << EOF zone dummy { type slave; masters { 0.0.0.0; }; diff --git a/lib/bind9/check.c b/lib/bind9/check.c index e16c21d06a..886c43015b 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -2249,20 +2249,23 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, * Check that forwarding is reasonable. */ if (voptions == NULL) { - if (options != NULL) { + if (options != NULL) if (check_forward(options, NULL, logctx) != ISC_R_SUCCESS) result = ISC_R_FAILURE; - if (check_nonzero(options, logctx) != ISC_R_SUCCESS) - result = ISC_R_FAILURE; - } } else { if (check_forward(voptions, NULL, logctx) != ISC_R_SUCCESS) result = ISC_R_FAILURE; - if (check_nonzero(voptions, logctx) != ISC_R_SUCCESS) - result = ISC_R_FAILURE; } + /* + * Check non-zero options at the global and view levels. + */ + if (options != NULL && check_nonzero(options, logctx) != ISC_R_SUCCESS) + result = ISC_R_FAILURE; + if (voptions != NULL &&check_nonzero(voptions, logctx) != ISC_R_SUCCESS) + result = ISC_R_FAILURE; + /* * Check that dual-stack-servers is reasonable. */