Commit 8a713ca4 authored by Mark Andrews's avatar Mark Andrews
Browse files

1807. [bug] When forwarding (forward only) set the active domain

                        from the forward zone name. [RT #13526]
parent d5af5bb3
......@@ -71,7 +71,8 @@
1808. [bug] zone.c:notify_zone() contained a race condition,
zone->db could change underneath it. [RT #13511]
1807. [placeholder] rt13526
1807. [bug] When forwarding (forward only) set the active domain
from the forward zone name. [RT #13526]
1806. [bug] The resolver returned the wrong result when a CNAME /
DNAME was encountered when fetching glue from a
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: forward.c,v 1.6 2004/03/05 05:09:19 marka Exp $ */
/* $Id: forward.c,v 1.7 2005/03/16 03:50:47 marka Exp $ */
#include <config.h>
......@@ -138,6 +138,13 @@ dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name,
isc_result_t
dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
dns_forwarders_t **forwardersp)
{
return (dns_fwdtable_find2(fwdtable, name, NULL, forwardersp));
}
isc_result_t
dns_fwdtable_find2(dns_fwdtable_t *fwdtable, dns_name_t *name,
dns_name_t *foundname, dns_forwarders_t **forwardersp)
{
isc_result_t result;
......@@ -145,7 +152,7 @@ dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
result = dns_rbt_findname(fwdtable->table, name, 0, NULL,
result = dns_rbt_findname(fwdtable->table, name, 0, foundname,
(void **)forwardersp);
if (result == DNS_R_PARTIALMATCH)
result = ISC_R_SUCCESS;
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: forward.h,v 1.3 2004/03/05 05:09:42 marka Exp $ */
/* $Id: forward.h,v 1.4 2005/03/16 03:50:47 marka Exp $ */
#ifndef DNS_FORWARD_H
#define DNS_FORWARD_H 1
......@@ -67,6 +67,10 @@ dns_fwdtable_add(dns_fwdtable_t *fwdtable, dns_name_t *name,
isc_result_t
dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
dns_forwarders_t **forwardersp);
isc_result_t
dns_fwdtable_find2(dns_fwdtable_t *fwdtable, dns_name_t *name,
dns_name_t *foundname, dns_forwarders_t **forwardersp);
/*
* Finds a domain in the forwarding table. The closest matching parent
* domain is returned.
......@@ -75,6 +79,7 @@ dns_fwdtable_find(dns_fwdtable_t *fwdtable, dns_name_t *name,
* fwdtable is a valid forwarding table.
* name is a valid name
* forwardersp != NULL && *forwardersp == NULL
* foundname to be NULL or a valid name with buffer.
*
* Returns:
* ISC_R_SUCCESS
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.305 2005/03/15 01:41:28 marka Exp $ */
/* $Id: resolver.c,v 1.306 2005/03/16 03:50:47 marka Exp $ */
#include <config.h>
......@@ -2672,7 +2672,7 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
isc_result_t result = ISC_R_SUCCESS;
isc_result_t iresult;
isc_interval_t interval;
dns_fixedname_t qdomain;
dns_fixedname_t fixed;
unsigned int findoptions = 0;
char buf[DNS_NAME_FORMATSIZE + DNS_RDATATYPE_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
......@@ -2749,8 +2749,10 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
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)
fctx->fwdpolicy = forwarders->fwdpolicy;
......@@ -2762,27 +2764,22 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type,
*/
if (dns_rdatatype_atparent(type))
findoptions |= DNS_DBFIND_NOEXACT;
dns_fixedname_init(&qdomain);
result = dns_view_findzonecut(res->view, name,
dns_fixedname_name(&qdomain), 0,
findoptions, ISC_TRUE,
result = dns_view_findzonecut(res->view, name, domain,
0, findoptions, ISC_TRUE,
&fctx->nameservers,
NULL);
if (result != ISC_R_SUCCESS)
goto cleanup_name;
result = dns_name_dup(dns_fixedname_name(&qdomain),
res->mctx, &fctx->domain);
result = dns_name_dup(domain, res->mctx, &fctx->domain);
if (result != ISC_R_SUCCESS) {
dns_rdataset_disassociate(&fctx->nameservers);
goto cleanup_name;
}
} else {
/*
* We're in forward-only mode. Set the query domain
* to ".".
* We're in forward-only mode. Set the query domain.
*/
result = dns_name_dup(dns_rootname, res->mctx,
&fctx->domain);
result = dns_name_dup(domain, res->mctx, &fctx->domain);
if (result != ISC_R_SUCCESS)
goto cleanup_name;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment