]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4031. [bug] named-checkconf -z failed to report a missing file
authorMark Andrews <marka@isc.org>
Thu, 8 Jan 2015 08:19:12 +0000 (19:19 +1100)
committerMark Andrews <marka@isc.org>
Thu, 8 Jan 2015 08:19:12 +0000 (19:19 +1100)
                        with a hint zone. [RT #38294]

CHANGES
bin/named/server.c
bin/tests/system/checkconf/tests.sh
lib/dns/rootns.c

diff --git a/CHANGES b/CHANGES
index f0c22752abeffe366fdaf79a9555b3ee62ed59b5..81eed774dba3262282b527aec34a85893e18b00e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4031.  [bug]           named-checkconf -z failed to report a missing file
+                       with a hint zone. [RT #38294]
+
 4030.  [func]          "rndc delzone" is now applicable to zones that were
                        configured in named.conf, as well as zones that
                        were added via "rndc addzone". (Note, however, that
index 2b7a9e1d10abc528b7bb25264cec48accf26302f..2167009a70abc5a35b4ab8cb439f997668d132cf 100644 (file)
@@ -4331,16 +4331,8 @@ configure_zone(const cfg_obj_t *config, const cfg_obj_t *zconfig,
                if (dns_name_equal(origin, dns_rootname)) {
                        const char *hintsfile = cfg_obj_asstring(fileobj);
 
-                       result = configure_hints(view, hintsfile);
-                       if (result != ISC_R_SUCCESS) {
-                               isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
-                                             NS_LOGMODULE_SERVER,
-                                             ISC_LOG_ERROR,
-                                             "could not configure root hints "
-                                             "from '%s': %s", hintsfile,
-                                             isc_result_totext(result));
-                               goto cleanup;
-                       }
+                       CHECK(configure_hints(view, hintsfile));
+
                        /*
                         * Hint zones may also refer to delegation only points.
                         */
index 69cd2b63d534b20f40c2306b8a6b1230afbecd80..17b6827a41a59388ce3c1392a1aa97f65a932d58 100644 (file)
@@ -53,7 +53,8 @@ done
 
 echo "I: checking that named-checkconf -z catches missing hint file"
 ret=0
-$CHECKCONF -z hint-nofile.conf > /dev/null 2>&1 && ret=1
+$CHECKCONF -z hint-nofile.conf > hint-nofile.out 2>&1 && ret=1
+grep "could not configure root hints from 'nonexistent.db': file not found" hint-nofile.out > /dev/null || ret=1
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
index 8470b3ba4c6c81927899df0a9e6dd395294ddd6b..bf2ae9b5ea17d73997dae9c012729e93029d02ad 100644 (file)
@@ -211,7 +211,7 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
        result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
                               rdclass, 0, NULL, &db);
        if (result != ISC_R_SUCCESS)
-               return (result);
+               goto failure;
 
        len = strlen(root_ns);
        isc_buffer_init(&source, root_ns, len);
@@ -220,7 +220,7 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
        dns_rdatacallbacks_init(&callbacks);
        result = dns_db_beginload(db, &callbacks);
        if (result != ISC_R_SUCCESS)
-               return (result);
+               goto failure;
        if (filename != NULL) {
                /*
                 * Load the hints from the specified filename.
@@ -243,7 +243,7 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
        if (result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE)
                result = eresult;
        if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
-               goto db_detach;
+               goto failure;
        if (check_hints(db) != ISC_R_SUCCESS)
                isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
                              DNS_LOGMODULE_HINTS, ISC_LOG_WARNING,
@@ -252,8 +252,14 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
        *target = db;
        return (ISC_R_SUCCESS);
 
- db_detach:
-       dns_db_detach(&db);
+ failure:
+       isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_HINTS,
+                     ISC_LOG_ERROR, "could not configure root hints from "
+                     "'%s': %s", (filename != NULL) ? filename : "<BUILT-IN>",
+                     isc_result_totext(result));
+
+       if (db != NULL)
+               dns_db_detach(&db);
 
        return (result);
 }