]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
enforces that catalog-zone can't be used in non IN views
authorColin Vidal <colin@isc.org>
Mon, 17 Nov 2025 16:00:27 +0000 (17:00 +0100)
committerColin Vidal <colin@isc.org>
Tue, 18 Nov 2025 09:08:42 +0000 (10:08 +0100)
Catalog-zones can't be used in view which are not from the IN class.
This is now enforced as the server won't load (instead of loading
without the catalog-zone). This configuration error is now also caught
by `named-checkconf`.

bin/named/server.c
bin/tests/system/catz/ns2/named1.conf.in
bin/tests/system/catz/ns2/named2.conf.in
bin/tests/system/catz/tests.sh
bin/tests/system/checkconf/bad-catz-class.conf [new file with mode: 0644]
bin/tests/system/checkconf/bad-chaos-catz.conf [new file with mode: 0644]
lib/isccfg/check.c

index ce1237e007fbebcc0a757eef2e829c08f2eb1d18..f06f95f7312372dc89b45e55c33d47dae3f6780e 100644 (file)
@@ -3820,18 +3820,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
        }
 
        obj = NULL;
-       if (view->rdclass != dns_rdataclass_in &&
-           named_config_get(maps, "catalog-zones", &obj) == ISC_R_SUCCESS)
-       {
-               cfg_obj_log(obj, ISC_LOG_WARNING,
-                           "'catalog-zones' option is only supported "
-                           "for views with class IN");
-       }
-
-       obj = NULL;
-       if (view->rdclass == dns_rdataclass_in &&
-           named_config_get(maps, "catalog-zones", &obj) == ISC_R_SUCCESS)
-       {
+       if (named_config_get(maps, "catalog-zones", &obj) == ISC_R_SUCCESS) {
                CHECK(configure_catz(view, NULL, config, obj));
                catz_configured = true;
        }
index 6860153a3115e2fd8a996a1b692c1eab109ad482..e35ba7917420cd8d7ce359aae4abce608c8a2207 100644 (file)
@@ -186,23 +186,6 @@ view "default" {
 
 };
 
-view "ch" ch {
-
-       catalog-zones {
-               zone "catalog-bad5.example"
-                       default-masters { 10.53.0.1; }
-                       in-memory yes;
-       };
-
-       # Non-IN class catalog zone
-       zone "catalog-bad5.example" ch {
-               type secondary;
-               file "catalog-bad5.example.db";
-               primaries { 10.53.0.1; };
-       };
-
-};
-
 key tsig_key. {
        secret "LSAnCU+Z";
        algorithm @DEFAULT_HMAC@;
index 385adf4deb2387fef7642cbb709f689f45f0c89e..82621cac1c198543a1a8dc1269249b4e8b31f7c4 100644 (file)
@@ -121,20 +121,6 @@ view "default" {
 
 };
 
-view "ch" ch {
-
-       # Removed catalog-zone option, otherwise this is
-       # identical to named1.conf.in
-
-       # Non-IN class catalog zone
-       zone "catalog-bad5.example" ch {
-               type secondary;
-               file "catalog-bad5.example.db";
-               primaries { 10.53.0.1; };
-       };
-
-};
-
 key tsig_key. {
        secret "LSAnCU+Z";
        algorithm @DEFAULT_HMAC@;
index 3ac389cf8852da25cb6b5c36ae78dffe4a2105f4..be3e3f4be9fd6b26dda9ff281408f7c8b1feb0f5 100644 (file)
@@ -116,15 +116,6 @@ wait_for_message ns2/named.run "catz: invalid record in catalog zone - version.c
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status + ret))
 
-n=$((n + 1))
-echo_i "checking that catalog-bad5.example (non-IN class) has failed to load ($n)"
-ret=0
-wait_for_message ns2/named.run "'catalog-zones' option is only supported for views with class IN" \
-  && wait_for_message ns2/named.run "all zones loaded" || ret=1
-grep -F "catz: dns_catz_zone_add catalog-bad5.example" ns2/named.run && ret=1
-if [ $ret -ne 0 ]; then echo_i "failed"; fi
-status=$((status + ret))
-
 nextpart ns2/named.run >/dev/null
 
 ##########################################################################
diff --git a/bin/tests/system/checkconf/bad-catz-class.conf b/bin/tests/system/checkconf/bad-catz-class.conf
new file mode 100644 (file)
index 0000000..af33b07
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * 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 https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+view bar ch {
+       catalog-zones {
+               zone "foo";
+       };
+
+       zone "foo" {
+               type primary;
+               file "foo";
+       };
+};
diff --git a/bin/tests/system/checkconf/bad-chaos-catz.conf b/bin/tests/system/checkconf/bad-chaos-catz.conf
new file mode 100644 (file)
index 0000000..6923a31
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * 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 https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+view "ch" ch {
+       catalog-zones {
+               zone "catalog-bad5.example" default-masters { 10.53.0.1; }
+                       in-memory yes;
+       };
+
+       # Non-IN class catalog zone
+       zone "catalog-bad5.example" ch {
+               type secondary;
+               file "catalog-bad5.example.db";
+               primaries { 10.53.0.1; };
+       };
+};
+
index c49afa9a5f492842615e3c44ebca525eeb15863f..fb1e1d92b91546106e460917ede3943dd77714f9 100644 (file)
@@ -5539,11 +5539,21 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions,
         */
        if (opts != NULL) {
                obj = NULL;
-               if ((cfg_map_get(opts, "catalog-zones", &obj) ==
-                    ISC_R_SUCCESS) &&
-                   (check_catz(obj, viewname, mctx) != ISC_R_SUCCESS))
-               {
-                       result = ISC_R_FAILURE;
+               if (cfg_map_get(opts, "catalog-zones", &obj) == ISC_R_SUCCESS) {
+                       if (vclass != dns_rdataclass_in) {
+                               cfg_obj_log(
+                                       obj, ISC_LOG_ERROR,
+                                       "'catalog-zones' option is only "
+                                       "supported for views with class IN");
+
+                               if (result == ISC_R_SUCCESS) {
+                                       result = ISC_R_FAILURE;
+                               }
+                       }
+
+                       if (check_catz(obj, viewname, mctx) != ISC_R_SUCCESS) {
+                               result = ISC_R_FAILURE;
+                       }
                }
        }