]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorBrian Wellington <source@isc.org>
Fri, 13 Oct 2000 21:53:17 +0000 (21:53 +0000)
committerBrian Wellington <source@isc.org>
Fri, 13 Oct 2000 21:53:17 +0000 (21:53 +0000)
 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. [RT #399]

 517.   [bug]           The resolver's DNAME code would trigger an assertion
                        if there was more than one DNAME in the chain.
                        [RT #399]

 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. [RT #399]

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

diff --git a/CHANGES b/CHANGES
index 162d295c6758fdaf28359f6f7428cc4b7aea254b..f18e5ed436ffee34d391b0f9eeece97ab24f116c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,16 @@
+ 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. [RT #399]
+
+ 517.  [bug]           The resolver's DNAME code would trigger an assertion
+                       if there was more than one DNAME in the chain.
+                       [RT #399]
+
+ 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. [RT #399]
+
  511.  [bug]           The message code could throw an assertion on an
                        out of memory failure. [RT #392]
 
index 1891a5835e022c96f695f543805d10d648e8107a..171b1e98be0977850ff780d216fbb6a1c1321426 100644 (file)
@@ -15,7 +15,7 @@
  * SOFTWARE.
  */
 
-/* $Id: rbtdb.c,v 1.108.2.3 2000/09/12 19:16:00 gson Exp $ */
+/* $Id: rbtdb.c,v 1.108.2.4 2000/10/13 21:53:15 bwelling Exp $ */
 
 /*
  * Principal Author: Bob Halley
@@ -2492,7 +2492,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 8e10bf6be9011338eb355aa413e2a2778f2a05a7..a537fa74e04be05f22180458735dc91e26679360 100644 (file)
@@ -15,7 +15,7 @@
  * SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.137.2.9 2000/07/28 22:45:52 gson Exp $ */
+/* $Id: resolver.c,v 1.137.2.10 2000/10/13 21:53:17 bwelling Exp $ */
 
 #include <config.h>
 
@@ -3077,16 +3077,15 @@ dname_target(dns_rdataset_t *rdataset, dns_name_t *qname, dns_name_t *oname,
        isc_result_t result;
        dns_rdata_t rdata;
        isc_region_t r;
-       dns_name_t *dname, tname;
+       dns_name_t tname;
        unsigned int nlabels, nbits;
        int order;
        dns_namereln_t namereln;
+       dns_fixedname_t prefix;
 
        /*
         * Get the target name of the DNAME.
         */
-       dns_fixedname_init(fixeddname);
-       dname = dns_fixedname_name(fixeddname);
 
        result = dns_rdataset_first(rdataset);
        if (result != ISC_R_SUCCESS)
@@ -3103,11 +3102,14 @@ dname_target(dns_rdataset_t *rdataset, dns_name_t *qname, dns_name_t *oname,
                                        &nbits);
        if (namereln != dns_namereln_subdomain)
                return (DNS_R_FORMERR);
-       result = dns_name_split(qname, nlabels, nbits, dname, NULL);
+       dns_fixedname_init(&prefix);
+       result = dns_name_split(qname, nlabels, nbits, 
+                               dns_fixedname_name(&prefix), NULL);
        if (result != ISC_R_SUCCESS)
                return (result);
-
-       return (dns_name_concatenate(dname, &tname, dname, NULL));
+       dns_fixedname_init(fixeddname);
+       return (dns_name_concatenate(dns_fixedname_name(&prefix), &tname,
+                                    dns_fixedname_name(fixeddname), NULL));
 }
 
 static isc_result_t
@@ -3344,7 +3346,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");
 
@@ -3568,6 +3570,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;
@@ -3583,11 +3588,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);
                                        }
                                }
                        }