]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] allow null "file" for DLZ or alternate db zones
authorEvan Hunt <each@isc.org>
Mon, 7 Apr 2014 20:29:56 +0000 (13:29 -0700)
committerEvan Hunt <each@isc.org>
Mon, 7 Apr 2014 20:29:56 +0000 (13:29 -0700)
3803. [bug] "named-checkconf -z" incorrectly rejected zones
using alternate data sources for not having a "file"
option. [RT #35685]

CHANGES
bin/check/named-checkconf.c
bin/tests/system/checkconf/altdb.conf [new file with mode: 0644]
bin/tests/system/checkconf/altdlz.conf [new file with mode: 0644]
bin/tests/system/checkconf/good.conf
bin/tests/system/checkconf/tests.sh

diff --git a/CHANGES b/CHANGES
index 49e562b561e47704d2176f7d7112a80ab7d8c0ff..02e289ae2bd000df0830e6ea5f9f68068962febe 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+3803.  [bug]           "named-checkconf -z" incorrectly rejected zones
+                       using alternate data sources for not having a "file"
+                       option. [RT #35685]
+
 3802.  [bug]           Various header files were not being installed.
 
        --- 9.10.0rc1 released ---
index 7b7f4ea509994027c242f9de23a8c93828e5072b..e79cbc1823c198ed843e7da0baa8c82d4bd75f9c 100644 (file)
@@ -178,10 +178,12 @@ configure_zone(const char *vclass, const char *view,
        const char *zname;
        const char *zfile = NULL;
        const cfg_obj_t *maps[4];
+       const cfg_obj_t *mastersobj = NULL;
        const cfg_obj_t *zoptions = NULL;
        const cfg_obj_t *classobj = NULL;
        const cfg_obj_t *typeobj = NULL;
        const cfg_obj_t *fileobj = NULL;
+       const cfg_obj_t *dlzobj = NULL;
        const cfg_obj_t *dbobj = NULL;
        const cfg_obj_t *obj = NULL;
        const cfg_obj_t *fmtobj = NULL;
@@ -212,6 +214,19 @@ configure_zone(const char *vclass, const char *view,
        if (typeobj == NULL)
                return (ISC_R_FAILURE);
 
+       /*
+        * Skip checks when using an alternate data source.
+        */
+       cfg_map_get(zoptions, "database", &dbobj);
+       if (dbobj != NULL &&
+           strcmp("rbt", cfg_obj_asstring(dbobj)) != 0 &&
+           strcmp("rbt64", cfg_obj_asstring(dbobj)) != 0)
+               return (ISC_R_SUCCESS);
+
+       cfg_map_get(zoptions, "dlz", &dlzobj);
+       if (dlzobj != NULL)
+               return (ISC_R_SUCCESS);
+
        cfg_map_get(zoptions, "file", &fileobj);
        if (fileobj != NULL)
                zfile = cfg_obj_asstring(fileobj);
@@ -227,13 +242,18 @@ configure_zone(const char *vclass, const char *view,
                  (strcasecmp(cfg_obj_asstring(typeobj), "redirect") != 0))
                return (ISC_R_SUCCESS);
 
+       /*
+        * Is the redirect zone configured as a slave?
+        */
+       if (strcasecmp(cfg_obj_asstring(typeobj), "redirect") == 0) {
+               cfg_map_get(zoptions, "masters", &mastersobj);
+               if (mastersobj != NULL)
+                       return (ISC_R_SUCCESS);
+       }
+
        if (zfile == NULL)
                return (ISC_R_FAILURE);
 
-       cfg_map_get(zoptions, "database", &dbobj);
-       if (dbobj != NULL)
-               return (ISC_R_SUCCESS);
-
        obj = NULL;
        if (get_maps(maps, "check-dup-records", &obj)) {
                if (strcasecmp(cfg_obj_asstring(obj), "warn") == 0) {
diff --git a/bin/tests/system/checkconf/altdb.conf b/bin/tests/system/checkconf/altdb.conf
new file mode 100644 (file)
index 0000000..5c3a806
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+view override_bind chaos {
+       zone "version.bind" chaos {
+               type master;
+               database "_builtin version";
+       };
+};
diff --git a/bin/tests/system/checkconf/altdlz.conf b/bin/tests/system/checkconf/altdlz.conf
new file mode 100644 (file)
index 0000000..2f663da
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+dlz external {
+       database "dlopen driver.so";
+       search no;
+};
+
+zone "example.com" {
+       type master;
+       dlz external;
+};
index 71911ca1e7ed14c67699e24ecc22d13d0d0b6309..be652696b015ccd4180231c777e0f9b3e3cd585b 100644 (file)
@@ -108,6 +108,12 @@ view "second" {
        zone "clone" {
                in-view "first";
        };
+       zone "." {
+               type redirect;
+               masters {
+                       1.2.3.4 ;
+               };
+       };
        dnssec-lookaside "." trust-anchor "dlv.isc.org.";
        dnssec-validation auto;
        zone-statistics full;
@@ -132,6 +138,12 @@ view "third" {
                "any";
        };
 };
+view "chaos" chaos {
+       zone "hostname.bind" chaos {
+               type master;
+               database "_builtin hostname";
+       };
+};
 key "mykey" {
        algorithm "hmac-md5";
        secret "qwertyuiopasdfgh";
index 634c28cc0bfa7ce146b04063b4e8a9d2858e15ce..f3d87f09813a034e0e76eefb8642263353e3e52f 100644 (file)
@@ -179,5 +179,17 @@ $CHECKCONF -z max-ttl-bad.conf > /dev/null 2>&1 && ret=1
 if [ $ret != 0 ]; then echo "I:failed"; ret=1; fi
 status=`expr $status + $ret`
 
+echo "I: checking that named-checkconf -z skips zone check with alternate databases"
+ret=0
+$CHECKCONF -z altdb.conf > /dev/null 2>&1 || ret=1
+if [ $ret != 0 ]; then echo "I:failed"; ret=1; fi
+status=`expr $status + $ret`
+
+echo "I: checking that named-checkconf -z skips zone check with DLZ"
+ret=0
+$CHECKCONF -z altdlz.conf > /dev/null 2>&1 || ret=1
+if [ $ret != 0 ]; then echo "I:failed"; ret=1; fi
+status=`expr $status + $ret`
+
 echo "I:exit status: $status"
 exit $status