fix: nil: Complete the fix for the import_rdataset() crash
The fix in !10172 was incomplete; there were still some code paths in the resolver that could set the dns_fetchresponse `result` field to the wrong value when the rdataset type was CNAME or DNAME. Closes #5201 Merge branch '5201-eresult-fix' into 'main' See merge request isc-projects/bind9!10178
This commit is contained in:
@@ -5659,11 +5659,24 @@ answer_response:
|
||||
* Negative results must be indicated in val->result.
|
||||
*/
|
||||
INSIST(hresp->rdataset != NULL);
|
||||
if (dns_rdataset_isassociated(hresp->rdataset) &&
|
||||
NEGATIVE(hresp->rdataset))
|
||||
{
|
||||
INSIST(eresult == DNS_R_NCACHENXDOMAIN ||
|
||||
eresult == DNS_R_NCACHENXRRSET);
|
||||
if (dns_rdataset_isassociated(hresp->rdataset)) {
|
||||
if (NEGATIVE(hresp->rdataset)) {
|
||||
INSIST(eresult == DNS_R_NCACHENXDOMAIN ||
|
||||
eresult == DNS_R_NCACHENXRRSET);
|
||||
} else if (eresult == ISC_R_SUCCESS &&
|
||||
hresp->rdataset->type != fctx->type)
|
||||
{
|
||||
switch (hresp->rdataset->type) {
|
||||
case dns_rdatatype_cname:
|
||||
eresult = DNS_R_CNAME;
|
||||
break;
|
||||
case dns_rdatatype_dname:
|
||||
eresult = DNS_R_DNAME;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hresp->result = eresult;
|
||||
@@ -6313,11 +6326,25 @@ cache_name(fetchctx_t *fctx, dns_name_t *name, dns_message_t *message,
|
||||
* Negative results must be indicated in
|
||||
* resp->result.
|
||||
*/
|
||||
if (dns_rdataset_isassociated(resp->rdataset) &&
|
||||
NEGATIVE(resp->rdataset))
|
||||
{
|
||||
INSIST(eresult == DNS_R_NCACHENXDOMAIN ||
|
||||
eresult == DNS_R_NCACHENXRRSET);
|
||||
if (dns_rdataset_isassociated(resp->rdataset)) {
|
||||
if (NEGATIVE(resp->rdataset)) {
|
||||
INSIST(eresult ==
|
||||
DNS_R_NCACHENXDOMAIN ||
|
||||
eresult == DNS_R_NCACHENXRRSET);
|
||||
} else if (eresult == ISC_R_SUCCESS &&
|
||||
resp->rdataset->type != fctx->type)
|
||||
{
|
||||
switch (resp->rdataset->type) {
|
||||
case dns_rdatatype_cname:
|
||||
eresult = DNS_R_CNAME;
|
||||
break;
|
||||
case dns_rdatatype_dname:
|
||||
eresult = DNS_R_DNAME;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
resp->result = eresult;
|
||||
if (adbp != NULL && *adbp != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user