From: Brian Wellington Date: Fri, 13 Oct 2000 21:53:17 +0000 (+0000) Subject: pullup: X-Git-Tag: v9.0.0^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87df5ce642f2daff80c5e223a856a2faa3a3e88e;p=thirdparty%2Fbind9.git pullup: 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] --- diff --git a/CHANGES b/CHANGES index 162d295c675..f18e5ed436f 100644 --- 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] diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 1891a5835e0..171b1e98be0 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -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); diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 8e10bf6be90..a537fa74e04 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -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 @@ -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); } } }