mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: message.c,v 1.228 2005/11/30 03:33:49 marka Exp $ */
|
||||
/* $Id: message.c,v 1.229 2006/01/05 00:58:21 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -802,6 +802,31 @@ findname(dns_name_t **foundname, dns_name_t *target,
|
||||
return (ISC_R_NOTFOUND);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_message_find(dns_name_t *name, dns_rdataclass_t rdclass,
|
||||
dns_rdatatype_t type, dns_rdatatype_t covers,
|
||||
dns_rdataset_t **rdataset)
|
||||
{
|
||||
dns_rdataset_t *curr;
|
||||
|
||||
if (rdataset != NULL) {
|
||||
REQUIRE(*rdataset == NULL);
|
||||
}
|
||||
|
||||
for (curr = ISC_LIST_TAIL(name->list);
|
||||
curr != NULL;
|
||||
curr = ISC_LIST_PREV(curr, link)) {
|
||||
if (curr->rdclass == rdclass &&
|
||||
curr->type == type && curr->covers == covers) {
|
||||
if (rdataset != NULL)
|
||||
*rdataset = 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)
|
||||
@@ -1033,7 +1058,7 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
||||
/*
|
||||
* Can't ask the same question twice.
|
||||
*/
|
||||
result = dns_message_findtype(name, rdtype, 0, NULL);
|
||||
result = dns_message_find(name, rdclass, rdtype, 0, NULL);
|
||||
if (result == ISC_R_SUCCESS)
|
||||
DO_FORMERR;
|
||||
|
||||
@@ -1193,6 +1218,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
||||
&& rdtype != dns_rdatatype_dnskey /* in a TKEY query */
|
||||
&& rdtype != dns_rdatatype_sig /* SIG(0) */
|
||||
&& rdtype != dns_rdatatype_tkey /* Win2000 TKEY */
|
||||
&& msg->rdclass != dns_rdataclass_any
|
||||
&& msg->rdclass != rdclass)
|
||||
DO_FORMERR;
|
||||
|
||||
@@ -1282,12 +1308,9 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
||||
rdata->type = rdtype;
|
||||
rdata->flags = DNS_RDATA_UPDATE;
|
||||
result = ISC_R_SUCCESS;
|
||||
} else if (rdtype == dns_rdatatype_tsig)
|
||||
} else
|
||||
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;
|
||||
@@ -1363,8 +1386,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
||||
DO_FORMERR;
|
||||
|
||||
rdataset = NULL;
|
||||
result = dns_message_findtype(name, rdtype, covers,
|
||||
&rdataset);
|
||||
result = dns_message_find(name, rdclass, rdtype,
|
||||
covers, &rdataset);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user