]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
"rndc freeze" could trigger an assertion in named when called on a
authorEvan Hunt <each@isc.org>
Tue, 13 May 2008 01:20:24 +0000 (01:20 +0000)
committerEvan Hunt <each@isc.org>
Tue, 13 May 2008 01:20:24 +0000 (01:20 +0000)
nonexistent zone. [rt18050]

CHANGES
lib/dns/view.c

diff --git a/CHANGES b/CHANGES
index bb524883f81b0ff9f37787e2ee9df343b164afe4..68267b0232d49421b72682d6e3fd5e54a7841b03 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2370.   [bug]           "rndc freeze" could trigger an assertion in named
+                        when called on a nonexistent zone. [RT #18050]
+
 2369.  [bug]           libbind: Array bounds overrun on read in bitncmp().
                        [RT #18054]
 
index cd740c79efa6bd2158c6fb7b3fbda9fcf1fa7fa8..ba8124b790d7e53560d30e2d1fc463cec9606500 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: view.c,v 1.146 2008/04/03 05:55:52 marka Exp $ */
+/* $Id: view.c,v 1.147 2008/05/13 01:20:24 each Exp $ */
 
 /*! \file */
 
@@ -1161,6 +1161,7 @@ dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name,
        dns_view_t *view;
        isc_result_t result;
        dns_zone_t *zone1 = NULL, *zone2 = NULL;
+       dns_zone_t **zp = NULL;;
 
        REQUIRE(list != NULL);
        for (view = ISC_LIST_HEAD(*list);
@@ -1168,9 +1169,23 @@ dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name,
             view = ISC_LIST_NEXT(view, link)) {
                if (allclasses == ISC_FALSE && view->rdclass != rdclass)
                        continue;
-               result = dns_zt_find(view->zonetable, name, 0, NULL,
-                                   (zone1 == NULL) ? &zone1 : &zone2);
-               INSIST(result == ISC_R_SUCCESS || result == ISC_R_NOTFOUND);
+
+               /*
+                * If the zone is defined in more than one view, 
+                * treat it as not found.
+                */
+               zp = (zone1 == NULL) ? &zone1 : &zone2;
+               result = dns_zt_find(view->zonetable, name, 0, NULL, zp);
+               INSIST(result == ISC_R_SUCCESS ||
+                      result == ISC_R_NOTFOUND ||
+                      result == DNS_R_PARTIALMATCH);
+
+               /* Treat a partial match as no match */
+               if (result == DNS_R_PARTIALMATCH) {
+                       dns_zone_detach(zp);
+                       result = ISC_R_NOTFOUND;
+               }
+
                if (zone2 != NULL) {
                        dns_zone_detach(&zone1);
                        dns_zone_detach(&zone2);