]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
named-checkconf triggered a assertion when a mirror zone had a bad name
authorMark Andrews <marka@isc.org>
Fri, 14 Dec 2018 05:50:46 +0000 (16:50 +1100)
committerMark Andrews <marka@isc.org>
Thu, 20 Dec 2018 02:19:18 +0000 (13:19 +1100)
CHANGES
bin/tests/system/checkconf/bad-mirror-zonename.conf [new file with mode: 0644]
lib/bind9/check.c

diff --git a/CHANGES b/CHANGES
index cf2d9e4e4772141332a8de7048c01c6bac214582..7dd5d4288f4ef9d51d6eb473963d03ddc3a1694b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+5116.  [bug]           Named/named-checkconf triggered a assertion when
+                       a mirror zone's name is bad. [GL #778]
+
 5115.  [bug]           Allow unsupported algorithms in zone when not used for
                        signing with dnssec-signzone. [GL #783]
 
diff --git a/bin/tests/system/checkconf/bad-mirror-zonename.conf b/bin/tests/system/checkconf/bad-mirror-zonename.conf
new file mode 100644 (file)
index 0000000..3c4663e
--- /dev/null
@@ -0,0 +1,4 @@
+zone "\0example" {
+        type mirror;
+        file "example.db";
+};
index 226114322963ea6dcd8912daf4af97d38533b99d..8b14d3a3cd8640b68b5142586ec8323f326fb7bd 100644 (file)
@@ -1958,7 +1958,7 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
        unsigned int i;
        dns_rdataclass_t zclass;
        dns_fixedname_t fixedname;
-       dns_name_t *zname = NULL;
+       dns_name_t *zname = NULL; /* NULL if parsing of zone name fails. */
        isc_buffer_t b;
        bool root = false;
        bool rfc1918 = false;
@@ -1977,10 +1977,10 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
        };
 
        static optionstable dialups[] = {
-       { "notify", CFG_ZONE_MASTER | CFG_ZONE_SLAVE },
-       { "notify-passive", CFG_ZONE_SLAVE },
-       { "passive", CFG_ZONE_SLAVE | CFG_ZONE_STUB },
-       { "refresh", CFG_ZONE_SLAVE | CFG_ZONE_STUB },
+               { "notify", CFG_ZONE_MASTER | CFG_ZONE_SLAVE },
+               { "notify-passive", CFG_ZONE_SLAVE },
+               { "passive", CFG_ZONE_SLAVE | CFG_ZONE_STUB },
+               { "refresh", CFG_ZONE_SLAVE | CFG_ZONE_STUB },
        };
 
        znamestr = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
@@ -2273,7 +2273,8 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
         * server list is used in the absence of one explicitly specified.
         */
        if (ztype == CFG_ZONE_SLAVE || ztype == CFG_ZONE_STUB ||
-           (ztype == CFG_ZONE_MIRROR && !dns_name_equal(zname, dns_rootname)))
+           (ztype == CFG_ZONE_MIRROR && zname != NULL &&
+            !dns_name_equal(zname, dns_rootname)))
        {
                obj = NULL;
                if (cfg_map_get(zoptions, "masters", &obj) != ISC_R_SUCCESS) {
@@ -2567,7 +2568,6 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions,
                }
        }
 
-
        /*
         * Check that max-zone-ttl isn't used with masterfile-format map
         */