333. [bug] The resolver incorrectly accepted referrals to

subdomains of the query domain, causing an
                        assertion failure.
This commit is contained in:
Andreas Gustafsson 2000-07-15 01:02:25 +00:00
parent 5fff4f8a54
commit 64024eaa4d
2 changed files with 41 additions and 1 deletions

View file

@ -1,3 +1,7 @@
333. [bug] The resolver incorrectly accepted referrals to
subdomains of the query domain, causing an
assertion failure.
332. [func] New function dns_name_reset().
331. [bug] Only log "recursion denied" if RD is set. (RT #178)

View file

@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: resolver.c,v 1.147 2000/07/14 00:37:27 gson Exp $ */
/* $Id: resolver.c,v 1.148 2000/07/15 01:02:25 gson Exp $ */
#include <config.h>
@ -2982,6 +2982,31 @@ dname_target(dns_rdataset_t *rdataset, dns_name_t *qname, dns_name_t *oname,
return (dns_name_concatenate(dname, &tname, dname, NULL));
}
/* XXXAG should be public function in name.c */
static isc_boolean_t
dns_name_ispropersubdomain(const dns_name_t *name1, const dns_name_t *name2) {
int order;
unsigned int nlabels, nbits;
dns_namereln_t namereln;
/*
* Is 'name1' a proper subdomain of 'name2'?
*
* Note: It makes no sense for one of the names to be relative and the
* other absolute. If both names are relative, then to be meaningfully
* compared the caller must ensure that they are both relative to the
* same domain.
*/
namereln = dns_name_fullcompare(name1, name2, &order, &nlabels,
&nbits);
if (namereln == dns_namereln_subdomain)
return (ISC_TRUE);
return (ISC_FALSE);
}
static isc_result_t
noanswer_response(fetchctx_t *fctx, dns_name_t *oqname) {
isc_result_t result;
@ -3154,6 +3179,17 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname) {
*/
if (dns_name_equal(ns_name, &fctx->domain))
return (DNS_R_FORMERR);
/*
* If the referral name is below the query name,
* we are making too much progress, overshooting
* the target. Consider the responder insane.
*/
if (dns_name_ispropersubdomain(ns_name, &fctx->name)) {
FCTXTRACE("referral name below query name");
return (DNS_R_FORMERR);
}
/*
* Mark any additional data related to this rdataset.
* It's important that we do this before we change the