]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix checkconf dnssec-policy inheritance bug
authorMatthijs Mekking <matthijs@isc.org>
Fri, 18 Jun 2021 09:00:23 +0000 (11:00 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Thu, 24 Jun 2021 07:31:59 +0000 (09:31 +0200)
Similar to #2778, the check for 'dnssec-policy' failed to account for
it being inheritable.

bin/tests/system/checkconf/bad-kasp-policy-undefined-inherited-view.conf [new file with mode: 0644]
bin/tests/system/checkconf/bad-kasp-policy-undefined-inherited.conf [new file with mode: 0644]
bin/tests/system/checkconf/good.conf
lib/bind9/check.c

diff --git a/bin/tests/system/checkconf/bad-kasp-policy-undefined-inherited-view.conf b/bin/tests/system/checkconf/bad-kasp-policy-undefined-inherited-view.conf
new file mode 100644 (file)
index 0000000..fec6b81
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+/*
+ * The dnssec-policy is not defined. Should also be caught if it is inherited.
+ */
+
+view "test" {
+       dnssec-policy "notdefined";
+
+       zone "example.net" {
+               type primary;
+               file "example.db";
+       };
+};
diff --git a/bin/tests/system/checkconf/bad-kasp-policy-undefined-inherited.conf b/bin/tests/system/checkconf/bad-kasp-policy-undefined-inherited.conf
new file mode 100644 (file)
index 0000000..62614fc
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+/*
+ * The dnssec-policy is not defined. Should also be caught if it is inherited.
+ */
+
+options {
+       dnssec-policy "notdefined";
+};
+
+zone "example.net" {
+       type primary;
+       file "example.db";
+};
index 6b950996ccf6b75f91431d5c7d2f8acb5b391b50..d3f00397669ad084105d3d4a1c508ec4a1572a87 100644 (file)
@@ -158,7 +158,7 @@ view "third" {
                allow-update {
                        "any";
                };
-               auto-dnssec maintain;
+               dnssec-policy "default";
        };
        zone "p" {
                type primary;
index 728adec4404d44289694f469d70c5c71cfdf651d..02ed0f41209ec2eb8535c5bc8a8819e61fa7e36f 100644 (file)
@@ -2636,6 +2636,12 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
         */
        obj = NULL;
        (void)cfg_map_get(zoptions, "dnssec-policy", &obj);
+       if (obj == NULL && voptions != NULL) {
+               (void)cfg_map_get(voptions, "dnssec-policy", &obj);
+       }
+       if (obj == NULL && goptions != NULL) {
+               (void)cfg_map_get(goptions, "dnssec-policy", &obj);
+       }
        if (obj != NULL) {
                const cfg_obj_t *kasps = NULL;