# Help gcovr process the nasty tricks in lib/dns/code.h, where we include C
# source files from lib/dns/rdata/*/, using an even nastier trick.
- find lib/dns/rdata/* -name "*.c" -execdir cp -f "{}" ../../ \;
- # Help gcovr process inline function in the isc/hash.h
- - cp -f lib/isc/include/isc/hash.h lib/dns/hash.h
+ # Help gcovr process inline functions in headers
+ - cp -f lib/isc/include/isc/*.h lib/dns/
+ - cp -f lib/dns/include/dns/*.h lib/dns/
+ - cp -f lib/dns/include/dns/*.h lib/ns/
# Generate XML file in the Cobertura XML format suitable for use by GitLab
# for the purpose of displaying code coverage information in the diff view
# of a given merge request.
dns_fixedname_t fn;
dns_name_t *name;
isc_buffer_t b;
- dns_decompress_t dctx;
name = dns_fixedname_initname(&fn);
isc_buffer_init(&b, m->query_zone.data, m->query_zone.len);
isc_buffer_add(&b, m->query_zone.len);
- dns_decompress_init(&dctx, DNS_DECOMPRESS_NONE);
- result = dns_name_fromwire(name, &b, &dctx, 0, NULL);
+ result = dns_name_fromwire(name, &b, DNS_DECOMPRESS_NEVER, 0,
+ NULL);
if (result == ISC_R_SUCCESS) {
printf(" query_zone: ");
dns_name_print(name, stdout);
fromwire_typename(dns_rdataclass_t class,
dns_rdatatype_t type,
isc_buffer_t *source,
- dns_decompress_t *dctx,
+ dns_decompress_t dctx,
bool downcase,
isc_buffer_t *target);
fromwire_classname_typename(dns_rdataclass_t class,
dns_rdatatype_t type,
isc_buffer_t *source,
- dns_decompress_t *dctx,
+ dns_decompress_t dctx,
bool downcase,
isc_buffer_t *target);
`fromwire_classname_typename()` is required to set whether
name compression is allowed, according to RFC 3597.
- dns_decompress_setpermitted(dctx, true); /* or false */
+ dctx = dns_decompress_setpermitted(dctx, true); /* or false */
|Parameter|Description |
|---------|-----------------------|
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char totext[64 * 1044 * 4];
dns_compress_t cctx;
- dns_decompress_t dctx;
dns_rdatatype_t rdtype;
dns_rdataclass_t rdclass;
dns_rdatatype_t typelist[256] = { 1000 }; /* unknown */
dns_rdatacallbacks_init(&callbacks);
callbacks.warn = callbacks.error = nullmsg;
- /* Disallow decompression as we are reading a packet */
- dns_decompress_init(&dctx, DNS_DECOMPRESS_NONE);
-
isc_buffer_constinit(&source, data, size);
isc_buffer_add(&source, size);
isc_buffer_setactive(&source, size);
isc_buffer_init(&target, fromwire, sizeof(fromwire));
/*
- * Reject invalid rdata.
+ * Reject invalid rdata. (Disallow decompression as we are
+ * reading a packet)
*/
- CHECK(dns_rdata_fromwire(&rdata1, rdclass, rdtype, &source, &dctx, 0,
- &target));
+ CHECK(dns_rdata_fromwire(&rdata1, rdclass, rdtype, &source,
+ DNS_DECOMPRESS_NEVER, 0, &target));
assert(rdata1.length == size);
/*
char rdatabuf[DST_KEY_MAXSIZE];
unsigned char digest[ISC_MAX_MD_SIZE];
dns_rdata_ds_t ds;
- dns_decompress_t dctx;
dns_rdata_t rdata;
isc_buffer_t b;
}
isc_buffer_init(&b, rdatabuf, sizeof(rdatabuf));
- dns_decompress_init(&dctx, DNS_DECOMPRESS_NONE);
dns_rdata_init(&rdata);
isc_buffer_setactive(databuf, isc_buffer_usedlength(databuf));
- CHECK(dns_rdata_fromwire(&rdata, rdclass, rdtype, databuf, &dctx, 0,
- &b));
- dns_decompress_invalidate(&dctx);
+ CHECK(dns_rdata_fromwire(&rdata, rdclass, rdtype, databuf,
+ DNS_DECOMPRESS_NEVER, 0, &b));
if (rdtype == dns_rdatatype_ds) {
CHECK(dns_rdata_tostruct(&rdata, &ds, NULL));
#define CCTX_MAGIC ISC_MAGIC('C', 'C', 'T', 'X')
#define VALID_CCTX(x) ISC_MAGIC_VALID(x, CCTX_MAGIC)
-#define DCTX_MAGIC ISC_MAGIC('D', 'C', 'T', 'X')
-#define VALID_DCTX(x) ISC_MAGIC_VALID(x, DCTX_MAGIC)
-
static unsigned char maptolower[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
}
}
}
-
-/***
- *** Decompression
- ***/
-
-void
-dns_decompress_init(dns_decompress_t *dctx, dns_decompresstype_t type) {
- REQUIRE(dctx != NULL);
-
- *dctx = (dns_decompress_t){
- .magic = DCTX_MAGIC,
- .type = type,
- };
-}
-
-void
-dns_decompress_invalidate(dns_decompress_t *dctx) {
- REQUIRE(VALID_DCTX(dctx));
- dctx->magic = 0;
-}
-
-void
-dns_decompress_setpermitted(dns_decompress_t *dctx, bool permitted) {
- REQUIRE(VALID_DCTX(dctx));
-
- switch (dctx->type) {
- case DNS_DECOMPRESS_ANY:
- dctx->permitted = true;
- break;
- case DNS_DECOMPRESS_NONE:
- dctx->permitted = false;
- break;
- case DNS_DECOMPRESS_STRICT:
- dctx->permitted = permitted;
- break;
- }
-}
-
-bool
-dns_decompress_getpermitted(dns_decompress_t *dctx) {
- REQUIRE(VALID_DCTX(dctx));
-
- return (dctx->permitted);
-}
isc_mem_t *mctx; /*%< Memory context. */
};
-typedef enum {
- DNS_DECOMPRESS_ANY, /*%< Any compression */
- DNS_DECOMPRESS_STRICT, /*%< Allowed compression */
- DNS_DECOMPRESS_NONE /*%< No compression */
-} dns_decompresstype_t;
-
-struct dns_decompress {
- unsigned int magic; /*%< Magic number. */
- dns_decompresstype_t type; /*%< Strict checking */
- bool permitted;
+enum dns_decompress {
+ DNS_DECOMPRESS_DEFAULT,
+ DNS_DECOMPRESS_PERMITTED,
+ DNS_DECOMPRESS_NEVER,
+ DNS_DECOMPRESS_ALWAYS,
};
isc_result_t
void
dns_compress_rollback(dns_compress_t *cctx, uint16_t offset);
-
/*%<
* Remove any compression pointers from global table >= offset.
*
*\li 'cctx' is initialized.
*/
-void
-dns_decompress_init(dns_decompress_t *dctx, dns_decompresstype_t type);
-
-/*%<
- * Initializes 'dctx'.
- * Records 'edns' and 'type' into the structure.
- *
- * Requires:
- *\li 'dctx' to be a valid pointer.
- */
-
-void
-dns_decompress_invalidate(dns_decompress_t *dctx);
-
-/*%<
- * Invalidates 'dctx'.
- *
- * Requires:
- *\li 'dctx' to be initialized
- */
-
-void
-dns_decompress_setpermitted(dns_decompress_t *dctx, bool permitted);
-
-/*%<
- * Sets whether decompression is allowed, according to RFC 3597
- *
- * Requires:
- *\li 'dctx' to be initialized
+/*%
+ * Set whether decompression is allowed, according to RFC 3597
*/
+static inline dns_decompress_t /* inline to suppress code generation */
+dns_decompress_setpermitted(dns_decompress_t dctx, bool permitted) {
+ if (dctx == DNS_DECOMPRESS_NEVER || dctx == DNS_DECOMPRESS_ALWAYS) {
+ return (dctx);
+ } else if (permitted) {
+ return (DNS_DECOMPRESS_PERMITTED);
+ } else {
+ return (DNS_DECOMPRESS_DEFAULT);
+ }
+}
-bool
-dns_decompress_getpermitted(dns_decompress_t *dctx);
-
-/*%<
+/*%
* Returns whether decompression is allowed here
- *
- * Requires:
- *\li 'dctx' to be initialized
*/
+static inline bool /* inline to suppress code generation */
+dns_decompress_getpermitted(dns_decompress_t dctx) {
+ return (dctx == DNS_DECOMPRESS_ALWAYS ||
+ dctx == DNS_DECOMPRESS_PERMITTED);
+}
ISC_LANG_ENDDECLS
*/
isc_result_t
-dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
- dns_decompress_t *dctx, unsigned int options,
- isc_buffer_t *target);
+dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, dns_decompress_t dctx,
+ unsigned int options, isc_buffer_t *target);
/*%<
* Copy the possibly-compressed name at source (active region) into target,
* decompressing it.
isc_result_t
dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
dns_rdatatype_t type, isc_buffer_t *source,
- dns_decompress_t *dctx, unsigned int options,
+ dns_decompress_t dctx, unsigned int options,
isc_buffer_t *target);
/*%<
* Copy the possibly-compressed rdata at source into the target region.
typedef ISC_LIST(dns_dlzdb_t) dns_dlzdblist_t;
typedef struct dns_dyndbctx dns_dyndbctx_t;
typedef struct dns_sdlzimplementation dns_sdlzimplementation_t;
-typedef struct dns_decompress dns_decompress_t;
+typedef enum dns_decompress dns_decompress_t;
typedef struct dns_dispatch dns_dispatch_t;
typedef struct dns_dispatchlist dns_dispatchlist_t;
typedef struct dns_dispatchset dns_dispatchset_t;
*/
isc_buffer_init(&j->it.source, NULL, 0);
isc_buffer_init(&j->it.target, NULL, 0);
- dns_decompress_init(&j->it.dctx, DNS_DECOMPRESS_NONE);
+ j->it.dctx = DNS_DECOMPRESS_NEVER;
j->state = writable ? JOURNAL_STATE_WRITE : JOURNAL_STATE_READ;
j->it.result = ISC_R_FAILURE;
dns_name_invalidate(&j->it.name);
- dns_decompress_invalidate(&j->it.dctx);
if (j->rawindex != NULL) {
isc_mem_put(j->mctx, j->rawindex,
j->header.index_size * sizeof(journal_rawpos_t));
*/
isc_buffer_setactive(&j->it.source,
j->it.source.used - j->it.source.current);
- CHECK(dns_name_fromwire(&j->it.name, &j->it.source, &j->it.dctx, 0,
+ CHECK(dns_name_fromwire(&j->it.name, &j->it.source, j->it.dctx, 0,
&j->it.target));
/*
isc_buffer_setactive(&j->it.source, rdlen);
dns_rdata_reset(&j->it.rdata);
CHECK(dns_rdata_fromwire(&j->it.rdata, rdclass, rdtype, &j->it.source,
- &j->it.dctx, 0, &j->it.target));
+ j->it.dctx, 0, &j->it.target));
j->it.ttl = ttl;
j->it.xpos += sizeof(journal_rawrrhdr_t) + rrhdr.size;
dns_decompress_t dctx;
callbacks = lctx->callbacks;
- dns_decompress_init(&dctx, DNS_DECOMPRESS_NONE);
+ dctx = DNS_DECOMPRESS_NEVER;
if (lctx->first) {
result = load_header(lctx);
}
isc_buffer_setactive(&target, (unsigned int)namelen);
- result = dns_name_fromwire(name, &target, &dctx, 0, NULL);
+ result = dns_name_fromwire(name, &target, dctx, 0, NULL);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
(unsigned int)rdlen);
result = dns_rdata_fromwire(
&rdata[i], rdatalist.rdclass, rdatalist.type,
- &target, &dctx, 0, &buf);
+ &target, dctx, 0, &buf);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
*/
static isc_result_t
getname(dns_name_t *name, isc_buffer_t *source, dns_message_t *msg,
- dns_decompress_t *dctx) {
+ dns_decompress_t dctx) {
isc_buffer_t *scratch;
isc_result_t result;
unsigned int tries;
}
static isc_result_t
-getrdata(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
+getrdata(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
dns_rdataclass_t rdclass, dns_rdatatype_t rdtype,
unsigned int rdatalen, dns_rdata_t *rdata) {
isc_buffer_t *scratch;
} while (0)
static isc_result_t
-getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
+getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
unsigned int options) {
isc_region_t r;
unsigned int count;
}
static isc_result_t
-getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
+getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t dctx,
dns_section_t sectionid, unsigned int options) {
isc_region_t r;
unsigned int count, rdatalen;
msg->header_ok = 1;
msg->state = DNS_SECTION_QUESTION;
- dns_decompress_init(&dctx, DNS_DECOMPRESS_ANY);
- dns_decompress_setpermitted(&dctx, true);
+ dctx = DNS_DECOMPRESS_ALWAYS;
- ret = getquestions(source, msg, &dctx, options);
+ ret = getquestions(source, msg, dctx, options);
if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) {
goto truncated;
}
}
msg->question_ok = 1;
- ret = getsection(source, msg, &dctx, DNS_SECTION_ANSWER, options);
+ ret = getsection(source, msg, dctx, DNS_SECTION_ANSWER, options);
if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) {
goto truncated;
}
return (ret);
}
- ret = getsection(source, msg, &dctx, DNS_SECTION_AUTHORITY, options);
+ ret = getsection(source, msg, dctx, DNS_SECTION_AUTHORITY, options);
if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) {
goto truncated;
}
return (ret);
}
- ret = getsection(source, msg, &dctx, DNS_SECTION_ADDITIONAL, options);
+ ret = getsection(source, msg, dctx, DNS_SECTION_ADDITIONAL, options);
if (ret == ISC_R_UNEXPECTEDEND && ignore_tc) {
goto truncated;
}
}
isc_result_t
-dns_name_fromwire(dns_name_t *name, isc_buffer_t *source,
- dns_decompress_t *dctx, unsigned int options,
- isc_buffer_t *target) {
+dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, dns_decompress_t dctx,
+ unsigned int options, isc_buffer_t *target) {
unsigned char *cdata, *ndata;
unsigned int cused; /* Bytes of compressed name data used */
unsigned int nused, labels, n, nmax;
isc_buffer_clear(target);
}
- REQUIRE(dctx != NULL);
REQUIRE(BINDABLE(name));
INIT_OFFSETS(name, offsets, odata);
/*
* 14-bit compression pointer
*/
- if (!dctx->permitted) {
+ if (!dns_decompress_getpermitted(dctx)) {
return (DNS_R_DISALLOWED);
}
new_current = c & 0x3F;
bool
dns_nsec3param_fromprivate(dns_rdata_t *src, dns_rdata_t *target,
unsigned char *buf, size_t buflen) {
- dns_decompress_t dctx;
isc_result_t result;
isc_buffer_t buf1;
isc_buffer_t buf2;
isc_buffer_add(&buf1, src->length - 1);
isc_buffer_setactive(&buf1, src->length - 1);
isc_buffer_init(&buf2, buf, (unsigned int)buflen);
- dns_decompress_init(&dctx, DNS_DECOMPRESS_NONE);
result = dns_rdata_fromwire(target, src->rdclass,
- dns_rdatatype_nsec3param, &buf1, &dctx, 0,
- &buf2);
- dns_decompress_invalidate(&dctx);
+ dns_rdatatype_nsec3param, &buf1,
+ DNS_DECOMPRESS_NEVER, 0, &buf2);
return (result == ISC_R_SUCCESS);
}
#define ARGS_FROMWIRE \
int rdclass, dns_rdatatype_t type, isc_buffer_t *source, \
- dns_decompress_t *dctx, unsigned int options, \
+ dns_decompress_t dctx, unsigned int options, \
isc_buffer_t *target
#define CALL_FROMWIRE rdclass, type, source, dctx, options, target
isc_region_t sr;
if (alg == DNS_KEYALG_PRIVATEDNS) {
dns_fixedname_t fixed;
- dns_decompress_t dctx;
- dns_decompress_init(&dctx, DNS_DECOMPRESS_STRICT);
RETERR(dns_name_fromwire(dns_fixedname_initname(&fixed), source,
- &dctx, 0, NULL));
+ DNS_DECOMPRESS_DEFAULT, 0, NULL));
/*
* There should be a public key or signature after the key name.
*/
isc_result_t
dns_rdata_fromwire(dns_rdata_t *rdata, dns_rdataclass_t rdclass,
dns_rdatatype_t type, isc_buffer_t *source,
- dns_decompress_t *dctx, unsigned int options,
+ dns_decompress_t dctx, unsigned int options,
isc_buffer_t *target) {
isc_result_t result = ISC_R_NOTIMPLEMENTED;
isc_region_t region;
uint32_t activelength;
unsigned int length;
- REQUIRE(dctx != NULL);
if (rdata != NULL) {
REQUIRE(DNS_RDATA_INITIALIZED(rdata));
REQUIRE(DNS_RDATA_VALIDFLAGS(rdata));
static isc_result_t
rdata_validate(isc_buffer_t *src, isc_buffer_t *dest, dns_rdataclass_t rdclass,
dns_rdatatype_t type) {
- dns_decompress_t dctx;
isc_result_t result;
- dns_decompress_init(&dctx, DNS_DECOMPRESS_NONE);
isc_buffer_setactive(src, isc_buffer_usedlength(src));
- result = dns_rdata_fromwire(NULL, rdclass, type, src, &dctx, 0, dest);
- dns_decompress_invalidate(&dctx);
+ result = dns_rdata_fromwire(NULL, rdclass, type, src,
+ DNS_DECOMPRESS_NEVER, 0, dest);
return (result);
}
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
/*
* Algorithm Name.
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
isc_buffer_activeregion(source, ®ion);
if (region.length < 2) {
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
RETERR(mem_tobuffer(target, rr.base, 4 + len));
isc_buffer_forward(source, 4 + len);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
while (isc_buffer_activelength(source) > 0) {
dns_name_init(&name, NULL);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
RETERR(dns_name_fromwire(&name, source, dctx, options, target));
REQUIRE(rdclass == #);
/* see RFC 3597 */
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
return (ISC_R_NOTIMPLEMENTED);
}
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
isc_buffer_activeregion(source, &sr);
/*
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
isc_buffer_activeregion(source, &sr);
/*
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, true);
+ dctx = dns_decompress_setpermitted(dctx, true);
dns_name_init(&mname, NULL);
dns_name_init(&rname, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&prev, NULL);
dns_name_init(&next, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
/*
* Algorithm.
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
isc_buffer_activeregion(source, &sr);
/*
isc_buffer_init(&b, apl->apl, apl->apl_len);
isc_buffer_add(&b, apl->apl_len);
isc_buffer_setactive(&b, apl->apl_len);
- return (fromwire_in_apl(rdclass, type, &b, NULL, false, target));
+ return (fromwire_in_apl(rdclass, type, &b, DNS_DECOMPRESS_DEFAULT,
+ false, target));
}
static isc_result_t
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
return (dns_name_fromwire(&name, source, dctx, options, target));
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
UNUSED(type);
UNUSED(rdclass);
- dns_decompress_setpermitted(dctx, false);
+ dctx = dns_decompress_setpermitted(dctx, false);
dns_name_init(&name, NULL);
static void
compress_test(dns_name_t *name1, dns_name_t *name2, dns_name_t *name3,
unsigned char *expected, unsigned int length,
- dns_compress_t *cctx, dns_decompress_t *dctx) {
+ dns_compress_t *cctx, dns_decompress_t dctx) {
isc_buffer_t source;
isc_buffer_t target;
dns_name_t name;
ISC_R_SUCCESS);
RUNTIME_CHECK(dns_name_fromwire(&name, &source, dctx, 0, &target) ==
ISC_R_SUCCESS);
- dns_decompress_invalidate(dctx);
assert_int_equal(target.used, length);
assert_true(memcmp(target.base, expected, target.used) == 0);
permitted = false;
assert_int_equal(dns_compress_init(&cctx, mctx), ISC_R_SUCCESS);
dns_compress_setpermitted(&cctx, permitted);
- dns_decompress_init(&dctx, DNS_DECOMPRESS_STRICT);
- dns_decompress_setpermitted(&dctx, permitted);
+ dctx = dns_decompress_setpermitted(DNS_DECOMPRESS_DEFAULT, permitted);
compress_test(&name1, &name2, &name3, plain, sizeof(plain), &cctx,
- &dctx);
+ dctx);
dns_compress_rollback(&cctx, 0);
dns_compress_invalidate(&cctx);
permitted = true;
assert_int_equal(dns_compress_init(&cctx, mctx), ISC_R_SUCCESS);
dns_compress_setpermitted(&cctx, permitted);
- dns_decompress_init(&dctx, DNS_DECOMPRESS_STRICT);
- dns_decompress_setpermitted(&dctx, permitted);
+ dctx = dns_decompress_setpermitted(DNS_DECOMPRESS_DEFAULT, permitted);
compress_test(&name1, &name2, &name3, plain, sizeof(plain), &cctx,
- &dctx);
+ dctx);
dns_compress_rollback(&cctx, 0);
dns_compress_invalidate(&cctx);
assert_int_equal(dns_compress_init(&cctx, mctx), ISC_R_SUCCESS);
dns_compress_setpermitted(&cctx, permitted);
dns_compress_disable(&cctx);
- dns_decompress_init(&dctx, DNS_DECOMPRESS_STRICT);
- dns_decompress_setpermitted(&dctx, permitted);
+ dctx = dns_decompress_setpermitted(DNS_DECOMPRESS_DEFAULT, permitted);
compress_test(&name1, &name2, &name3, plain, sizeof(plain), &cctx,
- &dctx);
+ dctx);
dns_compress_rollback(&cctx, 0);
dns_compress_invalidate(&cctx);
assert_int_equal(dns_compress_init(&cctx, mctx), ISC_R_SUCCESS);
dns_compress_setpermitted(&cctx, permitted);
dns_compress_disable(&cctx);
- dns_decompress_init(&dctx, DNS_DECOMPRESS_STRICT);
- dns_decompress_setpermitted(&dctx, permitted);
+ dctx = dns_decompress_setpermitted(DNS_DECOMPRESS_DEFAULT, permitted);
compress_test(&name1, &name2, &name3, plain, sizeof(plain), &cctx,
- &dctx);
+ dctx);
dns_compress_rollback(&cctx, 0);
dns_compress_invalidate(&cctx);
dns_rdatatype_t type, unsigned char *dst, size_t dstlen,
dns_rdata_t *rdata) {
isc_buffer_t source, target;
- dns_decompress_t dctx;
isc_result_t result;
/*
/*
* Try converting input data into uncompressed wire form.
*/
- dns_decompress_init(&dctx, DNS_DECOMPRESS_ANY);
- result = dns_rdata_fromwire(rdata, rdclass, type, &source, &dctx, 0,
- &target);
- dns_decompress_invalidate(&dctx);
+ result = dns_rdata_fromwire(rdata, rdclass, type, &source,
+ DNS_DECOMPRESS_ALWAYS, 0, &target);
return (result);
}