]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
we didn't catch a zero option at the global level when views are active
authorMark Andrews <marka@isc.org>
Thu, 16 Aug 2012 03:53:47 +0000 (13:53 +1000)
committerMark Andrews <marka@isc.org>
Fri, 17 Aug 2012 03:56:20 +0000 (13:56 +1000)
bin/tests/system/checkconf/tests.sh
lib/bind9/check.c

index 46a2773be270206cdc2a527b57b6b6ce43d00d76..cc5db0439edb2fe47d1b4ed7dfb1c43963236d2b 100644 (file)
@@ -56,6 +56,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; };
index c6fa4fca4bb727e3431ca612e82b891e180d6f9d..b43bb7076ad63dcaaa2f7635848ef63a49bcb6d2 100644 (file)
@@ -1787,9 +1787,15 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions,
        isc_result_t result = ISC_R_SUCCESS;
        isc_result_t tresult = ISC_R_SUCCESS;
        cfg_aclconfctx_t actx;
+       const cfg_obj_t *options = NULL;
        const cfg_obj_t *obj;
        isc_boolean_t enablednssec, enablevalidation;
 
+       /*
+        * Get global options block.
+        */
+       (void)cfg_map_get(config, "options", &options);
+
        /*
         * Check that all zone statements are syntactically correct and
         * there are no duplicate zones.
@@ -1825,28 +1831,27 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions,
         * Check that forwarding is reasonable.
         */
        if (voptions == NULL) {
-               const cfg_obj_t *options = NULL;
-               (void)cfg_map_get(config, "options", &options);
-               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.
         */
        if (voptions == NULL) {
-               const cfg_obj_t *options = NULL;
-               (void)cfg_map_get(config, "options", &options);
                if (options != NULL)
                        if (check_dual_stack(options, logctx) != ISC_R_SUCCESS)
                                result = ISC_R_FAILURE;