From: Mark Andrews Date: Thu, 16 Aug 2012 03:53:47 +0000 (+1000) Subject: we didn't catch a zero option at the global level when views are active X-Git-Tag: v9.10.0a1~945 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=076bda8c2e2b2f41775bd7b1694dd2cab287aeeb;p=thirdparty%2Fbind9.git we didn't catch a zero option at the global level when views are active --- diff --git a/bin/tests/system/checkconf/tests.sh b/bin/tests/system/checkconf/tests.sh index 795ab56d57b..63052e3e215 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 e16c21d06a3..886c43015b6 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. */