]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix problems with DNAME chain processing in the resolver, and with
authorBob Halley <source@isc.org>
Fri, 13 Oct 2000 18:55:11 +0000 (18:55 +0000)
committerBob Halley <source@isc.org>
Fri, 13 Oct 2000 18:55:11 +0000 (18:55 +0000)
retrievals of DNAMEs from the cache.  (Changes 516, 517, and 518).

CHANGES
lib/dns/rbtdb.c
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index e947139357e9a70ac2cbfd11f87fc7c23332e75a..a931ada0123fc4c4ee11fc40e93f21e17ee667dc 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,15 @@
+ 518.  [bug]           The resolver did not realize that a DNAME which was
+                       "the answer" to the client's query was "the answer",
+                       and such queries would fail.
+
+ 517.  [bug]           The resolver's DNAME code would trigger an assertion
+                       if there was more than one DNAME in the chain.
+
+ 516.  [bug]           Cache lookups which had a NULL node pointer, e.g.
+                       those by dns_view_find(), and which would match a
+                       DNAME, would trigger an INSIST(!search.need_cleanup)
+                       assertion.
+
  515.  [bug]           The ssu table was not beinge attached / detached
                        by dns_zone_[sg]etssutable.  [RT#397]
 
index 9c9fd8ea146fe3eb23cd671ceca5d42c8333289d..c85214c49377338414a14fddbc6fd76f5c3b9a43 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: rbtdb.c,v 1.126 2000/09/11 16:48:25 halley Exp $ */
+/* $Id: rbtdb.c,v 1.127 2000/10/13 18:55:10 halley Exp $ */
 
 /*
  * Principal Author: Bob Halley
@@ -2478,7 +2478,20 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
  tree_exit:
        RWUNLOCK(&search.rbtdb->tree_lock, isc_rwlocktype_read);
 
-       INSIST(!search.need_cleanup);
+       /*
+        * If we found a zonecut but aren't going to use it, we have to
+        * let go of it.
+        */
+       if (search.need_cleanup) {
+               node = search.zonecut;
+
+               LOCK(&(search.rbtdb->node_locks[node->locknum].lock));
+               INSIST(node->references > 0);
+               node->references--;
+               if (node->references == 0)
+                       no_references(search.rbtdb, node, 0);
+               UNLOCK(&(search.rbtdb->node_locks[node->locknum].lock));
+       }
 
        dns_rbtnodechain_reset(&search.chain);
 
index d425e2be7e3efd05a9c4b38179585ba186833bac..dea1b8d592c3fe8639851185587c96329c06314b 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.171 2000/10/07 00:09:24 bwelling Exp $ */
+/* $Id: resolver.c,v 1.172 2000/10/13 18:55:11 halley Exp $ */
 
 #include <config.h>
 
@@ -3116,17 +3116,15 @@ dname_target(dns_rdataset_t *rdataset, dns_name_t *qname, dns_name_t *oname,
 {
        isc_result_t result;
        dns_rdata_t rdata;
-       dns_name_t *tname;
        unsigned int nlabels, nbits;
        int order;
        dns_namereln_t namereln;
        dns_rdata_dname_t dname;
+       dns_fixedname_t prefix;
 
        /*
         * Get the target name of the DNAME.
         */
-       dns_fixedname_init(fixeddname);
-       tname = dns_fixedname_name(fixeddname);
 
        result = dns_rdataset_first(rdataset);
        if (result != ISC_R_SUCCESS)
@@ -3145,13 +3143,17 @@ dname_target(dns_rdataset_t *rdataset, dns_name_t *qname, dns_name_t *oname,
                dns_rdata_freestruct(&dname);
                return (DNS_R_FORMERR);
        }
-       result = dns_name_split(qname, nlabels, nbits, tname, NULL);
+       dns_fixedname_init(&prefix);
+       result = dns_name_split(qname, nlabels, nbits,
+                               dns_fixedname_name(&prefix), NULL);
        if (result != ISC_R_SUCCESS) {
                dns_rdata_freestruct(&dname);
                return (result);
        }
-
-       result = dns_name_concatenate(tname, &dname.dname, tname, NULL);
+       dns_fixedname_init(fixeddname);
+       result = dns_name_concatenate(dns_fixedname_name(&prefix),
+                                     &dname.dname,
+                                     dns_fixedname_name(fixeddname), NULL);
        dns_rdata_freestruct(&dname);
        return (result);
 }
@@ -3390,7 +3392,7 @@ answer_response(fetchctx_t *fctx) {
        isc_boolean_t have_answer, found_cname, found_type;
        unsigned int aflag;
        dns_rdatatype_t type;
-       dns_fixedname_t dname;
+       dns_fixedname_t dname, fqname;
 
        FCTXTRACE("answer_response");
 
@@ -3614,6 +3616,9 @@ answer_response(fetchctx_t *fctx) {
                                                 * we're not chaining.
                                                 */
                                                INSIST(!external);
+                                               if (aflag ==
+                                                   DNS_RDATASETATTR_ANSWER)
+                                                       have_answer = ISC_TRUE;
                                                name->attributes |=
                                                        DNS_NAMEATTR_ANSWER;
                                                rdataset->attributes |= aflag;
@@ -3629,11 +3634,30 @@ answer_response(fetchctx_t *fctx) {
                                         * DNAME chaining.
                                         */
                                        if (want_chaining) {
+                                               /*
+                                                * Copy the the dname into the
+                                                * qname fixed name.
+                                                *
+                                                * Although we check for
+                                                * failure of the concatenate
+                                                * operation, in practice it
+                                                * should never fail since
+                                                * we already know that the
+                                                * result fits in a fixedname.
+                                                */
+                                               dns_fixedname_init(&fqname);
+                                               result = dns_name_concatenate(
+                                                 dns_fixedname_name(&dname),
+                                                 NULL,
+                                                 dns_fixedname_name(&fqname),
+                                                 NULL);
+                                               if (result != ISC_R_SUCCESS)
+                                                       return (result);
                                                chaining = ISC_TRUE;
                                                rdataset->attributes |=
                                                    DNS_RDATASETATTR_CHAINING;
                                                qname = dns_fixedname_name(
-                                                                  &dname);
+                                                                  &fqname);
                                        }
                                }
                        }