From 1ef8965366d91e02a4672c35a187d30aa4a4c72c Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 24 Feb 1999 06:31:35 +0000 Subject: [PATCH] Add decompression. --- bin/named/wire_debug.c | 12 +-- bin/tests/.cvsignore | 1 + bin/tests/Makefile.in | 6 +- bin/tests/compress_test.c | 171 +++++++++++++++++++++++++++++++ bin/tests/rdata_test.c | 17 +-- bin/tests/wire_test.c | 11 +- doc/design/decompression | 8 +- doc/dev/rdata.html | 10 ++ lib/dns/compress.c | 95 ++++++++++++++++- lib/dns/include/dns/compress.h | 33 +++++- lib/dns/name.c | 113 +++++++++++++++++--- lib/dns/rdata/any_255/tsig_250.c | 7 +- lib/dns/rdata/any_255/tsig_250.h | 7 +- lib/dns/rdata/generic/afsdb_18.c | 7 +- lib/dns/rdata/generic/afsdb_18.h | 7 +- lib/dns/rdata/generic/cname_5.c | 7 +- lib/dns/rdata/generic/cname_5.h | 7 +- lib/dns/rdata/generic/dname_39.c | 9 +- lib/dns/rdata/generic/dname_39.h | 9 +- lib/dns/rdata/generic/mb_7.c | 7 +- lib/dns/rdata/generic/mb_7.h | 7 +- lib/dns/rdata/generic/md_3.c | 7 +- lib/dns/rdata/generic/md_3.h | 7 +- lib/dns/rdata/generic/mf_4.c | 7 +- lib/dns/rdata/generic/mf_4.h | 7 +- lib/dns/rdata/generic/mg_8.c | 7 +- lib/dns/rdata/generic/mg_8.h | 7 +- lib/dns/rdata/generic/minfo_14.c | 7 +- lib/dns/rdata/generic/minfo_14.h | 7 +- lib/dns/rdata/generic/mr_9.c | 7 +- lib/dns/rdata/generic/mr_9.h | 7 +- lib/dns/rdata/generic/mx_15.c | 8 +- lib/dns/rdata/generic/mx_15.h | 8 +- lib/dns/rdata/generic/ns_2.c | 7 +- lib/dns/rdata/generic/ns_2.h | 7 +- lib/dns/rdata/generic/nxt_30.c | 7 +- lib/dns/rdata/generic/nxt_30.h | 7 +- lib/dns/rdata/generic/proforma.c | 7 +- lib/dns/rdata/generic/proforma.h | 7 +- lib/dns/rdata/generic/ptr_12.c | 7 +- lib/dns/rdata/generic/ptr_12.h | 7 +- lib/dns/rdata/generic/rp_17.c | 7 +- lib/dns/rdata/generic/rp_17.h | 7 +- lib/dns/rdata/generic/rt_21.c | 7 +- lib/dns/rdata/generic/rt_21.h | 7 +- lib/dns/rdata/generic/sig_24.c | 7 +- lib/dns/rdata/generic/sig_24.h | 7 +- lib/dns/rdata/generic/soa_6.c | 7 +- lib/dns/rdata/generic/soa_6.h | 7 +- lib/dns/rdata/generic/tkey_249.c | 7 +- lib/dns/rdata/generic/tkey_249.h | 7 +- lib/dns/rdata/in_1/a6_38.c | 7 +- lib/dns/rdata/in_1/a6_38.h | 7 +- lib/dns/rdata/in_1/kx_36.c | 7 +- lib/dns/rdata/in_1/kx_36.h | 7 +- lib/dns/rdata/in_1/naptr_35.c | 7 +- lib/dns/rdata/in_1/naptr_35.h | 7 +- lib/dns/rdata/in_1/nsap-ptr_23.c | 7 +- lib/dns/rdata/in_1/nsap-ptr_23.h | 7 +- lib/dns/rdata/in_1/px_26.c | 7 +- lib/dns/rdata/in_1/px_26.h | 7 +- lib/dns/rdata/in_1/srv_33.c | 7 +- lib/dns/rdata/in_1/srv_33.h | 7 +- 63 files changed, 748 insertions(+), 99 deletions(-) create mode 100644 bin/tests/compress_test.c diff --git a/bin/named/wire_debug.c b/bin/named/wire_debug.c index 4b0cea27e3..10571cbcd9 100644 --- a/bin/named/wire_debug.c +++ b/bin/named/wire_debug.c @@ -69,7 +69,6 @@ dns_result_t printmessage(dns_message_t *message); void dump_packet(unsigned char *buf, u_int len) { - extern dns_decompress_t dctx; extern unsigned int rdcount, rlcount, ncount; char t[5000]; /* XXX */ dns_message_t message; @@ -81,9 +80,6 @@ dump_packet(unsigned char *buf, u_int len) rlcount = 0; ncount = 0; - dctx.allowed = DNS_COMPRESS_GLOBAL14; - dns_name_init(&dctx.owner_name, NULL); - for (i = 0 ; i < len ; /* */ ) { fprintf(stdout, "%02x", buf[i]); if ((++i % 20) == 0) @@ -153,9 +149,7 @@ resolve_packet(dns_db_t *db, isc_buffer_t *source, isc_buffer_t *target) INSIST(message.aucount == 0); INSIST(message.adcount == 0); - dctx.allowed = DNS_COMPRESS_GLOBAL14; - dns_name_init(&dctx.owner_name, NULL); - + dns_decompress_init(&dctx, -1, ISC_FALSE); result = dns_compress_init(&cctx, -1, db->mctx); if (result != DNS_R_SUCCESS) return (result); @@ -167,6 +161,10 @@ resolve_packet(dns_db_t *db, isc_buffer_t *source, isc_buffer_t *target) dns_name_init(&name, NULL); isc_buffer_remaining(source, &r); isc_buffer_setactive(source, r.length); + if (!dns_decompress_strict(&dctx)) + dns_decompress_setmethods(&dctx, DNS_COMPRESS_GLOBAL); + else + dns_decompress_setmethods(&dctx, DNS_COMPRESS_GLOBAL14); result = dns_name_fromwire(&name, source, &dctx, ISC_FALSE, &tbuf); qtype = getshort(source); qclass = getshort(source); diff --git a/bin/tests/.cvsignore b/bin/tests/.cvsignore index 76a56e84df..53bf9d5b8c 100644 --- a/bin/tests/.cvsignore +++ b/bin/tests/.cvsignore @@ -12,3 +12,4 @@ rdata_test master_test rbt_test db_test +compress_test diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in index c48cc5a288..1b001ca190 100644 --- a/bin/tests/Makefile.in +++ b/bin/tests/Makefile.in @@ -27,7 +27,8 @@ TARGETS = lex_test \ rwlock_test \ wire_test \ master_test \ - db_test + db_test \ + compress_test @BIND9_MAKE_RULES@ @@ -67,5 +68,8 @@ master_test: master_test.o ../../lib/isc/libisc.a ../../lib/dns/libdns.a db_test: db_test.o ../../lib/isc/libisc.a ../../lib/dns/libdns.a ${CC} -o $@ db_test.o ${LIBS} +compress_test: compress_test.o ../../lib/isc/libisc.a ../../lib/dns/libdns.a + ${CC} -o $@ compress_test.o ${LIBS} + clean distclean:: rm -f ${TARGETS} diff --git a/bin/tests/compress_test.c b/bin/tests/compress_test.c new file mode 100644 index 0000000000..25677b9540 --- /dev/null +++ b/bin/tests/compress_test.c @@ -0,0 +1,171 @@ +#include + +#include +#include +#include + +#include +#include +#include +#include + +unsigned char plain1[] = "\003foo"; +unsigned char plain2[] = "\003bar\003foo"; +unsigned char plain3[] = "\003xxx\003bar\003foo"; +unsigned char plain[] = + "\003foo\0\003bar\003foo\0\003bar\003foo\0\003xxx\003bar\003foo"; + +unsigned char bit1[] = "\101\010b"; +unsigned char bit2[] = "\101\014b\260"; +unsigned char bit3[] = "\101\020b\264"; +unsigned char bit[] = "\101\010b\0\101\014b\260\0\101\014b\260\0\101\020b\264"; + +int raw = 0; + +void test(unsigned int, dns_name_t *, dns_name_t *, dns_name_t *, + unsigned char *, unsigned int); + +int +main(int argc, char *argv[]) { + dns_name_t name1; + dns_name_t name2; + dns_name_t name3; + isc_region_t region; + int c; + + while ((c = getopt(argc, argv, "r")) != -1) { + switch (c) { + case 'r': + raw++; + break; + } + } + + dns_name_init(&name1, NULL); + region.base = plain1; + region.length = sizeof plain1; + dns_name_fromregion(&name1, ®ion); + + dns_name_init(&name2, NULL); + region.base = plain2; + region.length = sizeof plain2; + dns_name_fromregion(&name2, ®ion); + + dns_name_init(&name3, NULL); + region.base = plain3; + region.length = sizeof plain3; + dns_name_fromregion(&name3, ®ion); + + test(DNS_COMPRESS_NONE, &name1, &name2, &name3, plain, sizeof plain); + test(DNS_COMPRESS_GLOBAL14, &name1, &name2, &name3, plain, + sizeof plain); + test(DNS_COMPRESS_GLOBAL, &name1, &name2, &name3, plain, sizeof plain); + test(DNS_COMPRESS_LOCAL, &name1, &name2, &name3, plain, sizeof plain); + test(DNS_COMPRESS_ALL, &name1, &name2, &name3, plain, sizeof plain); + + dns_name_init(&name1, NULL); + region.base = bit1; + region.length = sizeof bit1; + dns_name_fromregion(&name1, ®ion); + + dns_name_init(&name2, NULL); + region.base = bit2; + region.length = sizeof bit2; + dns_name_fromregion(&name2, ®ion); + + dns_name_init(&name3, NULL); + region.base = bit3; + region.length = sizeof bit3; + dns_name_fromregion(&name3, ®ion); + + test(DNS_COMPRESS_NONE, &name1, &name2, &name3, bit, sizeof bit); + test(DNS_COMPRESS_GLOBAL14, &name1, &name2, &name3, bit, sizeof bit); + test(DNS_COMPRESS_GLOBAL, &name1, &name2, &name3, bit, sizeof bit); + test(DNS_COMPRESS_LOCAL, &name1, &name2, &name3, bit, sizeof bit); + test(DNS_COMPRESS_ALL, &name1, &name2, &name3, bit, sizeof bit); + + exit(0); +} + +void +test(unsigned int allowed, dns_name_t *name1, dns_name_t *name2, + dns_name_t *name3, unsigned char *result, unsigned int length) +{ + isc_mem_t *mctx = NULL; + dns_compress_t cctx; + dns_decompress_t dctx; + isc_buffer_t source; + isc_buffer_t target; + dns_name_t name; + unsigned char buf1[1024]; + unsigned char buf2[1024]; + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + isc_buffer_init(&source, buf1, sizeof buf1, ISC_BUFFERTYPE_BINARY); + RUNTIME_CHECK(dns_compress_init(&cctx, -1, mctx) == DNS_R_SUCCESS); + + RUNTIME_CHECK(dns_name_towire(name1, &cctx, &source) == DNS_R_SUCCESS); + + RUNTIME_CHECK(dns_compress_localinit(&cctx, name1, &source) == + DNS_R_SUCCESS); + dns_compress_setmethods(&cctx, allowed); + RUNTIME_CHECK(dns_name_towire(name2, &cctx, &source) == DNS_R_SUCCESS); + RUNTIME_CHECK(dns_name_towire(name2, &cctx, &source) == DNS_R_SUCCESS); + RUNTIME_CHECK(dns_name_towire(name3, &cctx, &source) == DNS_R_SUCCESS); + + dns_compress_localinvalidate(&cctx); + dns_compress_invalidate(&cctx); + + if (raw) { + unsigned int i; + for (i = 0 ; i < source.used ; /* */ ) { + fprintf(stdout, "%02x", + ((unsigned char *)source.base)[i]); + if ((++i % 20) == 0) + fputs("\n", stdout); + else + if (i == source.used) + fputs("\n", stdout); + else + fputs(" ", stdout); + } + } + + isc_buffer_setactive(&source, source.used); + isc_buffer_init(&target, buf2, sizeof buf2, ISC_BUFFERTYPE_BINARY); + dns_decompress_init(&dctx, -1, ISC_TRUE); + + dns_name_init(&name, NULL); + RUNTIME_CHECK(dns_name_fromwire(&name, &source, &dctx, ISC_FALSE, + &target) == DNS_R_SUCCESS); + dns_decompress_setmethods(&dctx, allowed); + dns_decompress_localinit(&dctx, &name, &source); + RUNTIME_CHECK(dns_name_fromwire(&name, &source, &dctx, ISC_FALSE, + &target) == DNS_R_SUCCESS); + RUNTIME_CHECK(dns_name_fromwire(&name, &source, &dctx, ISC_FALSE, + &target) == DNS_R_SUCCESS); + RUNTIME_CHECK(dns_name_fromwire(&name, &source, &dctx, ISC_FALSE, + &target) == DNS_R_SUCCESS); + dns_decompress_localinvalidate(&dctx); + dns_decompress_invalidate(&dctx); + + if (raw) { + unsigned int i; + for (i = 0 ; i < target.used ; /* */ ) { + fprintf(stdout, "%02x", + ((unsigned char *)target.base)[i]); + if ((++i % 20) == 0) + fputs("\n", stdout); + else + if (i == target.used) + fputs("\n", stdout); + else + fputs(" ", stdout); + } + fputs("\n", stdout); + } + + RUNTIME_CHECK(target.used == length); + RUNTIME_CHECK(memcmp(target.base, result, target.used) == 0); + isc_mem_destroy(&mctx); +} diff --git a/bin/tests/rdata_test.c b/bin/tests/rdata_test.c index ace8dfd329..fc723c46d7 100644 --- a/bin/tests/rdata_test.c +++ b/bin/tests/rdata_test.c @@ -187,7 +187,6 @@ main(int argc, char *argv[]) { dns_rdata_init(&rdata); isc_buffer_init(&dbuf, inbuf, sizeof(inbuf), ISC_BUFFERTYPE_BINARY); - RUNTIME_CHECK(dns_compress_init(&cctx, -1, mctx) == DNS_R_SUCCESS); result = dns_rdata_fromtext(&rdata, class, type, lex, NULL, ISC_FALSE, &dbuf, NULL); if (result != DNS_R_SUCCESS) { @@ -195,7 +194,6 @@ main(int argc, char *argv[]) { "dns_rdata_fromtext returned %s(%d)\n", dns_result_totext(result), result); fflush(stdout); - dns_compress_invalidate(&cctx); continue; } if (raw) { @@ -214,14 +212,21 @@ main(int argc, char *argv[]) { /* Convert to wire and back? */ if (wire) { + result = dns_compress_init(&cctx, -1, mctx); + if (result != DNS_R_SUCCESS) { + fprintf(stdout, + "dns_compress_init returned %s(%d)\n", + dns_result_totext(result), result); + continue; + } isc_buffer_init(&wbuf, wirebuf, sizeof(wirebuf), ISC_BUFFERTYPE_BINARY); result = dns_rdata_towire(&rdata, &cctx, &wbuf); + dns_compress_invalidate(&cctx); if (result != DNS_R_SUCCESS) { fprintf(stdout, "dns_rdata_towire returned %s(%d)\n", dns_result_totext(result), result); - dns_compress_invalidate(&cctx); continue; } len = wbuf.used - wbuf.current; @@ -253,14 +258,15 @@ main(int argc, char *argv[]) { dns_rdata_init(&rdata); isc_buffer_init(&dbuf, inbuf, sizeof(inbuf), ISC_BUFFERTYPE_BINARY); + dns_decompress_init(&dctx, -1, ISC_FALSE); result = dns_rdata_fromwire(&rdata, class, type, &wbuf, &dctx, ISC_FALSE, &dbuf); + dns_decompress_invalidate(&dctx); if (result != DNS_R_SUCCESS) { - fprintf(stdout, + fprintf(stdout, "dns_rdata_fromwire returned %s(%d)\n", dns_result_totext(result), result); fflush(stdout); - dns_compress_invalidate(&cctx); continue; } } @@ -289,7 +295,6 @@ main(int argc, char *argv[]) { fprintf(stdout, "\"%.*s\"\n", (int)tbuf.used, (char*)tbuf.base); fflush(stdout); - dns_compress_invalidate(&cctx); if (lasttype == type) { fprintf(stdout, "dns_rdata_compare = %d\n", dns_rdata_compare(&rdata, &last)); diff --git a/bin/tests/wire_test.c b/bin/tests/wire_test.c index 76516479d9..9f1d8f599f 100644 --- a/bin/tests/wire_test.c +++ b/bin/tests/wire_test.c @@ -125,6 +125,10 @@ getname(dns_name_t *name, isc_buffer_t *source, isc_buffer_t *target) { dns_name_init(name, NULL); current = source->current; + if (dns_decompress_edns(&dctx) > 1 || !dns_decompress_strict(&dctx)) + dns_decompress_setmethods(&dctx, DNS_COMPRESS_GLOBAL); + else + dns_decompress_setmethods(&dctx, DNS_COMPRESS_GLOBAL14); result = dns_name_fromwire(name, source, &dctx, ISC_FALSE, target); #ifdef NOISY @@ -259,9 +263,11 @@ getsection(isc_buffer_t *source, dns_namelist_t *section, unsigned int count, exit(1); } rdata = &rdatas[rdcount++]; + dns_decompress_localinit(&dctx, name, source); result = dns_rdata_fromwire(rdata, class, type, source, &dctx, ISC_FALSE, target); + dns_decompress_localinvalidate(&dctx); if (result != DNS_R_SUCCESS) { printf("%s\n", dns_result_totext(result)); exit(1); @@ -306,10 +312,12 @@ getmessage(dns_message_t *message, isc_buffer_t *source, message->aucount = getshort(source); message->adcount = getshort(source); + dns_decompress_init(&dctx, -1, ISC_FALSE); getquestions(source, &message->question, message->qcount, target); getsection(source, &message->answer, message->ancount, target); getsection(source, &message->authority, message->aucount, target); getsection(source, &message->additional, message->adcount, target); + dns_decompress_invalidate(&dctx); isc_buffer_remaining(source, &r); if (r.length != 0) @@ -558,13 +566,10 @@ main(int argc, char *argv[]) { rlcount = 0; ncount = 0; - dctx.allowed = DNS_COMPRESS_GLOBAL14; - dns_name_init(&dctx.owner_name, NULL); isc_buffer_init(&source, b, sizeof b, ISC_BUFFERTYPE_BINARY); isc_buffer_add(&source, bp - b); isc_buffer_init(&target, t, sizeof t, ISC_BUFFERTYPE_BINARY); - getmessage(&message, &source, &target); result = printmessage(&message); if (result != DNS_R_SUCCESS) diff --git a/doc/design/decompression b/doc/design/decompression index e9b230c9de..2d26211d29 100644 --- a/doc/design/decompression +++ b/doc/design/decompression @@ -1,7 +1,7 @@ Name Decompression - $Id: decompression,v 1.2 1999/02/24 00:57:57 marka Exp $ + $Id: decompression,v 1.3 1999/02/24 06:31:31 marka Exp $ Overview. @@ -49,13 +49,13 @@ Types: Functions: - dns_result_t + void dns_decompress_init(dns_decompress_t *dctx, int edns, - isc_boolean_t strict, isc_mctx_t *mctx); + isc_boolean_t strict); initalise dctx dctx->ownername is invalidated - dns_result_t + void dns_decompress_localinit(dns_decompress_t *dctx, dns_name_t *name, isc_buffer_t *source); initalise dctx->ownername diff --git a/doc/dev/rdata.html b/doc/dev/rdata.html index 7cc9ea7024..5850a70cff 100644 --- a/doc/dev/rdata.html +++ b/doc/dev/rdata.html @@ -218,6 +218,16 @@ fromwire_classname_typename(dns_rdataclass_t class, dns_rdatatype_t type, isc_buffer_t *source, dns_decompress_t *dctx, isc_boolean_t downcase, isc_buffer_t *target); +

+fromwire_classname_typename() is required to set the valid +decompression methods if there is a domain name in the rdata. +

+if (dns_decompress_edns(dctx) >= # || !dns_decompress_strict(dctx))
+	dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL);
+else
+	dns_decompress_setmethods(dctx, DNS_COMPRESS_LOCAL);
+
+
class
diff --git a/lib/dns/compress.c b/lib/dns/compress.c index 46f9ec13da..00f6f3e086 100644 --- a/lib/dns/compress.c +++ b/lib/dns/compress.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: compress.c,v 1.2 1999/02/23 02:25:39 marka Exp $ */ + /* $Id: compress.c,v 1.3 1999/02/24 06:31:31 marka Exp $ */ #include @@ -25,9 +25,12 @@ #include -#define CCTX_MAGIC 0x43435458U +#define CCTX_MAGIC 0x43435458U /* CCTX */ #define VALID_CCTX(x) ((x) != NULL && (x)->magic == CCTX_MAGIC) +#define DCTX_MAGIC 0x44435458U /* DCTX */ +#define VALID_DCTX(x) ((x) != NULL && (x)->magic == DCTX_MAGIC) + static void free_offset(void *offset, void *mctx); isc_boolean_t compress_find(dns_rbt_t *root, dns_name_t *name, dns_name_t *prefix, dns_name_t *suffix, @@ -37,6 +40,9 @@ void compress_add(dns_rbt_t *root, dns_name_t *prefix, dns_name_t *suffix, isc_uint16_t offset, isc_boolean_t global16, isc_mem_t *mctx); +/*** + *** Compression + ***/ dns_result_t dns_compress_init(dns_compress_t *cctx, int edns, isc_mem_t *mctx) @@ -82,7 +88,7 @@ dns_compress_localinit(dns_compress_t *cctx, dns_name_t *owner, REQUIRE(VALID_CCTX(cctx)); REQUIRE(cctx->local == NULL); REQUIRE(dns_name_isabsolute(owner) == ISC_TRUE); - REQUIRE(target != NULL); + REQUIRE(isc_buffer_type(target) == ISC_BUFFERTYPE_BINARY); result = dns_rbt_create(cctx->mctx, free_offset, cctx->mctx, &cctx->local); @@ -107,7 +113,7 @@ dns_compress_localinit(dns_compress_t *cctx, dns_name_t *owner, while (labels > 0) { dns_name_getlabelsequence(owner, wl, labels, &name); data = isc_mem_get(cctx->mctx, sizeof *data); - if (data != NULL) + if (data == NULL) return (DNS_R_SUCCESS); *data = ll; result = dns_rbt_addname(cctx->local, &name, data); @@ -143,7 +149,7 @@ dns_compress_localinit(dns_compress_t *cctx, dns_name_t *owner, if (result != DNS_R_SUCCESS) return (DNS_R_SUCCESS); data = isc_mem_get(cctx->mctx, sizeof *data); - if (data != NULL) + if (data == NULL) return (DNS_R_SUCCESS); *data = ll; result = dns_rbt_addname(cctx->local, &name, data); @@ -259,6 +265,85 @@ dns_compress_backout(dns_compress_t *cctx, isc_uint16_t offset) { } +/*** + *** Decompression + ***/ + +void +dns_decompress_init(dns_decompress_t *dctx, int edns, isc_boolean_t strict) { + + REQUIRE(dctx != NULL); + REQUIRE(edns >= -1 && edns <= 255); + + dctx->allowed = DNS_COMPRESS_NONE; + dctx->edns = edns; + dctx->strict = strict; + dctx->rdata = 0; + dns_name_init(&dctx->owner_name, NULL); + dns_name_invalidate(&dctx->owner_name); + dctx->magic = DCTX_MAGIC; +} + +void +dns_decompress_localinit(dns_decompress_t *dctx, dns_name_t *name, + isc_buffer_t *source) +{ + REQUIRE(VALID_DCTX(dctx)); + REQUIRE(dns_name_isabsolute(name) == ISC_TRUE); + REQUIRE(isc_buffer_type(source) == ISC_BUFFERTYPE_BINARY); + + dctx->rdata = source->current; + dctx->owner_name = *name; +} + +void +dns_decompress_invalidate(dns_decompress_t *dctx) { + + REQUIRE(VALID_DCTX(dctx)); + + dctx->magic = 0; +} + +void +dns_decompress_localinvalidate(dns_decompress_t *dctx) { + + REQUIRE(VALID_DCTX(dctx)); + + dns_name_invalidate(&dctx->owner_name); +} + +void +dns_decompress_setmethods(dns_decompress_t *dctx, unsigned int allowed) { + + REQUIRE(VALID_DCTX(dctx)); + + dctx->allowed = allowed; +} + +unsigned int +dns_decompress_getmethods(dns_decompress_t *dctx) { + + REQUIRE(VALID_DCTX(dctx)); + + return (dctx->allowed); +} + +int +dns_decompress_edns(dns_decompress_t *dctx) { + + REQUIRE(VALID_DCTX(dctx)); + + return (dctx->edns); +} + +isc_boolean_t +dns_decompress_strict(dns_decompress_t *dctx) { + + REQUIRE(VALID_DCTX(dctx)); + + return (dctx->strict); +} + /*** *** Private ***/ diff --git a/lib/dns/include/dns/compress.h b/lib/dns/include/dns/compress.h index 299ca44cb2..cdb90e130c 100644 --- a/lib/dns/include/dns/compress.h +++ b/lib/dns/include/dns/compress.h @@ -48,8 +48,12 @@ struct dns_compress { }; struct dns_decompress { - unsigned int allowed; /* Allowed methods. */ - dns_name_t owner_name; /* For local compression. */ + unsigned int magic; /* Magic number. */ + unsigned int allowed; /* Allowed methods. */ + unsigned int rdata; /* Start of local rdata. */ + int edns; /* Edns version or -1. */ + isc_boolean_t strict; /* Strict checking */ + dns_name_t owner_name; /* For local compression. */ }; dns_result_t dns_compress_init(dns_compress_t *cctx, int edns, @@ -220,4 +224,29 @@ dns_compress_backout(dns_compress_t *cctx, isc_uint16_t offset); * 'cctx' is initalised. */ +void +dns_decompress_init(dns_decompress_t *dctx, int edns, isc_boolean_t strict); + +void +dns_decompress_localinit(dns_decompress_t *dctx, dns_name_t *name, + isc_buffer_t *source); + +void +dns_decompress_invalidate(dns_decompress_t *dctx); + +void +dns_decompress_localinvalidate(dns_decompress_t *dctx); + +void +dns_decompress_setmethods(dns_decompress_t *dctx, unsigned int allowed); + +unsigned int +dns_decompress_getmethods(dns_decompress_t *dctx); + +int +dns_decompress_edns(dns_decompress_t *dctx); + +isc_boolean_t +dns_decompress_strict(dns_decompress_t *dctx); + #endif /* DNS_COMPRESS_H */ diff --git a/lib/dns/name.c b/lib/dns/name.c index 58a17c6e42..6c97f73cf1 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -1670,13 +1670,18 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, isc_buffer_t *target) { unsigned char *cdata, *ndata; - unsigned int cused, hops, nrem, nused, labels, n; - unsigned int current, new_current, biggest_pointer; - isc_boolean_t saw_bitstring, done; + unsigned int cused, hops, nrem, nused, labels, n, i, ll; + unsigned int current, new_current, biggest_pointer, lcount; + isc_boolean_t saw_bitstring, done, local; fw_state state = fw_start; unsigned int c; unsigned char *offsets; dns_offsets_t odata; + dns_name_t suffix; + dns_label_t label; + dns_labeltype_t labeltype; + unsigned int bits; + dns_bitlabel_t bit; /* * Copy the possibly-compressed name at source into target, @@ -1711,6 +1716,7 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, */ labels = 0; hops = 0; + local = ISC_FALSE; saw_bitstring = ISC_FALSE; done = ISC_FALSE; ndata = (unsigned char *)target->base + target->used; @@ -1747,6 +1753,17 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, done = ISC_TRUE; n = c; state = fw_ordinary; + } else if (c >= 128 && c < 192) { + /* + * 14 bit local compression pointer. + */ + if ((dctx->allowed & DNS_COMPRESS_LOCAL) == + 0) + return (DNS_R_DISALLOWED); + local = ISC_TRUE; + new_current = c & 0x3F; + n = 1; + state = fw_newcurrent; } else if (c >= 192) { /* * Ordinary 14-bit pointer. @@ -1754,6 +1771,7 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, if ((dctx->allowed & DNS_COMPRESS_GLOBAL14) == 0) return (DNS_R_DISALLOWED); + local = ISC_FALSE; new_current = c & 0x3F; n = 1; state = fw_newcurrent; @@ -1773,19 +1791,21 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, if ((dctx->allowed & DNS_COMPRESS_GLOBAL16) == 0) return (DNS_R_DISALLOWED); + local = ISC_FALSE; new_current = 0; n = 2; state = fw_newcurrent; } else if (c == DNS_LABELTYPE_LOCALCOMP) { /* - * Local compression. + * 16 bit local compression. */ if ((dctx->allowed & DNS_COMPRESS_LOCAL) == 0) return (DNS_R_DISALLOWED); - - /* XXX */ - return (DNS_R_NOTIMPLEMENTED); + local = ISC_TRUE; + new_current = 0; + n = 2; + state = fw_newcurrent; } else return (DNS_R_BADLABELTYPE); break; @@ -1817,18 +1837,77 @@ dns_name_fromwire(dns_name_t *name, isc_buffer_t *source, new_current *= 256; new_current += c; n--; - if (n == 0) { - if (new_current >= biggest_pointer) + if (n != 0) + break; + if (local && new_current < 256) { + /* logical label count */ + lcount = dctx->owner_name.labels; + i = 0; + ll = 0; + while (i < lcount && ll < new_current) { + dns_name_getlabel(&dctx->owner_name, + i, &label); + labeltype = dns_label_type(&label); + if (labeltype == + dns_labeltype_ordinary) { + i++; + ll++; + continue; + } + INSIST(labeltype == + dns_labeltype_bitstring); + bits = dns_label_countbits(&label); + if (bits + ll <= new_current) { + i++; + ll += bits; + continue; + } + break; + } + if (i == lcount) return (DNS_R_BADPOINTER); - biggest_pointer = new_current; - current = new_current; - cdata = (unsigned char *)source->base + - current; - hops++; - if (hops > DNS_POINTER_MAXHOPS) - return (DNS_R_TOOMANYHOPS); - state = fw_start; + bits = new_current - ll; + if (bits != 0) { + if (nrem < 2 + (bits + 7) / 8) + return (DNS_R_NOSPACE); + *ndata++ = DNS_LABELTYPE_BITSTRING; + *ndata++ = bits; + ndata[bits/8] = 0; + while (bits) { + bit = dns_label_getbit(&label, + bits); + set_bit(ndata, bits, bit); + bits--; + } + ndata += (new_current - ll + 7) / 8; + labels++; + i++; + } + dns_name_init(&suffix, NULL); + dns_name_getlabelsequence(&dctx->owner_name, i, + lcount - i, &suffix); + if (suffix.length > nrem) + return (DNS_R_NOSPACE); + memcpy(ndata, suffix.ndata, suffix.length); + ndata += suffix.length; + nused += suffix.length; + nrem -= suffix.length; + labels += suffix.labels; + done = ISC_TRUE; + break; } + if (local) + new_current += dctx->rdata - 256; + if (new_current >= biggest_pointer) + return (DNS_R_BADPOINTER); + biggest_pointer = new_current; + current = new_current; + cdata = (unsigned char *)source->base + + current; + hops++; + if (hops > DNS_POINTER_MAXHOPS) + return (DNS_R_TOOMANYHOPS); + state = fw_start; break; default: FATAL_ERROR(__FILE__, __LINE__, diff --git a/lib/dns/rdata/any_255/tsig_250.c b/lib/dns/rdata/any_255/tsig_250.c index 60e8fba979..6f78521814 100644 --- a/lib/dns/rdata/any_255/tsig_250.c +++ b/lib/dns/rdata/any_255/tsig_250.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: tsig_250.c,v 1.6 1999/02/22 07:23:59 marka Exp $ */ + /* $Id: tsig_250.c,v 1.7 1999/02/24 06:31:32 marka Exp $ */ /* draft-ietf-dnsind-tsig-07.txt */ @@ -187,6 +187,11 @@ fromwire_any_tsig(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 250); REQUIRE(class == 255); + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + /* Algorithm Name */ dns_name_init(&name, NULL); RETERR(dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/any_255/tsig_250.h b/lib/dns/rdata/any_255/tsig_250.h index 1ddbf309cc..302b0875e1 100644 --- a/lib/dns/rdata/any_255/tsig_250.h +++ b/lib/dns/rdata/any_255/tsig_250.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: tsig_250.h,v 1.6 1999/02/22 07:23:59 marka Exp $ */ + /* $Id: tsig_250.h,v 1.7 1999/02/24 06:31:32 marka Exp $ */ /* draft-ietf-dnsind-tsig-07.txt */ @@ -187,6 +187,11 @@ fromwire_any_tsig(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 250); REQUIRE(class == 255); + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + /* Algorithm Name */ dns_name_init(&name, NULL); RETERR(dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/afsdb_18.c b/lib/dns/rdata/generic/afsdb_18.c index 5df369f670..4e09c63207 100644 --- a/lib/dns/rdata/generic/afsdb_18.c +++ b/lib/dns/rdata/generic/afsdb_18.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: afsdb_18.c,v 1.4 1999/02/22 07:23:59 marka Exp $ */ + /* $Id: afsdb_18.c,v 1.5 1999/02/24 06:31:32 marka Exp $ */ /* RFC 1183 */ @@ -86,6 +86,11 @@ fromwire_afsdb(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + dns_name_init(&name, NULL); isc_buffer_active(source, &sr); diff --git a/lib/dns/rdata/generic/afsdb_18.h b/lib/dns/rdata/generic/afsdb_18.h index d8f778f438..2a35f4ebd4 100644 --- a/lib/dns/rdata/generic/afsdb_18.h +++ b/lib/dns/rdata/generic/afsdb_18.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: afsdb_18.h,v 1.4 1999/02/22 07:23:59 marka Exp $ */ + /* $Id: afsdb_18.h,v 1.5 1999/02/24 06:31:32 marka Exp $ */ /* RFC 1183 */ @@ -86,6 +86,11 @@ fromwire_afsdb(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + dns_name_init(&name, NULL); isc_buffer_active(source, &sr); diff --git a/lib/dns/rdata/generic/cname_5.c b/lib/dns/rdata/generic/cname_5.c index 3ba4d9c70d..76c56d6824 100644 --- a/lib/dns/rdata/generic/cname_5.c +++ b/lib/dns/rdata/generic/cname_5.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: cname_5.c,v 1.10 1999/02/22 07:23:59 marka Exp $ */ + /* $Id: cname_5.c,v 1.11 1999/02/24 06:31:32 marka Exp $ */ #ifndef RDATA_GENERIC_CNAME_5_H #define RDATA_GENERIC_CNAME_5_H @@ -73,6 +73,11 @@ fromwire_cname(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); + dns_name_init(&name, NULL); return(dns_name_fromwire(&name, source, dctx, downcase, target)); } diff --git a/lib/dns/rdata/generic/cname_5.h b/lib/dns/rdata/generic/cname_5.h index d0325099f3..ae1daaf0e8 100644 --- a/lib/dns/rdata/generic/cname_5.h +++ b/lib/dns/rdata/generic/cname_5.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: cname_5.h,v 1.10 1999/02/22 07:23:59 marka Exp $ */ + /* $Id: cname_5.h,v 1.11 1999/02/24 06:31:32 marka Exp $ */ #ifndef RDATA_GENERIC_CNAME_5_H #define RDATA_GENERIC_CNAME_5_H @@ -73,6 +73,11 @@ fromwire_cname(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); + dns_name_init(&name, NULL); return(dns_name_fromwire(&name, source, dctx, downcase, target)); } diff --git a/lib/dns/rdata/generic/dname_39.c b/lib/dns/rdata/generic/dname_39.c index db1fccbb42..3c4ee5cb11 100644 --- a/lib/dns/rdata/generic/dname_39.c +++ b/lib/dns/rdata/generic/dname_39.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: dname_39.c,v 1.3 1999/02/22 07:24:00 marka Exp $ */ + /* $Id: dname_39.c,v 1.4 1999/02/24 06:31:32 marka Exp $ */ /* draft-ietf-dnsind-dname-02.txt */ @@ -73,6 +73,11 @@ fromwire_dname(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 39); class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_LOCAL); + dns_name_init(&name, NULL); return(dns_name_fromwire(&name, source, dctx, downcase, target)); } @@ -87,7 +92,7 @@ towire_dname(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { if (dns_compress_getedns(cctx) >= 1) dns_compress_setmethods(cctx, DNS_COMPRESS_ALL); else - dns_compress_setmethods(cctx, DNS_COMPRESS_NONE); + dns_compress_setmethods(cctx, DNS_COMPRESS_LOCAL); dns_name_init(&name, NULL); dns_rdata_toregion(rdata, ®ion); diff --git a/lib/dns/rdata/generic/dname_39.h b/lib/dns/rdata/generic/dname_39.h index a7dac412d5..c3db598e0c 100644 --- a/lib/dns/rdata/generic/dname_39.h +++ b/lib/dns/rdata/generic/dname_39.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: dname_39.h,v 1.3 1999/02/22 07:24:00 marka Exp $ */ + /* $Id: dname_39.h,v 1.4 1999/02/24 06:31:32 marka Exp $ */ /* draft-ietf-dnsind-dname-02.txt */ @@ -73,6 +73,11 @@ fromwire_dname(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 39); class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_LOCAL); + dns_name_init(&name, NULL); return(dns_name_fromwire(&name, source, dctx, downcase, target)); } @@ -87,7 +92,7 @@ towire_dname(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { if (dns_compress_getedns(cctx) >= 1) dns_compress_setmethods(cctx, DNS_COMPRESS_ALL); else - dns_compress_setmethods(cctx, DNS_COMPRESS_NONE); + dns_compress_setmethods(cctx, DNS_COMPRESS_LOCAL); dns_name_init(&name, NULL); dns_rdata_toregion(rdata, ®ion); diff --git a/lib/dns/rdata/generic/mb_7.c b/lib/dns/rdata/generic/mb_7.c index dbe4a2fae8..505c5263f6 100644 --- a/lib/dns/rdata/generic/mb_7.c +++ b/lib/dns/rdata/generic/mb_7.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mb_7.c,v 1.10 1999/02/22 07:24:00 marka Exp $ */ + /* $Id: mb_7.c,v 1.11 1999/02/24 06:31:32 marka Exp $ */ #ifndef RDATA_GENERIC_MB_7_H #define RDATA_GENERIC_MB_7_H @@ -72,6 +72,11 @@ fromwire_mb(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 7); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/mb_7.h b/lib/dns/rdata/generic/mb_7.h index 6fdb08589c..9a30363ee2 100644 --- a/lib/dns/rdata/generic/mb_7.h +++ b/lib/dns/rdata/generic/mb_7.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mb_7.h,v 1.10 1999/02/22 07:24:00 marka Exp $ */ + /* $Id: mb_7.h,v 1.11 1999/02/24 06:31:32 marka Exp $ */ #ifndef RDATA_GENERIC_MB_7_H #define RDATA_GENERIC_MB_7_H @@ -72,6 +72,11 @@ fromwire_mb(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 7); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/md_3.c b/lib/dns/rdata/generic/md_3.c index 3a7c983670..aaa5315abb 100644 --- a/lib/dns/rdata/generic/md_3.c +++ b/lib/dns/rdata/generic/md_3.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: md_3.c,v 1.10 1999/02/22 07:24:00 marka Exp $ */ + /* $Id: md_3.c,v 1.11 1999/02/24 06:31:32 marka Exp $ */ #ifndef RDATA_GENERIC_MD_3_H #define RDATA_GENERIC_MD_3_H @@ -70,6 +70,11 @@ fromwire_md(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 3); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/md_3.h b/lib/dns/rdata/generic/md_3.h index 1992bfb375..154bf5429b 100644 --- a/lib/dns/rdata/generic/md_3.h +++ b/lib/dns/rdata/generic/md_3.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: md_3.h,v 1.10 1999/02/22 07:24:00 marka Exp $ */ + /* $Id: md_3.h,v 1.11 1999/02/24 06:31:32 marka Exp $ */ #ifndef RDATA_GENERIC_MD_3_H #define RDATA_GENERIC_MD_3_H @@ -70,6 +70,11 @@ fromwire_md(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 3); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/mf_4.c b/lib/dns/rdata/generic/mf_4.c index 82f256a609..147a8b7d51 100644 --- a/lib/dns/rdata/generic/mf_4.c +++ b/lib/dns/rdata/generic/mf_4.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mf_4.c,v 1.9 1999/02/22 07:24:00 marka Exp $ */ + /* $Id: mf_4.c,v 1.10 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MF_4_H #define RDATA_GENERIC_MF_4_H @@ -70,6 +70,11 @@ fromwire_mf(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 4); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/mf_4.h b/lib/dns/rdata/generic/mf_4.h index 7aa95d296f..a9bf8923c9 100644 --- a/lib/dns/rdata/generic/mf_4.h +++ b/lib/dns/rdata/generic/mf_4.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mf_4.h,v 1.9 1999/02/22 07:24:00 marka Exp $ */ + /* $Id: mf_4.h,v 1.10 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MF_4_H #define RDATA_GENERIC_MF_4_H @@ -70,6 +70,11 @@ fromwire_mf(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 4); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/mg_8.c b/lib/dns/rdata/generic/mg_8.c index 43b417a31a..382acb1ebc 100644 --- a/lib/dns/rdata/generic/mg_8.c +++ b/lib/dns/rdata/generic/mg_8.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mg_8.c,v 1.9 1999/02/22 07:24:01 marka Exp $ */ + /* $Id: mg_8.c,v 1.10 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MG_8_H #define RDATA_GENERIC_MG_8_H @@ -72,6 +72,11 @@ fromwire_mg(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 8); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/mg_8.h b/lib/dns/rdata/generic/mg_8.h index 6bf85b1b2f..d2bf0ec951 100644 --- a/lib/dns/rdata/generic/mg_8.h +++ b/lib/dns/rdata/generic/mg_8.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mg_8.h,v 1.9 1999/02/22 07:24:01 marka Exp $ */ + /* $Id: mg_8.h,v 1.10 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MG_8_H #define RDATA_GENERIC_MG_8_H @@ -72,6 +72,11 @@ fromwire_mg(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 8); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/minfo_14.c b/lib/dns/rdata/generic/minfo_14.c index 4e878e9e7d..7dc05c007f 100644 --- a/lib/dns/rdata/generic/minfo_14.c +++ b/lib/dns/rdata/generic/minfo_14.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: minfo_14.c,v 1.10 1999/02/22 07:24:01 marka Exp $ */ + /* $Id: minfo_14.c,v 1.11 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MINFO_14_H #define RDATA_GENERIC_MINFO_14_H @@ -89,6 +89,11 @@ fromwire_minfo(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 14); + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); + class = class; /*unused*/ dns_name_init(&rmail, NULL); diff --git a/lib/dns/rdata/generic/minfo_14.h b/lib/dns/rdata/generic/minfo_14.h index 244a333f99..ec4849df03 100644 --- a/lib/dns/rdata/generic/minfo_14.h +++ b/lib/dns/rdata/generic/minfo_14.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: minfo_14.h,v 1.10 1999/02/22 07:24:01 marka Exp $ */ + /* $Id: minfo_14.h,v 1.11 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MINFO_14_H #define RDATA_GENERIC_MINFO_14_H @@ -89,6 +89,11 @@ fromwire_minfo(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 14); + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); + class = class; /*unused*/ dns_name_init(&rmail, NULL); diff --git a/lib/dns/rdata/generic/mr_9.c b/lib/dns/rdata/generic/mr_9.c index f2e28b2302..d556064bcf 100644 --- a/lib/dns/rdata/generic/mr_9.c +++ b/lib/dns/rdata/generic/mr_9.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mr_9.c,v 1.9 1999/02/22 07:24:01 marka Exp $ */ + /* $Id: mr_9.c,v 1.10 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MR_9_H #define RDATA_GENERIC_MR_9_H @@ -72,6 +72,11 @@ fromwire_mr(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 9); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/mr_9.h b/lib/dns/rdata/generic/mr_9.h index 19a7acf24e..c7d8efdf21 100644 --- a/lib/dns/rdata/generic/mr_9.h +++ b/lib/dns/rdata/generic/mr_9.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mr_9.h,v 1.9 1999/02/22 07:24:01 marka Exp $ */ + /* $Id: mr_9.h,v 1.10 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MR_9_H #define RDATA_GENERIC_MR_9_H @@ -72,6 +72,11 @@ fromwire_mr(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 9); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/mx_15.c b/lib/dns/rdata/generic/mx_15.c index 49a440640c..08c0be3ce0 100644 --- a/lib/dns/rdata/generic/mx_15.c +++ b/lib/dns/rdata/generic/mx_15.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mx_15.c,v 1.12 1999/02/22 07:24:01 marka Exp $ */ + /* $Id: mx_15.c,v 1.13 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MX_15_H #define RDATA_GENERIC_MX_15_H @@ -81,7 +81,13 @@ fromwire_mx(dns_rdataclass_t class, dns_rdatatype_t type, isc_region_t tregion; REQUIRE(type == 15); + class = class; /* unused */ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/generic/mx_15.h b/lib/dns/rdata/generic/mx_15.h index dc93db7fd4..1c6081c2de 100644 --- a/lib/dns/rdata/generic/mx_15.h +++ b/lib/dns/rdata/generic/mx_15.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mx_15.h,v 1.12 1999/02/22 07:24:01 marka Exp $ */ + /* $Id: mx_15.h,v 1.13 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_MX_15_H #define RDATA_GENERIC_MX_15_H @@ -81,7 +81,13 @@ fromwire_mx(dns_rdataclass_t class, dns_rdatatype_t type, isc_region_t tregion; REQUIRE(type == 15); + class = class; /* unused */ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/generic/ns_2.c b/lib/dns/rdata/generic/ns_2.c index 4fc123e019..134268258f 100644 --- a/lib/dns/rdata/generic/ns_2.c +++ b/lib/dns/rdata/generic/ns_2.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: ns_2.c,v 1.9 1999/02/22 07:24:02 marka Exp $ */ + /* $Id: ns_2.c,v 1.10 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_NS_2_H #define RDATA_GENERIC_NS_2_H @@ -72,6 +72,11 @@ fromwire_ns(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 2); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/ns_2.h b/lib/dns/rdata/generic/ns_2.h index 71edd2ea2e..bf9c5f31d1 100644 --- a/lib/dns/rdata/generic/ns_2.h +++ b/lib/dns/rdata/generic/ns_2.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: ns_2.h,v 1.9 1999/02/22 07:24:02 marka Exp $ */ + /* $Id: ns_2.h,v 1.10 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_NS_2_H #define RDATA_GENERIC_NS_2_H @@ -72,6 +72,11 @@ fromwire_ns(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 2); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/nxt_30.c b/lib/dns/rdata/generic/nxt_30.c index ee55a3e680..1cb1141d41 100644 --- a/lib/dns/rdata/generic/nxt_30.c +++ b/lib/dns/rdata/generic/nxt_30.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: nxt_30.c,v 1.6 1999/02/22 07:24:02 marka Exp $ */ + /* $Id: nxt_30.c,v 1.7 1999/02/24 06:31:33 marka Exp $ */ /* RFC 2065 */ @@ -128,6 +128,11 @@ fromwire_nxt(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + dns_name_init(&name, NULL); RETERR(dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/nxt_30.h b/lib/dns/rdata/generic/nxt_30.h index 0c5842938c..d197148fd6 100644 --- a/lib/dns/rdata/generic/nxt_30.h +++ b/lib/dns/rdata/generic/nxt_30.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: nxt_30.h,v 1.6 1999/02/22 07:24:02 marka Exp $ */ + /* $Id: nxt_30.h,v 1.7 1999/02/24 06:31:33 marka Exp $ */ /* RFC 2065 */ @@ -128,6 +128,11 @@ fromwire_nxt(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + dns_name_init(&name, NULL); RETERR(dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/proforma.c b/lib/dns/rdata/generic/proforma.c index 930b553ddd..f598295256 100644 --- a/lib/dns/rdata/generic/proforma.c +++ b/lib/dns/rdata/generic/proforma.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: proforma.c,v 1.7 1999/02/22 07:24:02 marka Exp $ */ + /* $Id: proforma.c,v 1.8 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_#_#_H #define RDATA_GENERIC_#_#_H @@ -51,6 +51,11 @@ fromwire_#(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == #); REQUIRE(class == #); + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_LOCAL); + return (DNS_R_NOTIMPLEMENTED); } diff --git a/lib/dns/rdata/generic/proforma.h b/lib/dns/rdata/generic/proforma.h index ad4449ba56..cbe3be5ec5 100644 --- a/lib/dns/rdata/generic/proforma.h +++ b/lib/dns/rdata/generic/proforma.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: proforma.h,v 1.7 1999/02/22 07:24:02 marka Exp $ */ + /* $Id: proforma.h,v 1.8 1999/02/24 06:31:33 marka Exp $ */ #ifndef RDATA_GENERIC_#_#_H #define RDATA_GENERIC_#_#_H @@ -51,6 +51,11 @@ fromwire_#(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == #); REQUIRE(class == #); + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_LOCAL); + return (DNS_R_NOTIMPLEMENTED); } diff --git a/lib/dns/rdata/generic/ptr_12.c b/lib/dns/rdata/generic/ptr_12.c index d772476c03..20ee3bc8b8 100644 --- a/lib/dns/rdata/generic/ptr_12.c +++ b/lib/dns/rdata/generic/ptr_12.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: ptr_12.c,v 1.10 1999/02/22 07:24:02 marka Exp $ */ + /* $Id: ptr_12.c,v 1.11 1999/02/24 06:31:34 marka Exp $ */ #ifndef RDATA_GENERIC_PTR_12_H #define RDATA_GENERIC_PTR_12_H @@ -72,6 +72,11 @@ fromwire_ptr(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 12); class = class; /* unused */ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/ptr_12.h b/lib/dns/rdata/generic/ptr_12.h index 164c88c7a8..f14fac47c9 100644 --- a/lib/dns/rdata/generic/ptr_12.h +++ b/lib/dns/rdata/generic/ptr_12.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: ptr_12.h,v 1.10 1999/02/22 07:24:02 marka Exp $ */ + /* $Id: ptr_12.h,v 1.11 1999/02/24 06:31:34 marka Exp $ */ #ifndef RDATA_GENERIC_PTR_12_H #define RDATA_GENERIC_PTR_12_H @@ -72,6 +72,11 @@ fromwire_ptr(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 12); class = class; /* unused */ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/generic/rp_17.c b/lib/dns/rdata/generic/rp_17.c index 651d1b95e2..189a795d6d 100644 --- a/lib/dns/rdata/generic/rp_17.c +++ b/lib/dns/rdata/generic/rp_17.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: rp_17.c,v 1.4 1999/02/22 07:24:03 marka Exp $ */ + /* $Id: rp_17.c,v 1.5 1999/02/24 06:31:34 marka Exp $ */ /* RFC 1183 */ @@ -93,6 +93,11 @@ fromwire_rp(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + dns_name_init(&rmail, NULL); dns_name_init(&email, NULL); diff --git a/lib/dns/rdata/generic/rp_17.h b/lib/dns/rdata/generic/rp_17.h index 3d470a42c4..6c781b73b1 100644 --- a/lib/dns/rdata/generic/rp_17.h +++ b/lib/dns/rdata/generic/rp_17.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: rp_17.h,v 1.4 1999/02/22 07:24:03 marka Exp $ */ + /* $Id: rp_17.h,v 1.5 1999/02/24 06:31:34 marka Exp $ */ /* RFC 1183 */ @@ -93,6 +93,11 @@ fromwire_rp(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + dns_name_init(&rmail, NULL); dns_name_init(&email, NULL); diff --git a/lib/dns/rdata/generic/rt_21.c b/lib/dns/rdata/generic/rt_21.c index a462a87b68..f0b9176d05 100644 --- a/lib/dns/rdata/generic/rt_21.c +++ b/lib/dns/rdata/generic/rt_21.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: rt_21.c,v 1.4 1999/02/22 07:24:03 marka Exp $ */ + /* $Id: rt_21.c,v 1.5 1999/02/24 06:31:34 marka Exp $ */ /* RFC 1183 */ @@ -84,6 +84,11 @@ fromwire_rt(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 21); class = class; /* unused */ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/generic/rt_21.h b/lib/dns/rdata/generic/rt_21.h index 099a18d985..4257da1fa5 100644 --- a/lib/dns/rdata/generic/rt_21.h +++ b/lib/dns/rdata/generic/rt_21.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: rt_21.h,v 1.4 1999/02/22 07:24:03 marka Exp $ */ + /* $Id: rt_21.h,v 1.5 1999/02/24 06:31:34 marka Exp $ */ /* RFC 1183 */ @@ -84,6 +84,11 @@ fromwire_rt(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 21); class = class; /* unused */ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/generic/sig_24.c b/lib/dns/rdata/generic/sig_24.c index 3f3b3eebfb..027e13df80 100644 --- a/lib/dns/rdata/generic/sig_24.c +++ b/lib/dns/rdata/generic/sig_24.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: sig_24.c,v 1.8 1999/02/22 07:24:03 marka Exp $ */ + /* $Id: sig_24.c,v 1.9 1999/02/24 06:31:34 marka Exp $ */ /* RFC 2065 */ @@ -180,6 +180,11 @@ fromwire_sig(dns_rdataclass_t class, dns_rdatatype_t type, dns_name_t name; REQUIRE(type == 24); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); class = class; /*unused*/ diff --git a/lib/dns/rdata/generic/sig_24.h b/lib/dns/rdata/generic/sig_24.h index 09323e3b0f..429fd47c26 100644 --- a/lib/dns/rdata/generic/sig_24.h +++ b/lib/dns/rdata/generic/sig_24.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: sig_24.h,v 1.8 1999/02/22 07:24:03 marka Exp $ */ + /* $Id: sig_24.h,v 1.9 1999/02/24 06:31:34 marka Exp $ */ /* RFC 2065 */ @@ -180,6 +180,11 @@ fromwire_sig(dns_rdataclass_t class, dns_rdatatype_t type, dns_name_t name; REQUIRE(type == 24); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); class = class; /*unused*/ diff --git a/lib/dns/rdata/generic/soa_6.c b/lib/dns/rdata/generic/soa_6.c index 84ceedbad6..370a6a4dfb 100644 --- a/lib/dns/rdata/generic/soa_6.c +++ b/lib/dns/rdata/generic/soa_6.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: soa_6.c,v 1.13 1999/02/22 07:24:04 marka Exp $ */ + /* $Id: soa_6.c,v 1.14 1999/02/24 06:31:34 marka Exp $ */ #ifndef RDATA_GENERIC_SOA_6_H #define RDATA_GENERIC_SOA_6_H @@ -113,6 +113,11 @@ fromwire_soa(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); + dns_name_init(&mname, NULL); dns_name_init(&rname, NULL); diff --git a/lib/dns/rdata/generic/soa_6.h b/lib/dns/rdata/generic/soa_6.h index 4f6287b94e..2275f2ac67 100644 --- a/lib/dns/rdata/generic/soa_6.h +++ b/lib/dns/rdata/generic/soa_6.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: soa_6.h,v 1.13 1999/02/22 07:24:04 marka Exp $ */ + /* $Id: soa_6.h,v 1.14 1999/02/24 06:31:34 marka Exp $ */ #ifndef RDATA_GENERIC_SOA_6_H #define RDATA_GENERIC_SOA_6_H @@ -113,6 +113,11 @@ fromwire_soa(dns_rdataclass_t class, dns_rdatatype_t type, class = class; /*unused*/ + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14); + dns_name_init(&mname, NULL); dns_name_init(&rname, NULL); diff --git a/lib/dns/rdata/generic/tkey_249.c b/lib/dns/rdata/generic/tkey_249.c index f56ae9f7fd..d020e2825e 100644 --- a/lib/dns/rdata/generic/tkey_249.c +++ b/lib/dns/rdata/generic/tkey_249.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: tkey_249.c,v 1.6 1999/02/22 07:24:04 marka Exp $ */ + /* $Id: tkey_249.c,v 1.7 1999/02/24 06:31:34 marka Exp $ */ /* draft-ietf-dnssec-tkey-01.txt */ @@ -179,6 +179,11 @@ fromwire_tkey(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 249); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); /* Algorithm */ dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/generic/tkey_249.h b/lib/dns/rdata/generic/tkey_249.h index be591e2a74..33fab51246 100644 --- a/lib/dns/rdata/generic/tkey_249.h +++ b/lib/dns/rdata/generic/tkey_249.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: tkey_249.h,v 1.6 1999/02/22 07:24:04 marka Exp $ */ + /* $Id: tkey_249.h,v 1.7 1999/02/24 06:31:34 marka Exp $ */ /* draft-ietf-dnssec-tkey-01.txt */ @@ -179,6 +179,11 @@ fromwire_tkey(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 249); class = class; /*unused*/ + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); /* Algorithm */ dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/in_1/a6_38.c b/lib/dns/rdata/in_1/a6_38.c index 6a7a7f6f46..5751bd9a57 100644 --- a/lib/dns/rdata/in_1/a6_38.c +++ b/lib/dns/rdata/in_1/a6_38.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: a6_38.c,v 1.6 1999/02/22 07:24:04 marka Exp $ */ + /* $Id: a6_38.c,v 1.7 1999/02/24 06:31:34 marka Exp $ */ /* draft-ietf-ipngwg-dns-lookups-03.txt */ @@ -149,6 +149,11 @@ fromwire_in_a6(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 38); REQUIRE(class == 1); + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + isc_buffer_active(source, &sr); /* prefix length */ if (sr.length < 1) diff --git a/lib/dns/rdata/in_1/a6_38.h b/lib/dns/rdata/in_1/a6_38.h index 2b7ef2df93..2613e38307 100644 --- a/lib/dns/rdata/in_1/a6_38.h +++ b/lib/dns/rdata/in_1/a6_38.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: a6_38.h,v 1.6 1999/02/22 07:24:04 marka Exp $ */ + /* $Id: a6_38.h,v 1.7 1999/02/24 06:31:34 marka Exp $ */ /* draft-ietf-ipngwg-dns-lookups-03.txt */ @@ -149,6 +149,11 @@ fromwire_in_a6(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 38); REQUIRE(class == 1); + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + isc_buffer_active(source, &sr); /* prefix length */ if (sr.length < 1) diff --git a/lib/dns/rdata/in_1/kx_36.c b/lib/dns/rdata/in_1/kx_36.c index 2ed40b820a..ca29f10ec3 100644 --- a/lib/dns/rdata/in_1/kx_36.c +++ b/lib/dns/rdata/in_1/kx_36.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: kx_36.c,v 1.4 1999/02/22 07:24:04 marka Exp $ */ + /* $Id: kx_36.c,v 1.5 1999/02/24 06:31:35 marka Exp $ */ /* RFC 2230 */ @@ -82,6 +82,11 @@ fromwire_in_kx(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 36); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/in_1/kx_36.h b/lib/dns/rdata/in_1/kx_36.h index caed89be18..e2fb4ea78c 100644 --- a/lib/dns/rdata/in_1/kx_36.h +++ b/lib/dns/rdata/in_1/kx_36.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: kx_36.h,v 1.4 1999/02/22 07:24:04 marka Exp $ */ + /* $Id: kx_36.h,v 1.5 1999/02/24 06:31:35 marka Exp $ */ /* RFC 2230 */ @@ -82,6 +82,11 @@ fromwire_in_kx(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 36); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/in_1/naptr_35.c b/lib/dns/rdata/in_1/naptr_35.c index 38f6717536..fdd44a8b7f 100644 --- a/lib/dns/rdata/in_1/naptr_35.c +++ b/lib/dns/rdata/in_1/naptr_35.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: naptr_35.c,v 1.4 1999/02/22 07:24:05 marka Exp $ */ + /* $Id: naptr_35.c,v 1.5 1999/02/24 06:31:35 marka Exp $ */ /* RFC 2168 */ @@ -121,6 +121,11 @@ fromwire_in_naptr(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 35); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/in_1/naptr_35.h b/lib/dns/rdata/in_1/naptr_35.h index 764cea4c63..7d8a5c6e32 100644 --- a/lib/dns/rdata/in_1/naptr_35.h +++ b/lib/dns/rdata/in_1/naptr_35.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: naptr_35.h,v 1.4 1999/02/22 07:24:05 marka Exp $ */ + /* $Id: naptr_35.h,v 1.5 1999/02/24 06:31:35 marka Exp $ */ /* RFC 2168 */ @@ -121,6 +121,11 @@ fromwire_in_naptr(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 35); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/in_1/nsap-ptr_23.c b/lib/dns/rdata/in_1/nsap-ptr_23.c index b286fbbb73..2ef858fe5d 100644 --- a/lib/dns/rdata/in_1/nsap-ptr_23.c +++ b/lib/dns/rdata/in_1/nsap-ptr_23.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: nsap-ptr_23.c,v 1.3 1999/02/22 07:24:05 marka Exp $ */ + /* $Id: nsap-ptr_23.c,v 1.4 1999/02/24 06:31:35 marka Exp $ */ /* RFC 1348 */ @@ -75,6 +75,11 @@ fromwire_in_nsap_ptr(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 23); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/in_1/nsap-ptr_23.h b/lib/dns/rdata/in_1/nsap-ptr_23.h index a3a7ae36ee..a22af93e0e 100644 --- a/lib/dns/rdata/in_1/nsap-ptr_23.h +++ b/lib/dns/rdata/in_1/nsap-ptr_23.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: nsap-ptr_23.h,v 1.3 1999/02/22 07:24:05 marka Exp $ */ + /* $Id: nsap-ptr_23.h,v 1.4 1999/02/24 06:31:35 marka Exp $ */ /* RFC 1348 */ @@ -75,6 +75,11 @@ fromwire_in_nsap_ptr(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 23); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); return (dns_name_fromwire(&name, source, dctx, downcase, target)); diff --git a/lib/dns/rdata/in_1/px_26.c b/lib/dns/rdata/in_1/px_26.c index 7c0f8042e8..78f2a9c7f1 100644 --- a/lib/dns/rdata/in_1/px_26.c +++ b/lib/dns/rdata/in_1/px_26.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: px_26.c,v 1.3 1999/02/22 07:24:05 marka Exp $ */ + /* $Id: px_26.c,v 1.4 1999/02/24 06:31:35 marka Exp $ */ /* RFC 2163 */ @@ -101,6 +101,11 @@ fromwire_in_px(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 26); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/in_1/px_26.h b/lib/dns/rdata/in_1/px_26.h index eeb0f11143..b0ecf0230a 100644 --- a/lib/dns/rdata/in_1/px_26.h +++ b/lib/dns/rdata/in_1/px_26.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: px_26.h,v 1.3 1999/02/22 07:24:05 marka Exp $ */ + /* $Id: px_26.h,v 1.4 1999/02/24 06:31:35 marka Exp $ */ /* RFC 2163 */ @@ -101,6 +101,11 @@ fromwire_in_px(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 26); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/in_1/srv_33.c b/lib/dns/rdata/in_1/srv_33.c index 4a53f55734..0e403ab75d 100644 --- a/lib/dns/rdata/in_1/srv_33.c +++ b/lib/dns/rdata/in_1/srv_33.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: srv_33.c,v 1.3 1999/02/22 07:24:05 marka Exp $ */ + /* $Id: srv_33.c,v 1.4 1999/02/24 06:31:35 marka Exp $ */ /* RFC 2052 bis */ @@ -108,6 +108,11 @@ fromwire_in_srv(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 33); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL); diff --git a/lib/dns/rdata/in_1/srv_33.h b/lib/dns/rdata/in_1/srv_33.h index d73fdea28e..917360ea66 100644 --- a/lib/dns/rdata/in_1/srv_33.h +++ b/lib/dns/rdata/in_1/srv_33.h @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: srv_33.h,v 1.3 1999/02/22 07:24:05 marka Exp $ */ + /* $Id: srv_33.h,v 1.4 1999/02/24 06:31:35 marka Exp $ */ /* RFC 2052 bis */ @@ -108,6 +108,11 @@ fromwire_in_srv(dns_rdataclass_t class, dns_rdatatype_t type, REQUIRE(type == 33); REQUIRE(class == 1); + + if (dns_decompress_edns(dctx) >= 1 || !dns_decompress_strict(dctx)) + dns_decompress_setmethods(dctx, DNS_COMPRESS_ALL); + else + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); dns_name_init(&name, NULL);