2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-04 00:25:29 +00:00

357. [bug] The server would crash if a response contained both

a CNAME and records of the query type.
This commit is contained in:
Brian Wellington
2000-07-28 22:37:47 +00:00
parent 86370ee8e6
commit cd54303345
2 changed files with 18 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
357. [bug] The server would crash if a response contained both
a CNAME and records of the query type.
356. [cleanup] isc_task_send no longer requires event->sender to 356. [cleanup] isc_task_send no longer requires event->sender to
be non-null. be non-null.

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: resolver.c,v 1.159 2000/07/27 22:05:04 bwelling Exp $ */ /* $Id: resolver.c,v 1.160 2000/07/28 22:37:47 bwelling Exp $ */
#include <config.h> #include <config.h>
@@ -3350,7 +3350,7 @@ answer_response(fetchctx_t *fctx) {
dns_name_t *name, *qname, tname; dns_name_t *name, *qname, tname;
dns_rdataset_t *rdataset; dns_rdataset_t *rdataset;
isc_boolean_t done, external, chaining, aa, found, want_chaining; isc_boolean_t done, external, chaining, aa, found, want_chaining;
isc_boolean_t have_answer; isc_boolean_t have_answer, found_cname, found_type;
unsigned int aflag; unsigned int aflag;
dns_rdatatype_t type; dns_rdatatype_t type;
dns_fixedname_t dname; dns_fixedname_t dname;
@@ -3365,6 +3365,8 @@ answer_response(fetchctx_t *fctx) {
*/ */
done = ISC_FALSE; done = ISC_FALSE;
found_cname = ISC_FALSE;
found_type = ISC_FALSE;
chaining = ISC_FALSE; chaining = ISC_FALSE;
have_answer = ISC_FALSE; have_answer = ISC_FALSE;
want_chaining = ISC_FALSE; want_chaining = ISC_FALSE;
@@ -3386,11 +3388,12 @@ answer_response(fetchctx_t *fctx) {
found = ISC_FALSE; found = ISC_FALSE;
want_chaining = ISC_FALSE; want_chaining = ISC_FALSE;
aflag = 0; aflag = 0;
if (rdataset->type == type) { if (rdataset->type == type && !found_cname) {
/* /*
* We've found an ordinary answer. * We've found an ordinary answer.
*/ */
found = ISC_TRUE; found = ISC_TRUE;
found_type = ISC_TRUE;
done = ISC_TRUE; done = ISC_TRUE;
aflag = DNS_RDATASETATTR_ANSWER; aflag = DNS_RDATASETATTR_ANSWER;
} else if (type == dns_rdatatype_any) { } else if (type == dns_rdatatype_any) {
@@ -3402,15 +3405,18 @@ answer_response(fetchctx_t *fctx) {
found = ISC_TRUE; found = ISC_TRUE;
aflag = DNS_RDATASETATTR_ANSWER; aflag = DNS_RDATASETATTR_ANSWER;
} else if (rdataset->type == dns_rdatatype_sig } else if (rdataset->type == dns_rdatatype_sig
&& rdataset->covers == type) { && rdataset->covers == type
&& !found_cname) {
/* /*
* We've found a signature that * We've found a signature that
* covers the type we're looking for. * covers the type we're looking for.
*/ */
found = ISC_TRUE; found = ISC_TRUE;
found_type = ISC_TRUE;
aflag = DNS_RDATASETATTR_ANSWERSIG; aflag = DNS_RDATASETATTR_ANSWERSIG;
} else if (rdataset->type == } else if (rdataset->type ==
dns_rdatatype_cname) { dns_rdatatype_cname
&& !found_type) {
/* /*
* We're looking for something else, * We're looking for something else,
* but we found a CNAME. * but we found a CNAME.
@@ -3423,6 +3429,7 @@ answer_response(fetchctx_t *fctx) {
type == dns_rdatatype_nxt) type == dns_rdatatype_nxt)
return (DNS_R_FORMERR); return (DNS_R_FORMERR);
found = ISC_TRUE; found = ISC_TRUE;
found_cname = ISC_TRUE;
want_chaining = ISC_TRUE; want_chaining = ISC_TRUE;
aflag = DNS_RDATASETATTR_ANSWER; aflag = DNS_RDATASETATTR_ANSWER;
result = cname_target(rdataset, result = cname_target(rdataset,
@@ -3431,12 +3438,14 @@ answer_response(fetchctx_t *fctx) {
return (result); return (result);
} else if (rdataset->type == dns_rdatatype_sig } else if (rdataset->type == dns_rdatatype_sig
&& rdataset->covers == && rdataset->covers ==
dns_rdatatype_cname) { dns_rdatatype_cname
&& !found_type) {
/* /*
* We're looking for something else, * We're looking for something else,
* but we found a SIG CNAME. * but we found a SIG CNAME.
*/ */
found = ISC_TRUE; found = ISC_TRUE;
found_cname = ISC_TRUE;
aflag = DNS_RDATASETATTR_ANSWERSIG; aflag = DNS_RDATASETATTR_ANSWERSIG;
} }