diff --git a/CHANGES b/CHANGES index 15164c39ae..267652b394 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ + 54. [bug] If a fetch with sigrdataset==NULL joined one with + sigrdataset!=NULL or vice versa, the resolver + could catch an assertion or lose signature data, + respectively. + 53. [port] freebsd 4.0: lib/isc/unix/socket.c requires . diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 361c04201b..2d34b2640a 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -1795,8 +1795,15 @@ fctx_join(fetchctx_t *fctx, isc_task_t *task, isc_taskaction_t action, event->sigrdataset = sigrdataset; event->fetch = fetch; dns_fixedname_init(&event->foundname); - ISC_LIST_APPEND(fctx->events, event, link); + /* + * Make sure that we can store the sigrdataset in the + * first event if it is needed by any of the events. + */ + if (event->sigrdataset != NULL) + ISC_LIST_PREPEND(fctx->events, event, link); + else + ISC_LIST_APPEND(fctx->events, event, link); fctx->references++; fetch->magic = DNS_FETCH_MAGIC; @@ -2041,11 +2048,15 @@ clone_results(fetchctx_t *fctx) { event->result = hevent->result; dns_db_attach(hevent->db, &event->db); dns_db_attachnode(hevent->db, hevent->node, &event->node); - if (hevent->rdataset != NULL && - dns_rdataset_isassociated(hevent->rdataset)) + INSIST(hevent->rdataset != NULL); + INSIST(event->rdataset != NULL); + if (dns_rdataset_isassociated(hevent->rdataset)) dns_rdataset_clone(hevent->rdataset, event->rdataset); + INSIST(! (hevent->sigrdataset == NULL && + event->sigrdataset != NULL)); if (hevent->sigrdataset != NULL && - dns_rdataset_isassociated(hevent->sigrdataset)) + dns_rdataset_isassociated(hevent->sigrdataset) && + event->sigrdataset != NULL) dns_rdataset_clone(hevent->sigrdataset, event->sigrdataset); }