diff --git a/CHANGES b/CHANGES index 74e0e9dc26..f149355681 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,9 @@ + 744. [bug] When returning DNS_R_CNAME or DNS_R_DNAME as the + result of an ANY or SIG query, the resolver failed + to setup the return event's rdatasets, causing an + assertion failure in the query code. [RT #881] + 743. [bug] Receiving a large number of certain malformed answers could cause named to stop responding. [RT #861] diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h index 9a9cad069d..5b25e6e2e8 100644 --- a/lib/dns/include/dns/name.h +++ b/lib/dns/include/dns/name.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.h,v 1.90 2001/02/02 22:08:27 gson Exp $ */ +/* $Id: name.h,v 1.91 2001/02/19 08:54:54 halley Exp $ */ #ifndef DNS_NAME_H #define DNS_NAME_H 1 @@ -207,8 +207,7 @@ struct dns_name { #define DNS_NAMEATTR_CACHE 0x0100 /* Used by resolver. */ #define DNS_NAMEATTR_ANSWER 0x0200 /* Used by resolver. */ #define DNS_NAMEATTR_NCACHE 0x0400 /* Used by resolver. */ -#define DNS_NAMEATTR_CNAME 0x0800 /* Used by message. */ -#define DNS_NAMEATTR_DNAME 0x1000 /* Used by message. */ +#define DNS_NAMEATTR_CHAINING 0x0800 /* Used by resolver. */ extern dns_name_t *dns_rootname; extern dns_name_t *dns_wildcardname; diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 7fc81b7eeb..fc6c075a98 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: resolver.c,v 1.202 2001/02/18 21:19:43 bwelling Exp $ */ +/* $Id: resolver.c,v 1.203 2001/02/19 08:54:52 halley Exp $ */ #include @@ -2670,8 +2670,16 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, isc_stdtime_t now) { if (result != ISC_R_SUCCESS) return (result); anodep = &event->node; - if (fctx->type != dns_rdatatype_any && - fctx->type != dns_rdatatype_sig) { + /* + * If this is an ANY or SIG query, we're not going + * to return any rdatasets, unless we encountered + * a CNAME or DNAME as "the answer". In this case, + * we're going to return DNS_R_CNAME or DNS_R_DNAME + * and we must set up the rdatasets. + */ + if ((fctx->type != dns_rdatatype_any && + fctx->type != dns_rdatatype_sig) || + (name->attributes & DNS_NAMEATTR_CHAINING) != 0) { ardataset = event->rdataset; asigrdataset = event->sigrdataset; } @@ -3699,6 +3707,8 @@ answer_response(fetchctx_t *fctx) { */ if (want_chaining) { chaining = ISC_TRUE; + name->attributes |= + DNS_NAMEATTR_CHAINING; rdataset->attributes |= DNS_RDATASETATTR_CHAINING; qname = &tname; @@ -3810,6 +3820,8 @@ answer_response(fetchctx_t *fctx) { if (result != ISC_R_SUCCESS) return (result); chaining = ISC_TRUE; + name->attributes |= + DNS_NAMEATTR_CHAINING; rdataset->attributes |= DNS_RDATASETATTR_CHAINING; qname = dns_fixedname_name(