mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-21 14:17:27 -04:00
Fix nxdomain-redirect assertion failure
- Always set is_zonep in query_getdb; previously it was only set if
result was ISC_R_SUCCESS or ISC_R_NOTFOUND.
- Don't reset is_zone for redirect.
- Style cleanup.
(cherry picked from commit a85cc641d7a4c66cbde03cc4e31edc038a24df46)
(cherry picked from commit 486a201149)
This commit is contained in:
parent
2fbadaeec6
commit
f3d3703fe3
1 changed files with 19 additions and 13 deletions
|
|
@ -1310,7 +1310,6 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
|||
dns_dbversion_t **versionp, bool *is_zonep)
|
||||
{
|
||||
isc_result_t result;
|
||||
|
||||
isc_result_t tresult;
|
||||
unsigned int namelabels;
|
||||
unsigned int zonelabels;
|
||||
|
|
@ -1327,8 +1326,9 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
|||
dbp, versionp);
|
||||
|
||||
/* See how many labels are in the zone's name. */
|
||||
if (result == ISC_R_SUCCESS && zone != NULL)
|
||||
if (result == ISC_R_SUCCESS && zone != NULL) {
|
||||
zonelabels = dns_name_countlabels(dns_zone_getorigin(zone));
|
||||
}
|
||||
|
||||
/*
|
||||
* If # zone labels < # name labels, try to find an even better match
|
||||
|
|
@ -1395,8 +1395,11 @@ query_getdb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
|
|||
* If neither attempt above succeeded, return the cache instead
|
||||
*/
|
||||
*is_zonep = true;
|
||||
} else if (result == ISC_R_NOTFOUND) {
|
||||
result = query_getcachedb(client, name, qtype, dbp, options);
|
||||
} else {
|
||||
if (result == ISC_R_NOTFOUND) {
|
||||
result = query_getcachedb(client, name, qtype, dbp,
|
||||
options);
|
||||
}
|
||||
*is_zonep = false;
|
||||
}
|
||||
return (result);
|
||||
|
|
@ -4803,11 +4806,13 @@ redirect2(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset,
|
|||
|
||||
CTRACE(ISC_LOG_DEBUG(3), "redirect2");
|
||||
|
||||
if (client->view->redirectzone == NULL)
|
||||
if (client->view->redirectzone == NULL) {
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
if (dns_name_issubdomain(name, client->view->redirectzone))
|
||||
if (dns_name_issubdomain(name, client->view->redirectzone)) {
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
found = dns_fixedname_initname(&fixed);
|
||||
dns_rdataset_init(&trdataset);
|
||||
|
|
@ -4815,8 +4820,9 @@ redirect2(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset,
|
|||
dns_clientinfomethods_init(&cm, ns_client_sourceip);
|
||||
dns_clientinfo_init(&ci, client, NULL);
|
||||
|
||||
if (WANTDNSSEC(client) && dns_db_iszone(*dbp) && dns_db_issecure(*dbp))
|
||||
if (WANTDNSSEC(client) && dns_db_iszone(*dbp) && dns_db_issecure(*dbp)) {
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
if (WANTDNSSEC(client) && dns_rdataset_isassociated(rdataset)) {
|
||||
if (rdataset->trust == dns_trust_secure)
|
||||
|
|
@ -4853,16 +4859,19 @@ redirect2(ns_client_t *client, dns_name_t *name, dns_rdataset_t *rdataset,
|
|||
redirectname, NULL);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (ISC_R_NOTFOUND);
|
||||
} else
|
||||
} else {
|
||||
dns_name_copy(redirectname, client->view->redirectzone, NULL);
|
||||
}
|
||||
|
||||
options = 0;
|
||||
result = query_getdb(client, redirectname, qtype, options, &zone,
|
||||
&db, &version, &is_zone);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
return (ISC_R_NOTFOUND);
|
||||
if (zone != NULL)
|
||||
}
|
||||
if (zone != NULL) {
|
||||
dns_zone_detach(&zone);
|
||||
}
|
||||
|
||||
/*
|
||||
* Lookup the requested data in the redirect zone.
|
||||
|
|
@ -5520,7 +5529,6 @@ query_lookup(query_ctx_t *qctx) {
|
|||
return (ns_query_done(qctx));
|
||||
}
|
||||
}
|
||||
|
||||
return (query_gotanswer(qctx, result));
|
||||
|
||||
cleanup:
|
||||
|
|
@ -5912,7 +5920,6 @@ query_resume(query_ctx_t *qctx) {
|
|||
RESTORE(qctx->zone, qctx->client->query.redirect.zone);
|
||||
qctx->authoritative =
|
||||
qctx->client->query.redirect.authoritative;
|
||||
qctx->is_zone = qctx->client->query.redirect.is_zone;
|
||||
|
||||
/*
|
||||
* Free resources used while recursing.
|
||||
|
|
@ -6021,7 +6028,6 @@ query_resume(query_ctx_t *qctx) {
|
|||
ISC_EVENT_PTR(&qctx->event), &qctx->event);
|
||||
} else if (REDIRECT(qctx->client)) {
|
||||
result = qctx->client->query.redirect.result;
|
||||
qctx->is_zone = qctx->client->query.redirect.is_zone;
|
||||
} else {
|
||||
result = qctx->event->result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue