mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
simplify usage of dns_view_findzonecut()
As `dns_view_findzonecut()` only returns either ISC_R_SUCCESS or DNS_R_NXDOMAIN, and since it automatically disassociates the rdatasets in case of failure, some call sites are simplified.
This commit is contained in:
parent
0f121224ec
commit
e0d7bddc6c
4 changed files with 12 additions and 31 deletions
|
|
@ -6598,20 +6598,19 @@ tat_send(void *arg) {
|
|||
domain, &nameservers, NULL, NULL, 0, 0, 0, NULL, NULL,
|
||||
NULL, tat->loop, tat_done, tat, NULL, &tat->rdataset,
|
||||
&tat->sigrdataset, &tat->fetch);
|
||||
|
||||
/*
|
||||
* dns_resolver_createfetch() will create its own copy of
|
||||
* nameservers.
|
||||
*/
|
||||
dns_rdataset_cleanup(&nameservers);
|
||||
}
|
||||
|
||||
/*
|
||||
* 'domain' holds the dns_name_t pointer inside a dst_key_t structure.
|
||||
* dns_resolver_createfetch() creates its own copy of 'domain' if it
|
||||
* succeeds. Thus, 'domain' is not freed here.
|
||||
*
|
||||
* Even if dns_view_findzonecut() returned something else than
|
||||
* ISC_R_SUCCESS, it still could have associated 'nameservers'.
|
||||
* dns_resolver_createfetch() creates its own copy of 'nameservers' if
|
||||
* it succeeds. Thus, we need to check whether 'nameservers' is
|
||||
* associated and release it if it is.
|
||||
*/
|
||||
dns_rdataset_cleanup(&nameservers);
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
dns_view_detach(&tat->view);
|
||||
|
|
|
|||
|
|
@ -2738,12 +2738,8 @@ fetch_name(dns_adbname_t *adbname, bool start_at_zone, bool no_validation,
|
|||
DP(ENTER_LEVEL, "fetch_name: starting at zone for name %p",
|
||||
adbname);
|
||||
name = dns_fixedname_initname(&fixed);
|
||||
result = dns_view_findzonecut(adb->view, adbname->name, name,
|
||||
NULL, 0, 0, true, false,
|
||||
&rdataset, NULL);
|
||||
if (result != ISC_R_SUCCESS && result != DNS_R_HINT) {
|
||||
goto cleanup;
|
||||
}
|
||||
CHECK(dns_view_findzonecut(adb->view, adbname->name, name, NULL,
|
||||
0, 0, true, false, &rdataset, NULL));
|
||||
nameservers = &rdataset;
|
||||
options |= DNS_FETCHOPT_UNSHARED;
|
||||
} else if (adb->view->qminimization) {
|
||||
|
|
|
|||
|
|
@ -724,9 +724,9 @@ dns_view_findzonecut(dns_view_t *view, const dns_name_t *name,
|
|||
*
|
||||
* Returns:
|
||||
*
|
||||
*\li #ISC_R_SUCCESS Success.
|
||||
*
|
||||
*\li Many other results are possible.
|
||||
*\li #ISC_R_SUCCESS If a delegation is found;
|
||||
*\li #DNS_R_NXDOMAIN If no delegation is found; 'rdataset' and 'sigrdataset'
|
||||
* are disassociated.
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
|
|
|
|||
|
|
@ -4501,22 +4501,8 @@ resume_qmin(void *arg) {
|
|||
&fctx->nameservers, NULL);
|
||||
FCTXTRACEN("resume_qmin findzonecut", fname, result);
|
||||
|
||||
/*
|
||||
* DNS_R_NXDOMAIN here means we have not loaded the root zone
|
||||
* mirror yet - but DNS_R_NXDOMAIN is not a valid return value
|
||||
* when doing recursion, we need to patch it.
|
||||
*
|
||||
* CNAME or DNAME means zone were added with that record
|
||||
* after the start of a recursion. It means we do not have
|
||||
* initialized correct hevent->foundname and have to fail.
|
||||
*/
|
||||
if (result == DNS_R_NXDOMAIN || result == DNS_R_CNAME ||
|
||||
result == DNS_R_DNAME)
|
||||
{
|
||||
result = DNS_R_SERVFAIL;
|
||||
}
|
||||
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
result = DNS_R_SERVFAIL;
|
||||
goto cleanup;
|
||||
}
|
||||
fcount_decr(fctx);
|
||||
|
|
|
|||
Loading…
Reference in a new issue