Commit 58cbc05e authored by Brian Wellington's avatar Brian Wellington
Browse files

Fix memory leak in dns_view_find; return DNS_R_HINTNXRRSET instead of

DNS_R_NOTFOUND when correct to do so.
parent 24dc90ef
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: adb.c,v 1.161 2000/12/20 03:38:41 bwelling Exp $ */
/* $Id: adb.c,v 1.162 2000/12/20 23:31:04 bwelling Exp $ */
/*
* Implementation notes
......@@ -423,7 +423,8 @@ static isc_result_t dbfind_a6(dns_adbname_t *, isc_stdtime_t);
#define NXDOMAIN_RESULT(r) ((r) == DNS_R_NXDOMAIN || \
(r) == DNS_R_NCACHENXDOMAIN)
#define NXRRSET_RESULT(r) ((r) == DNS_R_NCACHENXRRSET || \
(r) == DNS_R_NXRRSET)
(r) == DNS_R_NXRRSET || \
(r) == DNS_R_HINTNXRRSET)
/*
* Error state rankings.
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: result.h,v 1.75 2000/12/13 00:15:38 tale Exp $ */
/* $Id: result.h,v 1.76 2000/12/20 23:31:10 bwelling Exp $ */
#ifndef DNS_RESULT_H
#define DNS_RESULT_H 1
......@@ -109,8 +109,9 @@
#define DNS_R_METATYPE (ISC_RESULTCLASS_DNS + 70)
#define DNS_R_CNAMEANDOTHER (ISC_RESULTCLASS_DNS + 71)
#define DNS_R_SINGLETON (ISC_RESULTCLASS_DNS + 72)
#define DNS_R_HINTNXRRSET (ISC_RESULTCLASS_DNS + 73)
#define DNS_R_NRESULTS 73 /* Number of results */
#define DNS_R_NRESULTS 74 /* Number of results */
/*
* DNS wire format rcodes.
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.h,v 1.60 2000/12/20 03:38:46 bwelling Exp $ */
/* $Id: view.h,v 1.61 2000/12/20 23:31:11 bwelling Exp $ */
#ifndef DNS_VIEW_H
#define DNS_VIEW_H 1
......@@ -394,7 +394,9 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
*
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then
* it will be searched last. If the answer is found in the hints
* database, the result code will be DNS_R_HINT.
* database, the result code will be DNS_R_HINT. If the name is found
* in the hints database but not the type, the result code will be
* DNS_R_HINTNXRRSET.
*
* 'foundname' must meet the requirements of dns_db_find().
*
......@@ -460,7 +462,9 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
*
* If 'use_hints' is ISC_TRUE, and the view has a hints database, then
* it will be searched last. If the answer is found in the hints
* database, the result code will be DNS_R_HINT.
* database, the result code will be DNS_R_HINT. If the name is found
* in the hints database but not the type, the result code will be
* DNS_R_HINTNXRRSET.
*
* If 'sigrdataset' is not NULL, and there is a SIG rdataset which
* covers 'type', then 'sigrdataset' will be bound to it.
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: result.c,v 1.83 2000/12/13 00:15:13 tale Exp $ */
/* $Id: result.c,v 1.84 2000/12/20 23:31:05 bwelling Exp $ */
#include <config.h>
......@@ -112,7 +112,8 @@ static const char *text[DNS_R_NRESULTS] = {
"invalid use of a meta type", /* 70 DNS_R_METATYPE */
"CNAME and other data", /* 71 DNS_R_CNAMEANDOTHER */
"multiple RRs of singleton type" /* 72 DNS_R_SINGLETON */
"multiple RRs of singleton type", /* 72 DNS_R_SINGLETON */
"hint nxrrset" /* 73 DNS_R_HINTNXRRSET */
};
static const char *rcode_text[DNS_R_NRCODERESULTS] = {
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: view.c,v 1.88 2000/12/20 03:38:43 bwelling Exp $ */
/* $Id: view.c,v 1.89 2000/12/20 23:31:06 bwelling Exp $ */
#include <config.h>
......@@ -759,8 +759,10 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
dns_resolver_prime(view->resolver);
dns_db_attach(view->hints, &db);
result = DNS_R_HINT;
} else if (result == DNS_R_NXDOMAIN ||
result == DNS_R_NXRRSET)
} else if (result == DNS_R_NXRRSET) {
dns_db_attach(view->hints, &db);
result = DNS_R_HINTNXRRSET;
} else if (result == DNS_R_NXDOMAIN)
result = ISC_R_NOTFOUND;
}
......@@ -838,6 +840,7 @@ dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
result != DNS_R_NCACHENXDOMAIN &&
result != DNS_R_NCACHENXRRSET &&
result != DNS_R_NXRRSET &&
result != DNS_R_HINTNXRRSET &&
result != ISC_R_NOTFOUND) {
if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
......
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