2649. [bug] Set the domain for forward only zones. [RT #19944]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: resolver.c,v 1.403 2009/07/13 06:24:27 marka Exp $ */
|
||||
/* $Id: resolver.c,v 1.404 2009/08/13 04:33:51 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -2530,6 +2530,16 @@ findname(fetchctx_t *fctx, dns_name_t *name, in_port_t port,
|
||||
}
|
||||
}
|
||||
|
||||
static isc_boolean_t
|
||||
isstrictsubdomain(dns_name_t *name1, dns_name_t *name2) {
|
||||
int order;
|
||||
unsigned int nlabels;
|
||||
dns_namereln_t namereln;
|
||||
|
||||
namereln = dns_name_fullcompare(name1, name2, &order, &nlabels);
|
||||
return (ISC_TF(namereln == dns_namereln_subdomain));
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
fctx_getaddresses(fetchctx_t *fctx) {
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
@@ -2575,6 +2585,8 @@ fctx_getaddresses(fetchctx_t *fctx) {
|
||||
dns_name_t *name = &fctx->name;
|
||||
dns_name_t suffix;
|
||||
unsigned int labels;
|
||||
dns_fixedname_t fixed;
|
||||
dns_name_t *domain;
|
||||
|
||||
/*
|
||||
* DS records are found in the parent server.
|
||||
@@ -2587,11 +2599,26 @@ fctx_getaddresses(fetchctx_t *fctx) {
|
||||
dns_name_getlabelsequence(name, 1, labels - 1, &suffix);
|
||||
name = &suffix;
|
||||
}
|
||||
result = dns_fwdtable_find(fctx->res->view->fwdtable, name,
|
||||
&forwarders);
|
||||
|
||||
dns_fixedname_init(&fixed);
|
||||
domain = dns_fixedname_name(&fixed);
|
||||
result = dns_fwdtable_find2(fctx->res->view->fwdtable, name,
|
||||
domain, &forwarders);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
sa = ISC_LIST_HEAD(forwarders->addrs);
|
||||
fctx->fwdpolicy = forwarders->fwdpolicy;
|
||||
if (fctx->fwdpolicy == dns_fwdpolicy_only &&
|
||||
isstrictsubdomain(domain, &fctx->domain)) {
|
||||
isc_mem_t *mctx;
|
||||
|
||||
mctx = res->buckets[fctx->bucketnum].mctx;
|
||||
dns_name_free(&fctx->domain, mctx);
|
||||
dns_name_init(&fctx->domain, NULL);
|
||||
result = dns_name_dup(domain, mctx,
|
||||
&fctx->domain);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user