]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3385. [bug] named-checkconf didn't detect missing master lists
authorMark Andrews <marka@isc.org>
Tue, 2 Oct 2012 03:06:02 +0000 (13:06 +1000)
committerMark Andrews <marka@isc.org>
Tue, 2 Oct 2012 03:06:02 +0000 (13:06 +1000)
                        in also-notify clauses. [RT #30810]

CHANGES
bin/tests/system/checkconf/bad-also-notify.conf [new file with mode: 0644]
bin/tests/system/checkconf/bad-many.conf [moved from bin/tests/system/checkconf/bad.conf with 100% similarity]
bin/tests/system/checkconf/bad-tsig.conf [moved from bin/tests/system/checkconf/badtsig.conf with 100% similarity]
bin/tests/system/checkconf/tests.sh
lib/bind9/check.c
lib/dns/masterdump.c
util/copyrights

diff --git a/CHANGES b/CHANGES
index 4db4d2f5f52aaf2cb65fef6914c9bbeb3245d7e7..11f986c3d17326ef683a6a66846b93aeb03d4e26 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3385.  [bug]           named-checkconf didn't detect missing master lists
+                       in also-notify clauses. [RT #30810]
+
 3384.  [bug]           Improved logging of crypto errors. [RT #30963]
 
 3383.  [security]      A certain combination of records in the RBT could
diff --git a/bin/tests/system/checkconf/bad-also-notify.conf b/bin/tests/system/checkconf/bad-also-notify.conf
new file mode 100644 (file)
index 0000000..794be96
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2012  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.
+ */
+
+/*
+ * Missing master in also-notify clause.
+ */
+
+zone dummy {
+       type master;
+       file "xxxx";
+       also-notify { xxxx; };
+};
index 63052e3e215e3754bdcf581c79a7ec1d1d097793..e506da5595321aa2f72312269c0ac5d9a4086615 100644 (file)
@@ -34,17 +34,14 @@ cmp good.conf.in good.conf.out || ret=1
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
-echo "I: checking that named-checkconf handles a known bad config"
-ret=0
-$CHECKCONF bad.conf > /dev/null 2>&1 && ret=1
-if [ $? != 1 ]; then echo "I:failed"; ret=1; fi
-status=`expr $status + $ret`
-
-echo "I: checking that named-checkconf handles a known bad tsig secret"
-ret=0
-$CHECKCONF badtsig.conf > /dev/null 2>&1
-if [ $? != 1 ]; then echo "I:failed"; ret=1; fi
-status=`expr $status + $ret`
+for bad in bad*.conf
+do
+       ret=0
+       echo "I: checking that named-checkconf detects error in $bad"
+       $CHECKCONF $bad > /dev/null 2>&1
+       if [ $? != 1 ]; then echo "I:failed"; ret=1; fi
+       status=`expr $status + $ret`
+done
 
 echo "I: checking named-checkconf dnssec warnings"
 ret=0
index 886c43015b68c9bb22c19d5a416a66a0913248d8..9a14bfe86db5f2ca0bdad54f36d734266025da69 100644 (file)
@@ -1548,6 +1548,21 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
 
        }
 
+       /*
+        * Master & slave zones must have a "also-notify" field.
+        */
+       if (ztype == MASTERZONE || ztype == SLAVEZONE ) {
+               obj = NULL;
+               tresult = cfg_map_get(zoptions, "also-notify", &obj);
+               if (tresult == ISC_R_SUCCESS) {
+                       isc_uint32_t count;
+                       tresult = validate_masters(obj, config, &count,
+                                                  logctx, mctx);
+                       if (tresult != ISC_R_SUCCESS && result == ISC_R_SUCCESS)
+                               result = tresult;
+               }
+       }
+
        /*
         * Slave & stub zones must have a "masters" field.
         */
index e66b34dc227154c1f723743095ee4468cc8520e9..42ba1f5fa40bca9945035294dc4411e559250c2e 100644 (file)
@@ -1492,7 +1492,7 @@ dumptostreaminc(dns_dumpctx_t *dctx) {
                }
 
                result = dns_dbiterator_first(dctx->dbiter);
-               if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE)
+               if (result != ISC_R_SUCCESS)
                        goto cleanup;
 
                dctx->first = ISC_FALSE;
index 9bffd608ffdd7de789d8638cebee55b9b3150543..d40b3d6b618d030877c35d01eeb4191bb01e743d 100644 (file)
 ./bin/tests/system/cacheclean/ns1/named.conf   CONF-C  2001,2004,2005,2007,2011
 ./bin/tests/system/cacheclean/ns2/named.conf   CONF-C  2001,2004,2005,2007,2011
 ./bin/tests/system/cacheclean/tests.sh         SH      2001,2004,2007,2011,2012
-./bin/tests/system/checkconf/bad.conf          CONF-C  2005,2007
-./bin/tests/system/checkconf/badtsig.conf      CONF-C  2012
+./bin/tests/system/checkconf/bad-also-notify.conf      CONF-C  2012
+./bin/tests/system/checkconf/bad-many.conf     CONF-C  2005,2012
+./bin/tests/system/checkconf/bad-tsig.conf     CONF-C  2012
 ./bin/tests/system/checkconf/clean.sh          SH      2011,2012
 ./bin/tests/system/checkconf/dnssec.1          CONF-C  2011
 ./bin/tests/system/checkconf/dnssec.2          CONF-C  2011