2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Removed the code added in revision 1.57:

"Store CNAMEs and their SIGs (if any) in their own name structure on
  the name list.  I.e. do not mix CNAMEs with non-CNAME data.  Do the
  same thing for DNAMEs."

because it caused DNSSEC validation of responses to ANY queries at
nodes with CNAME records to fail, and no one was able to figure out
why it was added in the first place.  As a beneficial side effect,
findname() now finds names even if they have attribute bits set
differently from the one being searched for.  This supersedes
the fix of revision 1.133.
This commit is contained in:
Andreas Gustafsson
2000-07-20 00:05:32 +00:00
parent aa5940281a
commit 99eba32b06

View File

@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: message.c,v 1.134 2000/07/10 20:46:02 explorer Exp $ */
/* $Id: message.c,v 1.135 2000/07/20 00:05:32 gson Exp $ */
/***
*** Imports
@@ -740,7 +740,7 @@ dns_message_destroy(dns_message_t **msgp) {
}
static isc_result_t
simple_findname(dns_name_t **foundname, dns_name_t *target,
findname(dns_name_t **foundname, dns_name_t *target,
dns_namelist_t *section)
{
dns_name_t *curr;
@@ -758,26 +758,6 @@ simple_findname(dns_name_t **foundname, dns_name_t *target,
return (ISC_R_NOTFOUND);
}
static isc_result_t
findname(dns_name_t **foundname, dns_name_t *target, unsigned int attributes,
dns_namelist_t *section)
{
dns_name_t *curr;
for (curr = ISC_LIST_TAIL(*section) ;
curr != NULL ;
curr = ISC_LIST_PREV(curr, link)) {
if (dns_name_equal(curr, target) &&
(curr->attributes & attributes) == attributes) {
if (foundname != NULL)
*foundname = curr;
return (ISC_R_SUCCESS);
}
}
return (ISC_R_NOTFOUND);
}
isc_result_t
dns_message_findtype(dns_name_t *name, dns_rdatatype_t type,
dns_rdatatype_t covers, dns_rdataset_t **rdataset)
@@ -954,7 +934,7 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx)
* name since we no longer need it, and set our name pointer
* to point to the name we found.
*/
result = findname(&name2, name, 0, section);
result = findname(&name2, name, section);
/*
* If it is the first name in the section, accept it.
@@ -1079,7 +1059,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
dns_section_t sectionid, isc_boolean_t preserve_order)
{
isc_region_t r;
unsigned int count, rdatalen, attributes;
unsigned int count, rdatalen;
dns_name_t *name;
dns_name_t *name2;
dns_rdataset_t *rdataset;
@@ -1234,32 +1214,18 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
result = ISC_R_NOMEMORY;
goto cleanup;
}
attributes = 0;
if (rdtype != dns_rdatatype_tsig) {
if (rdtype == dns_rdatatype_cname) {
name->attributes |= DNS_NAMEATTR_CNAME;
attributes = DNS_NAMEATTR_CNAME;
skip_name_search = ISC_TRUE;
} else if (rdtype == dns_rdatatype_dname) {
name->attributes |= DNS_NAMEATTR_DNAME;
attributes = DNS_NAMEATTR_DNAME;
skip_name_search = ISC_TRUE;
}
result = getrdata(source, msg, dctx, msg->rdclass,
rdtype, rdatalen, rdata);
} else
if (rdtype == dns_rdatatype_tsig)
result = getrdata(source, msg, dctx, rdclass,
rdtype, rdatalen, rdata);
else
result = getrdata(source, msg, dctx, msg->rdclass,
rdtype, rdatalen, rdata);
if (result != ISC_R_SUCCESS)
goto cleanup;
rdata->rdclass = rdclass;
if (rdtype == dns_rdatatype_sig && rdata->length > 0) {
covers = dns_rdata_covers(rdata);
if (covers == dns_rdatatype_cname)
attributes = DNS_NAMEATTR_CNAME;
else if (covers == dns_rdatatype_dname)
attributes = DNS_NAMEATTR_DNAME;
else if (covers == 0 &&
if (covers == 0 &&
sectionid == DNS_SECTION_ADDITIONAL)
{
if (msg->sig0 != NULL) {
@@ -1294,7 +1260,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
* allocated name since we no longer need it, and set
* our name pointer to point to the name we found.
*/
result = findname(&name2, name, attributes, section);
result = findname(&name2, name, section);
/*
* If it is a new name, append to the section.
@@ -2023,39 +1989,9 @@ dns_message_findname(dns_message_t *msg, dns_section_t section,
REQUIRE(*rdataset == NULL);
}
if (msg->from_to_wire == DNS_MESSAGE_INTENTPARSE) {
dns_rdatatype_t atype;
unsigned int attributes;
/*
* Figure out what attributes we should look for.
*/
if (type == dns_rdatatype_sig)
atype = covers;
else
atype = type;
attributes = 0;
if (atype == dns_rdatatype_cname)
attributes = DNS_NAMEATTR_CNAME;
else if (atype == dns_rdatatype_cname)
attributes = DNS_NAMEATTR_DNAME;
result = findname(&foundname, target,
&msg->sections[section]);
/*
* Search through, looking for the name.
*/
result = findname(&foundname, target, attributes,
&msg->sections[section]);
} else {
/*
* The message was not built by dns_message_parse()
* and therefore does not have CNAMEs and DNAMEs
* as separate names, and no DNS_NAMEATTR_CNAME
* and DNS_NAMEATTR_DNAME attributes are maintained.
* Therefore, we should not compare attributes.
*/
result = simple_findname(&foundname, target,
&msg->sections[section]);
}
if (result == ISC_R_NOTFOUND)
return (DNS_R_NXDOMAIN);
else if (result != ISC_R_SUCCESS)