mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
implement singleton type checking
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
|||||||
|
60. [func] Catch and disallow singleton types on message
|
||||||
|
parse.
|
||||||
|
|
||||||
59. [bug] Cause net/host unreachable to be a hard error
|
59. [bug] Cause net/host unreachable to be a hard error
|
||||||
when sending and receiving.
|
when sending and receiving.
|
||||||
|
|
||||||
|
@@ -439,6 +439,16 @@ isc_boolean_t dns_rdatatype_ismeta(dns_rdatatype_t type);
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
isc_boolean_t dns_rdatatype_issingleton(dns_rdatatype_t type);
|
||||||
|
/*
|
||||||
|
* Return true iff the rdata type 'type' is a singleton type,
|
||||||
|
* like CNAME or SOA.
|
||||||
|
*
|
||||||
|
* Requires:
|
||||||
|
* 'type' is a valid rdata type.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
isc_boolean_t dns_rdataclass_ismeta(dns_rdataclass_t rdclass);
|
isc_boolean_t dns_rdataclass_ismeta(dns_rdataclass_t rdclass);
|
||||||
/*
|
/*
|
||||||
* Return true iff the rdata class 'rdclass' is a meta-class
|
* Return true iff the rdata class 'rdclass' is a meta-class
|
||||||
|
@@ -1196,11 +1196,19 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
|
|||||||
* append this rdata to that set. If we did not, we need
|
* append this rdata to that set. If we did not, we need
|
||||||
* to create a new rdatalist, store the important bits there,
|
* to create a new rdatalist, store the important bits there,
|
||||||
* convert it to an rdataset, and link the latter to the name.
|
* convert it to an rdataset, and link the latter to the name.
|
||||||
* Yuck.
|
* Yuck. When appending, make certain that the type isn't
|
||||||
|
* a singleton type, such as SOA or CNAME.
|
||||||
*
|
*
|
||||||
* XXXRTH Check for attempts to create multi-record RRsets
|
* Note that this check will be bypassed when preserving order,
|
||||||
* for singleton RR types.
|
* the opcode is an update, or the type search is skipped.
|
||||||
*/
|
*/
|
||||||
|
if (result == ISC_R_SUCCESS) {
|
||||||
|
if (dns_rdatatype_issingleton(rdtype)) {
|
||||||
|
result = DNS_R_FORMERR;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result == ISC_R_NOTFOUND) {
|
if (result == ISC_R_NOTFOUND) {
|
||||||
rdataset = isc_mempool_get(msg->rdspool);
|
rdataset = isc_mempool_get(msg->rdspool);
|
||||||
if (rdataset == NULL) {
|
if (rdataset == NULL) {
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: rdata.c,v 1.75 2000/04/14 17:28:21 bwelling Exp $ */
|
/* $Id: rdata.c,v 1.76 2000/04/14 18:36:00 explorer Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -1548,12 +1548,14 @@ fromtext_error(void (*callback)(dns_rdatacallbacks_t *, char *, ...),
|
|||||||
}
|
}
|
||||||
|
|
||||||
dns_rdatatype_t
|
dns_rdatatype_t
|
||||||
dns_rdata_covers(dns_rdata_t *rdata) {
|
dns_rdata_covers(dns_rdata_t *rdata)
|
||||||
|
{
|
||||||
return (covers_sig(rdata));
|
return (covers_sig(rdata));
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_boolean_t
|
static isc_boolean_t
|
||||||
ismeta(unsigned int code, struct tbl *table) {
|
ismeta(unsigned int code, struct tbl *table)
|
||||||
|
{
|
||||||
struct tbl *t;
|
struct tbl *t;
|
||||||
REQUIRE(code < 65536);
|
REQUIRE(code < 65536);
|
||||||
for (t = table; t->name != NULL; t++) {
|
for (t = table; t->name != NULL; t++) {
|
||||||
@@ -1564,14 +1566,25 @@ ismeta(unsigned int code, struct tbl *table) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isc_boolean_t
|
isc_boolean_t
|
||||||
dns_rdatatype_ismeta(dns_rdatatype_t type) {
|
dns_rdatatype_ismeta(dns_rdatatype_t type)
|
||||||
|
{
|
||||||
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_META) != 0)
|
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_META) != 0)
|
||||||
return (ISC_TRUE);
|
return (ISC_TRUE);
|
||||||
return (ISC_FALSE);
|
return (ISC_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_boolean_t
|
isc_boolean_t
|
||||||
dns_rdataclass_ismeta(dns_rdataclass_t rdclass) {
|
dns_rdatatype_issingleton(dns_rdatatype_t type)
|
||||||
|
{
|
||||||
|
if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_SINGLETON)
|
||||||
|
!= 0)
|
||||||
|
return (ISC_TRUE);
|
||||||
|
return (ISC_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
dns_rdataclass_ismeta(dns_rdataclass_t rdclass)
|
||||||
|
{
|
||||||
return (ismeta(rdclass, classes));
|
return (ismeta(rdclass, classes));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user