diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2020-02-24 17:45:27 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2020-02-24 17:45:27 +0000 |
commit | 0ceb7b59c86af9efa7f1400fb460d85dc4d483b6 (patch) | |
tree | 0955b086dc41c7e5ab8f5c1b80956a023ada7a4c /usr.bin/dig | |
parent | eabaa59838ffe0eb651c0f95336c23068c9b3e74 (diff) |
We only need to create cname, ns, soa and tsig structs.
OK jsg
Diffstat (limited to 'usr.bin/dig')
81 files changed, 143 insertions, 2248 deletions
diff --git a/usr.bin/dig/dighost.c b/usr.bin/dig/dighost.c index a9677551334..fa813cafed0 100644 --- a/usr.bin/dig/dighost.c +++ b/usr.bin/dig/dighost.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.20 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: dighost.c,v 1.21 2020/02/24 17:45:25 florian Exp $ */ /*! \file * \note @@ -1719,8 +1719,8 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section) dns_rdataset_current(rdataset, &rdata); query->lookup->nsfound++; - result = dns_rdata_tostruct(&rdata, &ns); - check_result(result, "dns_rdata_tostruct"); + result = dns_rdata_tostruct_ns(&rdata, &ns); + check_result(result, "dns_rdata_tostruct_ns"); dns_name_format(&ns.name, namestr, sizeof(namestr)); dns_rdata_freestruct_ns(&ns); @@ -3102,8 +3102,8 @@ check_for_more_data(dig_query_t *query, dns_message_t *msg, /* Now we have an SOA. Work with it. */ debug("got an SOA"); - result = dns_rdata_tostruct(&rdata, &soa); - check_result(result, "dns_rdata_tostruct"); + result = dns_rdata_tostruct_soa(&rdata, &soa); + check_result(result, "dns_rdata_tostruct_soa"); serial = soa.serial; dns_rdata_freestruct_soa(&soa); if (!query->first_soa_rcvd) { diff --git a/usr.bin/dig/host.c b/usr.bin/dig/host.c index d484b80b680..d61b1f49863 100644 --- a/usr.bin/dig/host.c +++ b/usr.bin/dig/host.c @@ -358,8 +358,8 @@ chase_cnamechain(dns_message_t *msg, dns_name_t *qname) { check_result(result, "dns_rdataset_first"); dns_rdata_reset(&rdata); dns_rdataset_current(rdataset, &rdata); - result = dns_rdata_tostruct(&rdata, &cname); - check_result(result, "dns_rdata_tostruct"); + result = dns_rdata_tostruct_cname(&rdata, &cname); + check_result(result, "dns_rdata_tostruct_cname"); dns_name_copy(&cname.cname, qname, NULL); dns_rdata_freestruct_cname(&cname); } diff --git a/usr.bin/dig/lib/dns/gen.c b/usr.bin/dig/lib/dns/gen.c index 1409cfc5246..583f9db23d5 100644 --- a/usr.bin/dig/lib/dns/gen.c +++ b/usr.bin/dig/lib/dns/gen.c @@ -621,9 +621,6 @@ main(int argc, char **argv) { FROMWIRETYPE, FROMWIRECLASS, FROMWIREDEF); doswitch("TOWIRESWITCH", "towire", TOWIREARGS, TOWIRETYPE, TOWIRECLASS, TOWIREDEF); - doswitch("TOSTRUCTSWITCH", "tostruct", TOSTRUCTARGS, - TOSTRUCTTYPE, TOSTRUCTCLASS, TOSTRUCTDEF); - /* * From here down, we are processing the rdata names and * attributes. diff --git a/usr.bin/dig/lib/dns/include/dns/rdata.h b/usr.bin/dig/lib/dns/include/dns/rdata.h index 92a057c1561..b2be30d2d42 100644 --- a/usr.bin/dig/lib/dns/include/dns/rdata.h +++ b/usr.bin/dig/lib/dns/include/dns/rdata.h @@ -425,19 +425,67 @@ dns_rdata_fromstruct_tsig(dns_rdata_t *rdata, dns_rdataclass_t rdclass, */ isc_result_t -dns_rdata_tostruct(const dns_rdata_t *rdata, void *target); +dns_rdata_tostruct_cname(const dns_rdata_t *rdata, dns_rdata_cname_t *cname); /*%< * Convert an rdata into its C structure representation. * - * If 'mctx' is NULL then 'rdata' must persist while 'target' is being used. * - * If 'mctx' is non NULL then memory will be allocated if required. + * Requires: + * + *\li 'rdata' is a valid, non-empty rdata. + * + *\li 'cname' to point to a valid pointer for the type and class. + * + * Result: + *\li Success + *\li Resource Limit: Not enough memory + */ + +isc_result_t +dns_rdata_tostruct_ns(const dns_rdata_t *rdata, dns_rdata_ns_t *ns); +/*%< + * Convert an rdata into its C structure representation. + * + * + * Requires: + * + *\li 'rdata' is a valid, non-empty rdata. + * + *\li 'ns' to point to a valid pointer for the type and class. + * + * Result: + *\li Success + *\li Resource Limit: Not enough memory + */ + +isc_result_t +dns_rdata_tostruct_soa(const dns_rdata_t *rdata, dns_rdata_soa_t *soa); +/*%< + * Convert an rdata into its C structure representation. + * + * + * Requires: + * + *\li 'rdata' is a valid, non-empty rdata. + * + *\li 'soa' to point to a valid pointer for the type and class. + * + * Result: + *\li Success + *\li Resource Limit: Not enough memory + */ + +isc_result_t +dns_rdata_tostruct_tsig(const dns_rdata_t *rdata, dns_rdata_any_tsig_t *tsig); +/*%< + * Convert an rdata into its C structure representation. + * * * Requires: * *\li 'rdata' is a valid, non-empty rdata. * - *\li 'target' to point to a valid pointer for the type and class. + *\li 'tsig' to point to a valid pointer for the type and class. * * Result: *\li Success diff --git a/usr.bin/dig/lib/dns/rdata.c b/usr.bin/dig/lib/dns/rdata.c index 9677ecba6d2..3f1177a3b1a 100644 --- a/usr.bin/dig/lib/dns/rdata.c +++ b/usr.bin/dig/lib/dns/rdata.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rdata.c,v 1.20 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: rdata.c,v 1.21 2020/02/24 17:45:25 florian Exp $ */ /*! \file */ @@ -136,9 +136,6 @@ static isc_result_t rdata_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, isc_buffer_t *target); -static uint16_t -uint16_consume_fromregion(isc_region_t *region); - static isc_result_t unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, isc_buffer_t *target); @@ -701,19 +698,35 @@ dns_rdata_fromstruct_tsig(dns_rdata_t *rdata, dns_rdataclass_t rdclass, } isc_result_t -dns_rdata_tostruct(const dns_rdata_t *rdata, void *target) { - isc_result_t result = ISC_R_NOTIMPLEMENTED; - isc_boolean_t use_default = ISC_FALSE; +dns_rdata_tostruct_cname(const dns_rdata_t *rdata, dns_rdata_cname_t *cname) { + REQUIRE(rdata != NULL); + REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); + return (tostruct_cname(rdata, cname)); +} + +isc_result_t +dns_rdata_tostruct_ns(const dns_rdata_t *rdata, dns_rdata_ns_t *ns) { REQUIRE(rdata != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); - TOSTRUCTSWITCH + return (tostruct_ns(rdata, ns)); +} - if (use_default) - (void)NULL; +isc_result_t +dns_rdata_tostruct_soa(const dns_rdata_t *rdata, dns_rdata_soa_t *soa) { + REQUIRE(rdata != NULL); + REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); - return (result); + return (tostruct_soa(rdata, soa)); +} + +isc_result_t +dns_rdata_tostruct_tsig(const dns_rdata_t *rdata, dns_rdata_any_tsig_t *tsig) { + REQUIRE(rdata != NULL); + REQUIRE(DNS_RDATA_VALIDFLAGS(rdata)); + + return (tostruct_any_tsig(rdata, tsig)); } void @@ -1123,14 +1136,6 @@ uint32_fromregion(isc_region_t *region) { } static uint16_t -uint16_consume_fromregion(isc_region_t *region) { - uint16_t r = uint16_fromregion(region); - - isc_region_consume(region, 2); - return r; -} - -static uint16_t uint16_fromregion(isc_region_t *region) { REQUIRE(region->length >= 2); diff --git a/usr.bin/dig/lib/dns/rdata/ch_3/a_1.c b/usr.bin/dig/lib/dns/rdata/ch_3/a_1.c index 0b252176af4..abbed31187c 100644 --- a/usr.bin/dig/lib/dns/rdata/ch_3/a_1.c +++ b/usr.bin/dig/lib/dns/rdata/ch_3/a_1.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: a_1.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: a_1.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* by Bjorn.Victor@it.uu.se, 2005-05-07 */ /* Based on generic/soa_6.c and generic/mx_15.c */ @@ -119,31 +119,6 @@ towire_ch_a(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_ch_a(ARGS_TOSTRUCT) { - dns_rdata_ch_a_t *a = target; - isc_region_t region; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_a); - REQUIRE(rdata->rdclass == dns_rdataclass_ch); - REQUIRE(rdata->length != 0); - - a->common.rdclass = rdata->rdclass; - a->common.rdtype = rdata->type; - ISC_LINK_INIT(&a->common, link); - - dns_rdata_toregion(rdata, ®ion); - - dns_name_init(&name, NULL); - dns_name_fromregion(&name, ®ion); - isc_region_consume(®ion, name_length(&name)); - - dns_name_init(&a->ch_addr_dom, NULL); - RETERR(name_duporclone(&name, &a->ch_addr_dom)); - a->ch_addr = htons(uint16_fromregion(®ion)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/afsdb_18.c b/usr.bin/dig/lib/dns/rdata/generic/afsdb_18.c index 43468f01b1c..8ee79fc59be 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/afsdb_18.c +++ b/usr.bin/dig/lib/dns/rdata/generic/afsdb_18.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: afsdb_18.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: afsdb_18.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Wed Mar 15 14:59:00 PST 2000 by explorer */ @@ -104,33 +104,6 @@ towire_afsdb(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_afsdb(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_afsdb_t *afsdb = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_afsdb); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - afsdb->common.rdclass = rdata->rdclass; - afsdb->common.rdtype = rdata->type; - ISC_LINK_INIT(&afsdb->common, link); - - dns_name_init(&afsdb->server, NULL); - - dns_rdata_toregion(rdata, ®ion); - - afsdb->subtype = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - - dns_name_init(&name, NULL); - dns_name_fromregion(&name, ®ion); - - RETERR(name_duporclone(&name, &afsdb->server)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/avc_258.c b/usr.bin/dig/lib/dns/rdata/generic/avc_258.c index cca4607f473..9bc17905b68 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/avc_258.c +++ b/usr.bin/dig/lib/dns/rdata/generic/avc_258.c @@ -55,19 +55,6 @@ towire_avc(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_avc(ARGS_TOSTRUCT) { - dns_rdata_avc_t *avc = target; - - REQUIRE(rdata->type == dns_rdatatype_avc); - REQUIRE(target != NULL); - - avc->common.rdclass = rdata->rdclass; - avc->common.rdtype = rdata->type; - ISC_LINK_INIT(&avc->common, link); - - return (generic_tostruct_txt(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/caa_257.c b/usr.bin/dig/lib/dns/rdata/generic/caa_257.c index 273ab9658e4..2e689effa6f 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/caa_257.c +++ b/usr.bin/dig/lib/dns/rdata/generic/caa_257.c @@ -132,58 +132,6 @@ towire_caa(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_caa(ARGS_TOSTRUCT) { - dns_rdata_caa_t *caa = target; - isc_region_t sr; - - REQUIRE(rdata->type == dns_rdatatype_caa); - REQUIRE(target != NULL); - REQUIRE(rdata->length >= 3U); - REQUIRE(rdata->data != NULL); - - caa->common.rdclass = rdata->rdclass; - caa->common.rdtype = rdata->type; - ISC_LINK_INIT(&caa->common, link); - - dns_rdata_toregion(rdata, &sr); - - /* - * Flags - */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - caa->flags = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* - * Tag length - */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - caa->tag_len = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* - * Tag - */ - if (sr.length < caa->tag_len) - return (ISC_R_UNEXPECTEDEND); - caa->tag = mem_maybedup(sr.base, caa->tag_len); - if (caa->tag == NULL) - return (ISC_R_NOMEMORY); - isc_region_consume(&sr, caa->tag_len); - - /* - * Value - */ - caa->value_len = sr.length; - caa->value = mem_maybedup(sr.base, sr.length); - if (caa->value == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/cdnskey_60.c b/usr.bin/dig/lib/dns/rdata/generic/cdnskey_60.c index 4b14a09f52c..b3a0aebbe81 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/cdnskey_60.c +++ b/usr.bin/dig/lib/dns/rdata/generic/cdnskey_60.c @@ -56,20 +56,6 @@ towire_cdnskey(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_cdnskey(ARGS_TOSTRUCT) { - dns_rdata_cdnskey_t *dnskey = target; - - REQUIRE(dnskey != NULL); - REQUIRE(rdata != NULL); - REQUIRE(rdata->type == dns_rdatatype_cdnskey); - - dnskey->common.rdclass = rdata->rdclass; - dnskey->common.rdtype = rdata->type; - ISC_LINK_INIT(&dnskey->common, link); - - return (generic_tostruct_key(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/cds_59.c b/usr.bin/dig/lib/dns/rdata/generic/cds_59.c index e51746385a2..47d333b6c5e 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/cds_59.c +++ b/usr.bin/dig/lib/dns/rdata/generic/cds_59.c @@ -58,23 +58,6 @@ towire_cds(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_cds(ARGS_TOSTRUCT) { - dns_rdata_cds_t *cds = target; - - REQUIRE(rdata->type == dns_rdatatype_cds); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - /* - * Checked by generic_tostruct_ds(). - */ - cds->common.rdclass = rdata->rdclass; - cds->common.rdtype = rdata->type; - ISC_LINK_INIT(&cds->common, link); - - return (generic_tostruct_ds(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/cert_37.c b/usr.bin/dig/lib/dns/rdata/generic/cert_37.c index 320c7d32c16..1a503d2fce3 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/cert_37.c +++ b/usr.bin/dig/lib/dns/rdata/generic/cert_37.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cert_37.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: cert_37.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Wed Mar 15 21:14:32 EST 2000 by tale */ @@ -110,35 +110,6 @@ towire_cert(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_cert(ARGS_TOSTRUCT) { - dns_rdata_cert_t *cert = target; - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_cert); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - cert->common.rdclass = rdata->rdclass; - cert->common.rdtype = rdata->type; - ISC_LINK_INIT(&cert->common, link); - - dns_rdata_toregion(rdata, ®ion); - - cert->type = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - cert->key_tag = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - cert->algorithm = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - cert->length = region.length; - - cert->certificate = mem_maybedup(region.base, region.length); - if (cert->certificate == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/csync_62.c b/usr.bin/dig/lib/dns/rdata/generic/csync_62.c index 7712d65652f..2b82ce30b54 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/csync_62.c +++ b/usr.bin/dig/lib/dns/rdata/generic/csync_62.c @@ -97,37 +97,6 @@ towire_csync(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_csync(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_csync_t *csync = target; - - REQUIRE(rdata->type == dns_rdatatype_csync); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - csync->common.rdclass = rdata->rdclass; - csync->common.rdtype = rdata->type; - ISC_LINK_INIT(&csync->common, link); - - dns_rdata_toregion(rdata, ®ion); - - csync->serial = uint32_fromregion(®ion); - isc_region_consume(®ion, 4); - - csync->flags = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - - csync->len = region.length; - csync->typebits = mem_maybedup(region.base, region.length); - if (csync->typebits == NULL) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/dlv_32769.c b/usr.bin/dig/lib/dns/rdata/generic/dlv_32769.c index cb8a205831d..8ee1eee174f 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/dlv_32769.c +++ b/usr.bin/dig/lib/dns/rdata/generic/dlv_32769.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dlv_32769.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: dlv_32769.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* RFC3658 */ @@ -60,18 +60,6 @@ towire_dlv(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_dlv(ARGS_TOSTRUCT) { - dns_rdata_dlv_t *dlv = target; - - REQUIRE(rdata->type == dns_rdatatype_dlv); - - dlv->common.rdclass = rdata->rdclass; - dlv->common.rdtype = rdata->type; - ISC_LINK_INIT(&dlv->common, link); - - return (generic_tostruct_ds(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/dname_39.c b/usr.bin/dig/lib/dns/rdata/generic/dname_39.c index b8e79510712..5f5718eb583 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/dname_39.c +++ b/usr.bin/dig/lib/dns/rdata/generic/dname_39.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dname_39.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: dname_39.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Wed Mar 15 16:52:38 PST 2000 by explorer */ @@ -80,27 +80,6 @@ towire_dname(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_dname(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_dname_t *dname = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_dname); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - dname->common.rdclass = rdata->rdclass; - dname->common.rdtype = rdata->type; - ISC_LINK_INIT(&dname->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - dns_name_init(&dname->dname, NULL); - RETERR(name_duporclone(&name, &dname->dname)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/dnskey_48.c b/usr.bin/dig/lib/dns/rdata/generic/dnskey_48.c index 216dced5c3b..486ecad1dc2 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/dnskey_48.c +++ b/usr.bin/dig/lib/dns/rdata/generic/dnskey_48.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnskey_48.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: dnskey_48.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley. @@ -63,20 +63,6 @@ towire_dnskey(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_dnskey(ARGS_TOSTRUCT) { - dns_rdata_dnskey_t *dnskey = target; - - REQUIRE(dnskey != NULL); - REQUIRE(rdata != NULL); - REQUIRE(rdata->type == dns_rdatatype_dnskey); - - dnskey->common.rdclass = rdata->rdclass; - dnskey->common.rdtype = rdata->type; - ISC_LINK_INIT(&dnskey->common, link); - - return (generic_tostruct_key(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/doa_259.c b/usr.bin/dig/lib/dns/rdata/generic/doa_259.c index b453017e7eb..789f2ac6c2a 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/doa_259.c +++ b/usr.bin/dig/lib/dns/rdata/generic/doa_259.c @@ -120,83 +120,6 @@ towire_doa(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_doa(ARGS_TOSTRUCT) { - dns_rdata_doa_t *doa = target; - isc_region_t region; - - REQUIRE(rdata != NULL); - REQUIRE(rdata->type == dns_rdatatype_doa); - REQUIRE(rdata->length != 0); - - doa->common.rdclass = rdata->rdclass; - doa->common.rdtype = rdata->type; - ISC_LINK_INIT(&doa->common, link); - - dns_rdata_toregion(rdata, ®ion); - - /* - * DOA-ENTERPRISE - */ - if (region.length < 4) { - return (ISC_R_UNEXPECTEDEND); - } - doa->enterprise = uint32_fromregion(®ion); - isc_region_consume(®ion, 4); - - /* - * DOA-TYPE - */ - if (region.length < 4) { - return (ISC_R_UNEXPECTEDEND); - } - doa->type = uint32_fromregion(®ion); - isc_region_consume(®ion, 4); - - /* - * DOA-LOCATION - */ - if (region.length < 1) { - return (ISC_R_UNEXPECTEDEND); - } - doa->location = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - - /* - * DOA-MEDIA-TYPE - */ - if (region.length < 1) { - return (ISC_R_UNEXPECTEDEND); - } - doa->mediatype_len = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - INSIST(doa->mediatype_len <= region.length); - doa->mediatype = mem_maybedup(region.base, doa->mediatype_len); - if (doa->mediatype == NULL) { - goto cleanup; - } - isc_region_consume(®ion, doa->mediatype_len); - - /* - * DOA-DATA - */ - doa->data_len = region.length; - doa->data = NULL; - if (doa->data_len > 0) { - doa->data = mem_maybedup(region.base, doa->data_len); - if (doa->data == NULL) { - goto cleanup; - } - isc_region_consume(®ion, doa->data_len); - } - - return (ISC_R_SUCCESS); - -cleanup: - free(doa->mediatype); - - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/ds_43.c b/usr.bin/dig/lib/dns/rdata/generic/ds_43.c index 3d88551baa1..18bcff348d6 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ds_43.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ds_43.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ds_43.c,v 1.8 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: ds_43.c,v 1.9 2020/02/24 17:45:26 florian Exp $ */ /* RFC3658 */ @@ -213,19 +213,6 @@ generic_tostruct_ds(ARGS_TOSTRUCT) { return (ISC_R_SUCCESS); } -static inline isc_result_t -tostruct_ds(ARGS_TOSTRUCT) { - dns_rdata_ds_t *ds = target; - - REQUIRE(rdata->type == dns_rdatatype_ds); - REQUIRE(target != NULL); - - ds->common.rdclass = rdata->rdclass; - ds->common.rdtype = rdata->type; - ISC_LINK_INIT(&ds->common, link); - - return (generic_tostruct_ds(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/eui48_108.c b/usr.bin/dig/lib/dns/rdata/generic/eui48_108.c index d2aa2f90a2a..6c7b2abbfb5 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/eui48_108.c +++ b/usr.bin/dig/lib/dns/rdata/generic/eui48_108.c @@ -67,21 +67,6 @@ towire_eui48(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_eui48(ARGS_TOSTRUCT) { - dns_rdata_eui48_t *eui48 = target; - - REQUIRE(rdata->type == dns_rdatatype_eui48); - REQUIRE(target != NULL); - REQUIRE(rdata->length == 6); - - eui48->common.rdclass = rdata->rdclass; - eui48->common.rdtype = rdata->type; - ISC_LINK_INIT(&eui48->common, link); - - memmove(eui48->eui48, rdata->data, rdata->length); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/eui64_109.c b/usr.bin/dig/lib/dns/rdata/generic/eui64_109.c index ca275a905f2..03b583893cd 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/eui64_109.c +++ b/usr.bin/dig/lib/dns/rdata/generic/eui64_109.c @@ -70,21 +70,6 @@ towire_eui64(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_eui64(ARGS_TOSTRUCT) { - dns_rdata_eui64_t *eui64 = target; - - REQUIRE(rdata->type == dns_rdatatype_eui64); - REQUIRE(target != NULL); - REQUIRE(rdata->length == 8); - - eui64->common.rdclass = rdata->rdclass; - eui64->common.rdtype = rdata->type; - ISC_LINK_INIT(&eui64->common, link); - - memmove(eui64->eui64, rdata->data, rdata->length); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/gpos_27.c b/usr.bin/dig/lib/dns/rdata/generic/gpos_27.c index f0d6c1f321f..8de7cecdfe5 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/gpos_27.c +++ b/usr.bin/dig/lib/dns/rdata/generic/gpos_27.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: gpos_27.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: gpos_27.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Wed Mar 15 16:48:45 PST 2000 by brister */ @@ -75,53 +75,6 @@ towire_gpos(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_gpos(ARGS_TOSTRUCT) { - dns_rdata_gpos_t *gpos = target; - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_gpos); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - gpos->common.rdclass = rdata->rdclass; - gpos->common.rdtype = rdata->type; - ISC_LINK_INIT(&gpos->common, link); - - dns_rdata_toregion(rdata, ®ion); - gpos->long_len = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - gpos->longitude = mem_maybedup(region.base, gpos->long_len); - if (gpos->longitude == NULL) - return (ISC_R_NOMEMORY); - isc_region_consume(®ion, gpos->long_len); - - gpos->lat_len = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - gpos->latitude = mem_maybedup(region.base, gpos->lat_len); - if (gpos->latitude == NULL) - goto cleanup_longitude; - isc_region_consume(®ion, gpos->lat_len); - - gpos->alt_len = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - if (gpos->lat_len > 0) { - gpos->altitude = - mem_maybedup(region.base, gpos->alt_len); - if (gpos->altitude == NULL) - goto cleanup_latitude; - } else - gpos->altitude = NULL; - - return (ISC_R_SUCCESS); - - cleanup_latitude: - free(gpos->longitude); - - cleanup_longitude: - free(gpos->latitude); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/hinfo_13.c b/usr.bin/dig/lib/dns/rdata/generic/hinfo_13.c index 07825cae16b..c7532846e4e 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/hinfo_13.c +++ b/usr.bin/dig/lib/dns/rdata/generic/hinfo_13.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hinfo_13.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: hinfo_13.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley. @@ -67,39 +67,6 @@ towire_hinfo(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_hinfo(ARGS_TOSTRUCT) { - dns_rdata_hinfo_t *hinfo = target; - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_hinfo); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - hinfo->common.rdclass = rdata->rdclass; - hinfo->common.rdtype = rdata->type; - ISC_LINK_INIT(&hinfo->common, link); - - dns_rdata_toregion(rdata, ®ion); - hinfo->cpu_len = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - hinfo->cpu = mem_maybedup(region.base, hinfo->cpu_len); - if (hinfo->cpu == NULL) - return (ISC_R_NOMEMORY); - isc_region_consume(®ion, hinfo->cpu_len); - - hinfo->os_len = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - hinfo->os = mem_maybedup(region.base, hinfo->os_len); - if (hinfo->os == NULL) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - free(hinfo->cpu); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/hip_55.c b/usr.bin/dig/lib/dns/rdata/generic/hip_55.c index fd79364cf16..71f2611e715 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/hip_55.c +++ b/usr.bin/dig/lib/dns/rdata/generic/hip_55.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: hip_55.c,v 1.8 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: hip_55.c,v 1.9 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: TBC */ @@ -147,64 +147,6 @@ towire_hip(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_hip(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_hip_t *hip = target; - - REQUIRE(rdata->type == dns_rdatatype_hip); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - hip->common.rdclass = rdata->rdclass; - hip->common.rdtype = rdata->type; - ISC_LINK_INIT(&hip->common, link); - - dns_rdata_toregion(rdata, ®ion); - - hip->hit_len = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - - hip->algorithm = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - - hip->key_len = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - - hip->hit = hip->key = hip->servers = NULL; - - hip->hit = mem_maybedup(region.base, hip->hit_len); - if (hip->hit == NULL) - goto cleanup; - isc_region_consume(®ion, hip->hit_len); - - INSIST(hip->key_len <= region.length); - - hip->key = mem_maybedup(region.base, hip->key_len); - if (hip->key == NULL) - goto cleanup; - isc_region_consume(®ion, hip->key_len); - - hip->servers_len = region.length; - if (hip->servers_len != 0) { - hip->servers = mem_maybedup(region.base, region.length); - if (hip->servers == NULL) - goto cleanup; - } - - hip->offset = hip->servers_len; - return (ISC_R_SUCCESS); - - cleanup: - if (hip->hit != NULL) - free(hip->hit); - if (hip->key != NULL) - free(hip->key); - if (hip->servers != NULL) - free(hip->servers); - return (ISC_R_NOMEMORY); - -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/ipseckey_45.c b/usr.bin/dig/lib/dns/rdata/generic/ipseckey_45.c index 4bb9dfb54aa..388c08fad1b 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ipseckey_45.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ipseckey_45.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ipseckey_45.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: ipseckey_45.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ #ifndef RDATA_GENERIC_IPSECKEY_45_C #define RDATA_GENERIC_IPSECKEY_45_C @@ -174,73 +174,6 @@ towire_ipseckey(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_ipseckey(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_ipseckey_t *ipseckey = target; - dns_name_t name; - uint32_t n; - - REQUIRE(rdata->type == dns_rdatatype_ipseckey); - REQUIRE(target != NULL); - REQUIRE(rdata->length >= 3); - - if (rdata->data[1] > 3U) - return (ISC_R_NOTIMPLEMENTED); - - ipseckey->common.rdclass = rdata->rdclass; - ipseckey->common.rdtype = rdata->type; - ISC_LINK_INIT(&ipseckey->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - - ipseckey->precedence = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - - ipseckey->gateway_type = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - - ipseckey->algorithm = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - - switch (ipseckey->gateway_type) { - case 0: - break; - - case 1: - n = uint32_fromregion(®ion); - ipseckey->in_addr.s_addr = htonl(n); - isc_region_consume(®ion, 4); - break; - - case 2: - memmove(ipseckey->in6_addr.s6_addr, region.base, 16); - isc_region_consume(®ion, 16); - break; - - case 3: - dns_name_init(&ipseckey->gateway, NULL); - dns_name_fromregion(&name, ®ion); - RETERR(name_duporclone(&name, &ipseckey->gateway)); - isc_region_consume(®ion, name_length(&name)); - break; - } - - ipseckey->keylength = region.length; - if (ipseckey->keylength != 0U) { - ipseckey->key = mem_maybedup(region.base, - ipseckey->keylength); - if (ipseckey->key == NULL) { - if (ipseckey->gateway_type == 3) - dns_name_free(&ipseckey->gateway); - return (ISC_R_NOMEMORY); - } - } else - ipseckey->key = NULL; - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/isdn_20.c b/usr.bin/dig/lib/dns/rdata/generic/isdn_20.c index ca7ce730e10..f38f3b839b3 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/isdn_20.c +++ b/usr.bin/dig/lib/dns/rdata/generic/isdn_20.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: isdn_20.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: isdn_20.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Wed Mar 15 16:53:11 PST 2000 by bwelling */ @@ -69,46 +69,6 @@ towire_isdn(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_isdn(ARGS_TOSTRUCT) { - dns_rdata_isdn_t *isdn = target; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_isdn); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - isdn->common.rdclass = rdata->rdclass; - isdn->common.rdtype = rdata->type; - ISC_LINK_INIT(&isdn->common, link); - - dns_rdata_toregion(rdata, &r); - - isdn->isdn_len = uint8_fromregion(&r); - isc_region_consume(&r, 1); - isdn->isdn = mem_maybedup(r.base, isdn->isdn_len); - if (isdn->isdn == NULL) - return (ISC_R_NOMEMORY); - isc_region_consume(&r, isdn->isdn_len); - - if (r.length == 0) { - isdn->subaddress_len = 0; - isdn->subaddress = NULL; - } else { - isdn->subaddress_len = uint8_fromregion(&r); - isc_region_consume(&r, 1); - isdn->subaddress = mem_maybedup(r.base, - isdn->subaddress_len); - if (isdn->subaddress == NULL) - goto cleanup; - } - - return (ISC_R_SUCCESS); - - cleanup: - free(isdn->isdn); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/key_25.c b/usr.bin/dig/lib/dns/rdata/generic/key_25.c index 1fb9c463efb..22cee401752 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/key_25.c +++ b/usr.bin/dig/lib/dns/rdata/generic/key_25.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: key_25.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: key_25.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley. @@ -277,20 +277,6 @@ generic_freestruct_key(ARGS_FREESTRUCT) { } -static inline isc_result_t -tostruct_key(ARGS_TOSTRUCT) { - dns_rdata_key_t *key = target; - - REQUIRE(key != NULL); - REQUIRE(rdata != NULL); - REQUIRE(rdata->type == dns_rdatatype_key); - - key->common.rdclass = rdata->rdclass; - key->common.rdtype = rdata->type; - ISC_LINK_INIT(&key->common, link); - - return (generic_tostruct_key(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c b/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c index e45e42f0839..af4a8f3211d 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c +++ b/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c @@ -223,64 +223,6 @@ towire_keydata(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_keydata(ARGS_TOSTRUCT) { - dns_rdata_keydata_t *keydata = target; - isc_region_t sr; - - REQUIRE(rdata->type == dns_rdatatype_keydata); - REQUIRE(target != NULL); - - keydata->common.rdclass = rdata->rdclass; - keydata->common.rdtype = rdata->type; - ISC_LINK_INIT(&keydata->common, link); - - dns_rdata_toregion(rdata, &sr); - - /* Refresh timer */ - if (sr.length < 4) - return (ISC_R_UNEXPECTEDEND); - keydata->refresh = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* Add hold-down */ - if (sr.length < 4) - return (ISC_R_UNEXPECTEDEND); - keydata->addhd = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* Remove hold-down */ - if (sr.length < 4) - return (ISC_R_UNEXPECTEDEND); - keydata->removehd = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* Flags */ - if (sr.length < 2) - return (ISC_R_UNEXPECTEDEND); - keydata->flags = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* Protocol */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - keydata->protocol = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Algorithm */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - keydata->algorithm = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Data */ - keydata->datalen = sr.length; - keydata->data = mem_maybedup(sr.base, keydata->datalen); - if (keydata->data == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/l32_105.c b/usr.bin/dig/lib/dns/rdata/generic/l32_105.c index 9f69b3964b8..e806f78415c 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/l32_105.c +++ b/usr.bin/dig/lib/dns/rdata/generic/l32_105.c @@ -76,26 +76,6 @@ towire_l32(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_l32(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_l32_t *l32 = target; - uint32_t n; - - REQUIRE(rdata->type == dns_rdatatype_l32); - REQUIRE(target != NULL); - REQUIRE(rdata->length == 6); - - l32->common.rdclass = rdata->rdclass; - l32->common.rdtype = rdata->type; - ISC_LINK_INIT(&l32->common, link); - - dns_rdata_toregion(rdata, ®ion); - l32->pref = uint16_fromregion(®ion); - n = uint32_fromregion(®ion); - l32->l32.s_addr = htonl(n); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/l64_106.c b/usr.bin/dig/lib/dns/rdata/generic/l64_106.c index eb39aa7a9fb..5e4b5c2646e 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/l64_106.c +++ b/usr.bin/dig/lib/dns/rdata/generic/l64_106.c @@ -81,24 +81,6 @@ towire_l64(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_l64(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_l64_t *l64 = target; - - REQUIRE(rdata->type == dns_rdatatype_l64); - REQUIRE(target != NULL); - REQUIRE(rdata->length == 10); - - l64->common.rdclass = rdata->rdclass; - l64->common.rdtype = rdata->type; - ISC_LINK_INIT(&l64->common, link); - - dns_rdata_toregion(rdata, ®ion); - l64->pref = uint16_fromregion(®ion); - memmove(l64->l64, region.base, region.length); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/loc_29.c b/usr.bin/dig/lib/dns/rdata/generic/loc_29.c index 8c55a875baa..de0064f6514 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/loc_29.c +++ b/usr.bin/dig/lib/dns/rdata/generic/loc_29.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: loc_29.c,v 1.7 2020/02/24 17:44:44 florian Exp $ */ +/* $Id: loc_29.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Wed Mar 15 18:13:09 PST 2000 by explorer */ @@ -231,41 +231,6 @@ towire_loc(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_loc(ARGS_TOSTRUCT) { - dns_rdata_loc_t *loc = target; - isc_region_t r; - uint8_t version; - - REQUIRE(rdata->type == dns_rdatatype_loc); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - dns_rdata_toregion(rdata, &r); - version = uint8_fromregion(&r); - if (version != 0) - return (ISC_R_NOTIMPLEMENTED); - - loc->common.rdclass = rdata->rdclass; - loc->common.rdtype = rdata->type; - ISC_LINK_INIT(&loc->common, link); - - loc->v.v0.version = version; - isc_region_consume(&r, 1); - loc->v.v0.size = uint8_fromregion(&r); - isc_region_consume(&r, 1); - loc->v.v0.horizontal = uint8_fromregion(&r); - isc_region_consume(&r, 1); - loc->v.v0.vertical = uint8_fromregion(&r); - isc_region_consume(&r, 1); - loc->v.v0.latitude = uint32_fromregion(&r); - isc_region_consume(&r, 4); - loc->v.v0.longitude = uint32_fromregion(&r); - isc_region_consume(&r, 4); - loc->v.v0.altitude = uint32_fromregion(&r); - isc_region_consume(&r, 4); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/lp_107.c b/usr.bin/dig/lib/dns/rdata/generic/lp_107.c index 6e4b8e67dc9..f3e4c94a9d9 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/lp_107.c +++ b/usr.bin/dig/lib/dns/rdata/generic/lp_107.c @@ -86,29 +86,6 @@ towire_lp(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_lp(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_lp_t *lp = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_lp); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - lp->common.rdclass = rdata->rdclass; - lp->common.rdtype = rdata->type; - ISC_LINK_INIT(&lp->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - lp->pref = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - dns_name_fromregion(&name, ®ion); - dns_name_init(&lp->lp, NULL); - RETERR(name_duporclone(&name, &lp->lp)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/mb_7.c b/usr.bin/dig/lib/dns/rdata/generic/mb_7.c index ef1a0b1d765..535a04e0bc3 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mb_7.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mb_7.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mb_7.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: mb_7.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Wed Mar 15 17:31:26 PST 2000 by bwelling */ @@ -79,27 +79,6 @@ towire_mb(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_mb(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_mb_t *mb = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_mb); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - mb->common.rdclass = rdata->rdclass; - mb->common.rdtype = rdata->type; - ISC_LINK_INIT(&mb->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - dns_name_init(&mb->mb, NULL); - RETERR(name_duporclone(&name, &mb->mb)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/md_3.c b/usr.bin/dig/lib/dns/rdata/generic/md_3.c index cdfd7020d2c..8812d217984 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/md_3.c +++ b/usr.bin/dig/lib/dns/rdata/generic/md_3.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: md_3.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: md_3.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Wed Mar 15 17:48:20 PST 2000 by bwelling */ @@ -79,27 +79,6 @@ towire_md(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_md(ARGS_TOSTRUCT) { - dns_rdata_md_t *md = target; - isc_region_t r; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_md); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - md->common.rdclass = rdata->rdclass; - md->common.rdtype = rdata->type; - ISC_LINK_INIT(&md->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, &r); - dns_name_fromregion(&name, &r); - dns_name_init(&md->md, NULL); - RETERR(name_duporclone(&name, &md->md)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/mf_4.c b/usr.bin/dig/lib/dns/rdata/generic/mf_4.c index 3fd8a7196a9..31909120ceb 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mf_4.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mf_4.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mf_4.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: mf_4.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Wed Mar 15 17:47:33 PST 2000 by brister */ @@ -79,27 +79,6 @@ towire_mf(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_mf(ARGS_TOSTRUCT) { - dns_rdata_mf_t *mf = target; - isc_region_t r; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_mf); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - mf->common.rdclass = rdata->rdclass; - mf->common.rdtype = rdata->type; - ISC_LINK_INIT(&mf->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, &r); - dns_name_fromregion(&name, &r); - dns_name_init(&mf->mf, NULL); - RETERR(name_duporclone(&name, &mf->mf)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/mg_8.c b/usr.bin/dig/lib/dns/rdata/generic/mg_8.c index 8c27a8b0673..ec426908185 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mg_8.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mg_8.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mg_8.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: mg_8.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Wed Mar 15 17:49:21 PST 2000 by brister */ @@ -79,27 +79,6 @@ towire_mg(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_mg(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_mg_t *mg = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_mg); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - mg->common.rdclass = rdata->rdclass; - mg->common.rdtype = rdata->type; - ISC_LINK_INIT(&mg->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - dns_name_init(&mg->mg, NULL); - RETERR(name_duporclone(&name, &mg->mg)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/minfo_14.c b/usr.bin/dig/lib/dns/rdata/generic/minfo_14.c index 43eb43179b5..03527f76c51 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/minfo_14.c +++ b/usr.bin/dig/lib/dns/rdata/generic/minfo_14.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: minfo_14.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: minfo_14.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Wed Mar 15 17:45:32 PST 2000 by brister */ @@ -106,39 +106,6 @@ towire_minfo(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_minfo(ARGS_TOSTRUCT) { - dns_rdata_minfo_t *minfo = target; - isc_region_t region; - dns_name_t name; - isc_result_t result; - - REQUIRE(rdata->type == dns_rdatatype_minfo); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - minfo->common.rdclass = rdata->rdclass; - minfo->common.rdtype = rdata->type; - ISC_LINK_INIT(&minfo->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - dns_name_init(&minfo->rmailbox, NULL); - RETERR(name_duporclone(&name, &minfo->rmailbox)); - isc_region_consume(®ion, name_length(&name)); - - dns_name_fromregion(&name, ®ion); - dns_name_init(&minfo->emailbox, NULL); - result = name_duporclone(&name, &minfo->emailbox); - if (result != ISC_R_SUCCESS) - goto cleanup; - return (ISC_R_SUCCESS); - - cleanup: - dns_name_free(&minfo->rmailbox); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/mr_9.c b/usr.bin/dig/lib/dns/rdata/generic/mr_9.c index c302f71727f..099cb4ff82b 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mr_9.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mr_9.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mr_9.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: mr_9.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Wed Mar 15 21:30:35 EST 2000 by tale */ @@ -79,27 +79,6 @@ towire_mr(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_mr(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_mr_t *mr = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_mr); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - mr->common.rdclass = rdata->rdclass; - mr->common.rdtype = rdata->type; - ISC_LINK_INIT(&mr->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - dns_name_init(&mr->mr, NULL); - RETERR(name_duporclone(&name, &mr->mr)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/mx_15.c b/usr.bin/dig/lib/dns/rdata/generic/mx_15.c index 5cd72d74ddf..6913b903e4e 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/mx_15.c +++ b/usr.bin/dig/lib/dns/rdata/generic/mx_15.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: mx_15.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: mx_15.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Wed Mar 15 18:05:46 PST 2000 by brister */ @@ -100,29 +100,6 @@ towire_mx(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_mx(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_mx_t *mx = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_mx); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - mx->common.rdclass = rdata->rdclass; - mx->common.rdtype = rdata->type; - ISC_LINK_INIT(&mx->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - mx->pref = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - dns_name_fromregion(&name, ®ion); - dns_name_init(&mx->mx, NULL); - RETERR(name_duporclone(&name, &mx->mx)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/naptr_35.c b/usr.bin/dig/lib/dns/rdata/generic/naptr_35.c index e32df26ac2b..e6fb3ce44a1 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/naptr_35.c +++ b/usr.bin/dig/lib/dns/rdata/generic/naptr_35.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: naptr_35.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: naptr_35.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */ @@ -272,71 +272,6 @@ towire_naptr(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_naptr(ARGS_TOSTRUCT) { - dns_rdata_naptr_t *naptr = target; - isc_region_t r; - isc_result_t result; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_naptr); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - naptr->common.rdclass = rdata->rdclass; - naptr->common.rdtype = rdata->type; - ISC_LINK_INIT(&naptr->common, link); - - naptr->flags = NULL; - naptr->service = NULL; - naptr->regexp = NULL; - - dns_rdata_toregion(rdata, &r); - - naptr->order = uint16_fromregion(&r); - isc_region_consume(&r, 2); - - naptr->preference = uint16_fromregion(&r); - isc_region_consume(&r, 2); - - naptr->flags_len = uint8_fromregion(&r); - isc_region_consume(&r, 1); - INSIST(naptr->flags_len <= r.length); - naptr->flags = mem_maybedup(r.base, naptr->flags_len); - if (naptr->flags == NULL) - goto cleanup; - isc_region_consume(&r, naptr->flags_len); - - naptr->service_len = uint8_fromregion(&r); - isc_region_consume(&r, 1); - INSIST(naptr->service_len <= r.length); - naptr->service = mem_maybedup(r.base, naptr->service_len); - if (naptr->service == NULL) - goto cleanup; - isc_region_consume(&r, naptr->service_len); - - naptr->regexp_len = uint8_fromregion(&r); - isc_region_consume(&r, 1); - INSIST(naptr->regexp_len <= r.length); - naptr->regexp = mem_maybedup(r.base, naptr->regexp_len); - if (naptr->regexp == NULL) - goto cleanup; - isc_region_consume(&r, naptr->regexp_len); - - dns_name_init(&name, NULL); - dns_name_fromregion(&name, &r); - dns_name_init(&naptr->replacement, NULL); - result = name_duporclone(&name, &naptr->replacement); - if (result != ISC_R_SUCCESS) - goto cleanup; - return (ISC_R_SUCCESS); - - cleanup: - free(naptr->flags); - free(naptr->service); - free(naptr->regexp); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/nid_104.c b/usr.bin/dig/lib/dns/rdata/generic/nid_104.c index 5894fa02ea3..4e825d7ee7d 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nid_104.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nid_104.c @@ -81,24 +81,6 @@ towire_nid(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_nid(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_nid_t *nid = target; - - REQUIRE(rdata->type == dns_rdatatype_nid); - REQUIRE(target != NULL); - REQUIRE(rdata->length == 10); - - nid->common.rdclass = rdata->rdclass; - nid->common.rdtype = rdata->type; - ISC_LINK_INIT(&nid->common, link); - - dns_rdata_toregion(rdata, ®ion); - nid->pref = uint16_fromregion(®ion); - memmove(nid->nid, region.base, region.length); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/ninfo_56.c b/usr.bin/dig/lib/dns/rdata/generic/ninfo_56.c index 6b6d6593833..28cabe12c77 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ninfo_56.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ninfo_56.c @@ -55,18 +55,6 @@ towire_ninfo(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_ninfo(ARGS_TOSTRUCT) { - dns_rdata_ninfo_t *txt = target; - - REQUIRE(rdata->type == dns_rdatatype_ninfo); - - txt->common.rdclass = rdata->rdclass; - txt->common.rdtype = rdata->type; - ISC_LINK_INIT(&txt->common, link); - - return (generic_tostruct_txt(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/nsec3_50.c b/usr.bin/dig/lib/dns/rdata/generic/nsec3_50.c index ca76bb9c8c7..ea915659e1f 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nsec3_50.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nsec3_50.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec3_50.c,v 1.6 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: nsec3_50.c,v 1.7 2020/02/24 17:45:26 florian Exp $ */ /* * Copyright (C) 2004 Nominet, Ltd. @@ -170,50 +170,6 @@ towire_nsec3(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_nsec3(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_nsec3_t *nsec3 = target; - - REQUIRE(rdata->type == dns_rdatatype_nsec3); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - nsec3->common.rdclass = rdata->rdclass; - nsec3->common.rdtype = rdata->type; - ISC_LINK_INIT(&nsec3->common, link); - - region.base = rdata->data; - region.length = rdata->length; - nsec3->hash = uint8_consume_fromregion(®ion); - nsec3->flags = uint8_consume_fromregion(®ion); - nsec3->iterations = uint16_consume_fromregion(®ion); - - nsec3->salt_length = uint8_consume_fromregion(®ion); - nsec3->salt = mem_maybedup(region.base, nsec3->salt_length); - if (nsec3->salt == NULL) - return (ISC_R_NOMEMORY); - isc_region_consume(®ion, nsec3->salt_length); - - nsec3->next_length = uint8_consume_fromregion(®ion); - nsec3->next = mem_maybedup(region.base, nsec3->next_length); - if (nsec3->next == NULL) - goto cleanup; - isc_region_consume(®ion, nsec3->next_length); - - nsec3->len = region.length; - nsec3->typebits = mem_maybedup(region.base, region.length); - if (nsec3->typebits == NULL) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - if (nsec3->next != NULL) - free(nsec3->next); - free(nsec3->salt); - return (ISC_R_NOMEMORY); -} #define NSEC3_MAX_HASH_LENGTH 155 diff --git a/usr.bin/dig/lib/dns/rdata/generic/nsec3param_51.c b/usr.bin/dig/lib/dns/rdata/generic/nsec3param_51.c index 3ef040b5768..bca5b43c080 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nsec3param_51.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nsec3param_51.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec3param_51.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: nsec3param_51.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* * Copyright (C) 2004 Nominet, Ltd. @@ -134,34 +134,6 @@ towire_nsec3param(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_nsec3param(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_nsec3param_t *nsec3param = target; - - REQUIRE(rdata->type == dns_rdatatype_nsec3param); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - nsec3param->common.rdclass = rdata->rdclass; - nsec3param->common.rdtype = rdata->type; - ISC_LINK_INIT(&nsec3param->common, link); - - region.base = rdata->data; - region.length = rdata->length; - nsec3param->hash = uint8_consume_fromregion(®ion); - nsec3param->flags = uint8_consume_fromregion(®ion); - nsec3param->iterations = uint16_consume_fromregion(®ion); - - nsec3param->salt_length = uint8_consume_fromregion(®ion); - nsec3param->salt = mem_maybedup(region.base, - nsec3param->salt_length); - if (nsec3param->salt == NULL) - return (ISC_R_NOMEMORY); - isc_region_consume(®ion, nsec3param->salt_length); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/nsec_47.c b/usr.bin/dig/lib/dns/rdata/generic/nsec_47.c index 657efea71da..394774358e4 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nsec_47.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nsec_47.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsec_47.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: nsec_47.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */ @@ -96,38 +96,6 @@ towire_nsec(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_nsec(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_nsec_t *nsec = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_nsec); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - nsec->common.rdclass = rdata->rdclass; - nsec->common.rdtype = rdata->type; - ISC_LINK_INIT(&nsec->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - isc_region_consume(®ion, name_length(&name)); - dns_name_init(&nsec->next, NULL); - RETERR(name_duporclone(&name, &nsec->next)); - - nsec->len = region.length; - nsec->typebits = mem_maybedup(region.base, region.length); - if (nsec->typebits == NULL) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - dns_name_free(&nsec->next); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/null_10.c b/usr.bin/dig/lib/dns/rdata/generic/null_10.c index 7b5e92e58d0..47792a568ee 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/null_10.c +++ b/usr.bin/dig/lib/dns/rdata/generic/null_10.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: null_10.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: null_10.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Thu Mar 16 13:57:50 PST 2000 by explorer */ @@ -57,26 +57,6 @@ towire_null(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_null(ARGS_TOSTRUCT) { - dns_rdata_null_t *null = target; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_null); - REQUIRE(target != NULL); - - null->common.rdclass = rdata->rdclass; - null->common.rdtype = rdata->type; - ISC_LINK_INIT(&null->common, link); - - dns_rdata_toregion(rdata, &r); - null->length = r.length; - null->data = mem_maybedup(r.base, r.length); - if (null->data == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/nxt_30.c b/usr.bin/dig/lib/dns/rdata/generic/nxt_30.c index b8cb016923f..3617fd7f3c6 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/nxt_30.c +++ b/usr.bin/dig/lib/dns/rdata/generic/nxt_30.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nxt_30.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: nxt_30.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */ @@ -114,38 +114,6 @@ towire_nxt(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_nxt(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_nxt_t *nxt = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_nxt); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - nxt->common.rdclass = rdata->rdclass; - nxt->common.rdtype = rdata->type; - ISC_LINK_INIT(&nxt->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - isc_region_consume(®ion, name_length(&name)); - dns_name_init(&nxt->next, NULL); - RETERR(name_duporclone(&name, &nxt->next)); - - nxt->len = region.length; - nxt->typebits = mem_maybedup(region.base, region.length); - if (nxt->typebits == NULL) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - dns_name_free(&nxt->next); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/openpgpkey_61.c b/usr.bin/dig/lib/dns/rdata/generic/openpgpkey_61.c index d7d3c3d134e..320a93c819f 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/openpgpkey_61.c +++ b/usr.bin/dig/lib/dns/rdata/generic/openpgpkey_61.c @@ -85,34 +85,6 @@ towire_openpgpkey(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_openpgpkey(ARGS_TOSTRUCT) { - isc_region_t sr; - dns_rdata_openpgpkey_t *sig = target; - - REQUIRE(rdata->type == dns_rdatatype_openpgpkey); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - sig->common.rdclass = rdata->rdclass; - sig->common.rdtype = rdata->type; - ISC_LINK_INIT(&sig->common, link); - - dns_rdata_toregion(rdata, &sr); - - /* - * Keyring. - */ - sig->length = sr.length; - sig->keyring = mem_maybedup(sr.base, sig->length); - if (sig->keyring == NULL) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/opt_41.c b/usr.bin/dig/lib/dns/rdata/generic/opt_41.c index b4f170a2385..63ad1bd1cdf 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/opt_41.c +++ b/usr.bin/dig/lib/dns/rdata/generic/opt_41.c @@ -202,27 +202,6 @@ towire_opt(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_opt(ARGS_TOSTRUCT) { - dns_rdata_opt_t *opt = target; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_opt); - REQUIRE(target != NULL); - - opt->common.rdclass = rdata->rdclass; - opt->common.rdtype = rdata->type; - ISC_LINK_INIT(&opt->common, link); - - dns_rdata_toregion(rdata, &r); - opt->length = r.length; - opt->options = mem_maybedup(r.base, r.length); - if (opt->options == NULL) - return (ISC_R_NOMEMORY); - - opt->offset = 0; - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/proforma.c b/usr.bin/dig/lib/dns/rdata/generic/proforma.c index 4cf5ae6c1f2..01ef624a7a7 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/proforma.c +++ b/usr.bin/dig/lib/dns/rdata/generic/proforma.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: proforma.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: proforma.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ #ifndef RDATA_GENERIC_#_#_C #define RDATA_GENERIC_#_#_C @@ -58,15 +58,6 @@ towire_#(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_#(ARGS_TOSTRUCT) { - - REQUIRE(rdata->type == dns_rdatatype_proforma.c#); - REQUIRE(rdata->rdclass == #); - REQUIRE(rdata->length != 0); /* XXX */ - - return (ISC_R_NOTIMPLEMENTED); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/ptr_12.c b/usr.bin/dig/lib/dns/rdata/generic/ptr_12.c index 6bfb8a46214..7fe86c3ea24 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ptr_12.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ptr_12.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: ptr_12.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: ptr_12.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Thu Mar 16 14:05:12 PST 2000 by explorer */ @@ -79,27 +79,6 @@ towire_ptr(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_ptr(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_ptr_t *ptr = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_ptr); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - ptr->common.rdclass = rdata->rdclass; - ptr->common.rdtype = rdata->type; - ISC_LINK_INIT(&ptr->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - dns_name_init(&ptr->ptr, NULL); - RETERR(name_duporclone(&name, &ptr->ptr)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/rkey_57.c b/usr.bin/dig/lib/dns/rdata/generic/rkey_57.c index 420b48fa3f9..e1de7a8a666 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/rkey_57.c +++ b/usr.bin/dig/lib/dns/rdata/generic/rkey_57.c @@ -53,20 +53,6 @@ towire_rkey(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_rkey(ARGS_TOSTRUCT) { - dns_rdata_rkey_t *rkey = target; - - REQUIRE(rkey != NULL); - REQUIRE(rdata != NULL); - REQUIRE(rdata->type == dns_rdatatype_rkey); - - rkey->common.rdclass = rdata->rdclass; - rkey->common.rdtype = rdata->type; - ISC_LINK_INIT(&rkey->common, link); - - return (generic_tostruct_key(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/rp_17.c b/usr.bin/dig/lib/dns/rdata/generic/rp_17.c index 923727578b4..1f58648a28a 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/rp_17.c +++ b/usr.bin/dig/lib/dns/rdata/generic/rp_17.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rp_17.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: rp_17.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* RFC1183 */ @@ -104,39 +104,6 @@ towire_rp(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_rp(ARGS_TOSTRUCT) { - isc_result_t result; - isc_region_t region; - dns_rdata_rp_t *rp = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_rp); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - rp->common.rdclass = rdata->rdclass; - rp->common.rdtype = rdata->type; - ISC_LINK_INIT(&rp->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - dns_name_init(&rp->mail, NULL); - RETERR(name_duporclone(&name, &rp->mail)); - isc_region_consume(®ion, name_length(&name)); - dns_name_fromregion(&name, ®ion); - dns_name_init(&rp->text, NULL); - result = name_duporclone(&name, &rp->text); - if (result != ISC_R_SUCCESS) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - dns_name_free(&rp->mail); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/rrsig_46.c b/usr.bin/dig/lib/dns/rdata/generic/rrsig_46.c index 84c25c07cb2..6583c36be19 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/rrsig_46.c +++ b/usr.bin/dig/lib/dns/rdata/generic/rrsig_46.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rrsig_46.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: rrsig_46.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */ @@ -219,84 +219,6 @@ towire_rrsig(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_rrsig(ARGS_TOSTRUCT) { - isc_region_t sr; - dns_rdata_rrsig_t *sig = target; - dns_name_t signer; - - REQUIRE(rdata->type == dns_rdatatype_rrsig); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - sig->common.rdclass = rdata->rdclass; - sig->common.rdtype = rdata->type; - ISC_LINK_INIT(&sig->common, link); - - dns_rdata_toregion(rdata, &sr); - - /* - * Type covered. - */ - sig->covered = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* - * Algorithm. - */ - sig->algorithm = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* - * Labels. - */ - sig->labels = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* - * Original TTL. - */ - sig->originalttl = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* - * Expire time. - */ - sig->timeexpire = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* - * Time signed. - */ - sig->timesigned = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* - * Key ID. - */ - sig->keyid = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - dns_name_init(&signer, NULL); - dns_name_fromregion(&signer, &sr); - dns_name_init(&sig->signer, NULL); - RETERR(name_duporclone(&signer, &sig->signer)); - isc_region_consume(&sr, name_length(&sig->signer)); - - /* - * Signature. - */ - sig->siglen = sr.length; - sig->signature = mem_maybedup(sr.base, sig->siglen); - if (sig->signature == NULL) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - dns_name_free(&sig->signer); - return (ISC_R_NOMEMORY); -} static inline dns_rdatatype_t diff --git a/usr.bin/dig/lib/dns/rdata/generic/rt_21.c b/usr.bin/dig/lib/dns/rdata/generic/rt_21.c index bb50358397b..bc7b71ad7b9 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/rt_21.c +++ b/usr.bin/dig/lib/dns/rdata/generic/rt_21.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rt_21.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: rt_21.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Thu Mar 16 15:02:31 PST 2000 by brister */ @@ -105,30 +105,6 @@ towire_rt(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_rt(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_rt_t *rt = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_rt); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - rt->common.rdclass = rdata->rdclass; - rt->common.rdtype = rdata->type; - ISC_LINK_INIT(&rt->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - rt->preference = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - dns_name_fromregion(&name, ®ion); - dns_name_init(&rt->host, NULL); - RETERR(name_duporclone(&name, &rt->host)); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/sig_24.c b/usr.bin/dig/lib/dns/rdata/generic/sig_24.c index 904388e9101..a0f20910101 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/sig_24.c +++ b/usr.bin/dig/lib/dns/rdata/generic/sig_24.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sig_24.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: sig_24.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */ @@ -219,85 +219,6 @@ towire_sig(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_sig(ARGS_TOSTRUCT) { - isc_region_t sr; - dns_rdata_sig_t *sig = target; - dns_name_t signer; - - REQUIRE(rdata->type == dns_rdatatype_sig); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - sig->common.rdclass = rdata->rdclass; - sig->common.rdtype = rdata->type; - ISC_LINK_INIT(&sig->common, link); - - dns_rdata_toregion(rdata, &sr); - - /* - * Type covered. - */ - sig->covered = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* - * Algorithm. - */ - sig->algorithm = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* - * Labels. - */ - sig->labels = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* - * Original TTL. - */ - sig->originalttl = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* - * Expire time. - */ - sig->timeexpire = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* - * Time signed. - */ - sig->timesigned = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* - * Key ID. - */ - sig->keyid = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - dns_name_init(&signer, NULL); - dns_name_fromregion(&signer, &sr); - dns_name_init(&sig->signer, NULL); - RETERR(name_duporclone(&signer, &sig->signer)); - isc_region_consume(&sr, name_length(&sig->signer)); - - /* - * Signature. - */ - sig->siglen = sr.length; - sig->signature = mem_maybedup(sr.base, sig->siglen); - if (sig->signature == NULL) - goto cleanup; - - - return (ISC_R_SUCCESS); - - cleanup: - dns_name_free(&sig->signer); - return (ISC_R_NOMEMORY); -} static inline dns_rdatatype_t diff --git a/usr.bin/dig/lib/dns/rdata/generic/sink_40.c b/usr.bin/dig/lib/dns/rdata/generic/sink_40.c index 74bdcc842e4..f85ed5cc169 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/sink_40.c +++ b/usr.bin/dig/lib/dns/rdata/generic/sink_40.c @@ -96,47 +96,6 @@ towire_sink(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_sink(ARGS_TOSTRUCT) { - dns_rdata_sink_t *sink = target; - isc_region_t sr; - - REQUIRE(rdata->type == dns_rdatatype_sink); - REQUIRE(target != NULL); - REQUIRE(rdata->length >= 3); - - sink->common.rdclass = rdata->rdclass; - sink->common.rdtype = rdata->type; - ISC_LINK_INIT(&sink->common, link); - - dns_rdata_toregion(rdata, &sr); - - /* Meaning */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - sink->meaning = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Coding */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - sink->coding = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Subcoding */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - sink->subcoding = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Data */ - sink->datalen = sr.length; - sink->data = mem_maybedup(sr.base, sink->datalen); - if (sink->data == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/smimea_53.c b/usr.bin/dig/lib/dns/rdata/generic/smimea_53.c index d25574479f9..2448b325776 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/smimea_53.c +++ b/usr.bin/dig/lib/dns/rdata/generic/smimea_53.c @@ -51,19 +51,6 @@ towire_smimea(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_smimea(ARGS_TOSTRUCT) { - dns_rdata_txt_t *txt = target; - - REQUIRE(rdata->type == dns_rdatatype_smimea); - REQUIRE(target != NULL); - - txt->common.rdclass = rdata->rdclass; - txt->common.rdtype = rdata->type; - ISC_LINK_INIT(&txt->common, link); - - return (generic_tostruct_tlsa(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/spf_99.c b/usr.bin/dig/lib/dns/rdata/generic/spf_99.c index 1ae4e0d0339..162e82d64b4 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/spf_99.c +++ b/usr.bin/dig/lib/dns/rdata/generic/spf_99.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: spf_99.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: spf_99.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Thu Mar 16 15:40:00 PST 2000 by bwelling */ @@ -59,19 +59,6 @@ towire_spf(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_spf(ARGS_TOSTRUCT) { - dns_rdata_spf_t *spf = target; - - REQUIRE(rdata->type == dns_rdatatype_spf); - REQUIRE(target != NULL); - - spf->common.rdclass = rdata->rdclass; - spf->common.rdtype = rdata->type; - ISC_LINK_INIT(&spf->common, link); - - return (generic_tostruct_txt(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/sshfp_44.c b/usr.bin/dig/lib/dns/rdata/generic/sshfp_44.c index 069155c8ff6..ed6bd262ee5 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/sshfp_44.c +++ b/usr.bin/dig/lib/dns/rdata/generic/sshfp_44.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sshfp_44.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: sshfp_44.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* RFC 4255 */ @@ -102,33 +102,6 @@ towire_sshfp(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_sshfp(ARGS_TOSTRUCT) { - dns_rdata_sshfp_t *sshfp = target; - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_sshfp); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - sshfp->common.rdclass = rdata->rdclass; - sshfp->common.rdtype = rdata->type; - ISC_LINK_INIT(&sshfp->common, link); - - dns_rdata_toregion(rdata, ®ion); - - sshfp->algorithm = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - sshfp->digest_type = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - sshfp->length = region.length; - - sshfp->digest = mem_maybedup(region.base, region.length); - if (sshfp->digest == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/ta_32768.c b/usr.bin/dig/lib/dns/rdata/generic/ta_32768.c index 740541ca029..42841e9d52d 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/ta_32768.c +++ b/usr.bin/dig/lib/dns/rdata/generic/ta_32768.c @@ -53,21 +53,6 @@ towire_ta(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_ta(ARGS_TOSTRUCT) { - dns_rdata_ds_t *ds = target; - - REQUIRE(rdata->type == dns_rdatatype_ta); - - /* - * Checked by generic_tostruct_ds(). - */ - ds->common.rdclass = rdata->rdclass; - ds->common.rdtype = rdata->type; - ISC_LINK_INIT(&ds->common, link); - - return (generic_tostruct_ds(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/talink_58.c b/usr.bin/dig/lib/dns/rdata/generic/talink_58.c index 50bc95ae483..733d479c446 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/talink_58.c +++ b/usr.bin/dig/lib/dns/rdata/generic/talink_58.c @@ -99,42 +99,6 @@ towire_talink(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_talink(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_talink_t *talink = target; - dns_name_t name; - isc_result_t result; - - REQUIRE(rdata->type == dns_rdatatype_talink); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - talink->common.rdclass = rdata->rdclass; - talink->common.rdtype = rdata->type; - ISC_LINK_INIT(&talink->common, link); - - dns_rdata_toregion(rdata, ®ion); - - dns_name_init(&name, NULL); - dns_name_fromregion(&name, ®ion); - isc_region_consume(®ion, name_length(&name)); - dns_name_init(&talink->prev, NULL); - RETERR(name_duporclone(&name, &talink->prev)); - - dns_name_fromregion(&name, ®ion); - isc_region_consume(®ion, name_length(&name)); - dns_name_init(&talink->next, NULL); - result = name_duporclone(&name, &talink->next); - if (result != ISC_R_SUCCESS) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - dns_name_free(&talink->prev); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/tkey_249.c b/usr.bin/dig/lib/dns/rdata/generic/tkey_249.c index 95494ab29bb..711f18ca2af 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/tkey_249.c +++ b/usr.bin/dig/lib/dns/rdata/generic/tkey_249.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: tkey_249.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: tkey_249.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* * Reviewed: Thu Mar 16 17:35:30 PST 2000 by halley. @@ -225,92 +225,6 @@ towire_tkey(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_tkey(ARGS_TOSTRUCT) { - dns_rdata_tkey_t *tkey = target; - dns_name_t alg; - isc_region_t sr; - - REQUIRE(rdata->type == dns_rdatatype_tkey); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - tkey->common.rdclass = rdata->rdclass; - tkey->common.rdtype = rdata->type; - ISC_LINK_INIT(&tkey->common, link); - - dns_rdata_toregion(rdata, &sr); - - /* - * Algorithm Name. - */ - dns_name_init(&alg, NULL); - dns_name_fromregion(&alg, &sr); - dns_name_init(&tkey->algorithm, NULL); - RETERR(name_duporclone(&alg, &tkey->algorithm)); - isc_region_consume(&sr, name_length(&tkey->algorithm)); - - /* - * Inception. - */ - tkey->inception = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* - * Expire. - */ - tkey->expire = uint32_fromregion(&sr); - isc_region_consume(&sr, 4); - - /* - * Mode. - */ - tkey->mode = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* - * Error. - */ - tkey->error = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* - * Key size. - */ - tkey->keylen = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* - * Key. - */ - INSIST(tkey->keylen + 2U <= sr.length); - tkey->key = mem_maybedup(sr.base, tkey->keylen); - if (tkey->key == NULL) - goto cleanup; - isc_region_consume(&sr, tkey->keylen); - - /* - * Other size. - */ - tkey->otherlen = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* - * Other. - */ - INSIST(tkey->otherlen <= sr.length); - tkey->other = mem_maybedup(sr.base, tkey->otherlen); - if (tkey->other == NULL) - goto cleanup; - - return (ISC_R_SUCCESS); - - cleanup: - dns_name_free(&tkey->algorithm); - if (tkey->key != NULL) - free(tkey->key); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/tlsa_52.c b/usr.bin/dig/lib/dns/rdata/generic/tlsa_52.c index 03fdabe51fe..d16e5f0e48d 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/tlsa_52.c +++ b/usr.bin/dig/lib/dns/rdata/generic/tlsa_52.c @@ -180,19 +180,6 @@ generic_freestruct_tlsa(ARGS_FREESTRUCT) { } -static inline isc_result_t -tostruct_tlsa(ARGS_TOSTRUCT) { - dns_rdata_txt_t *txt = target; - - REQUIRE(rdata->type == dns_rdatatype_tlsa); - REQUIRE(target != NULL); - - txt->common.rdclass = rdata->rdclass; - txt->common.rdtype = rdata->type; - ISC_LINK_INIT(&txt->common, link); - - return (generic_tostruct_tlsa(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/txt_16.c b/usr.bin/dig/lib/dns/rdata/generic/txt_16.c index 4c80af029ef..14d67b41c7c 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/txt_16.c +++ b/usr.bin/dig/lib/dns/rdata/generic/txt_16.c @@ -141,19 +141,6 @@ generic_freestruct_txt(ARGS_FREESTRUCT) { } -static inline isc_result_t -tostruct_txt(ARGS_TOSTRUCT) { - dns_rdata_txt_t *txt = target; - - REQUIRE(rdata->type == dns_rdatatype_txt); - REQUIRE(target != NULL); - - txt->common.rdclass = rdata->rdclass; - txt->common.rdtype = rdata->type; - ISC_LINK_INIT(&txt->common, link); - - return (generic_tostruct_txt(rdata, target)); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c b/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c index 9dcd51a4644..d187d304b80 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c +++ b/usr.bin/dig/lib/dns/rdata/generic/unspec_103.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: unspec_103.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: unspec_103.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ #ifndef RDATA_GENERIC_UNSPEC_103_C #define RDATA_GENERIC_UNSPEC_103_C @@ -59,26 +59,6 @@ towire_unspec(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_unspec(ARGS_TOSTRUCT) { - dns_rdata_unspec_t *unspec = target; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_unspec); - REQUIRE(target != NULL); - - unspec->common.rdclass = rdata->rdclass; - unspec->common.rdtype = rdata->type; - ISC_LINK_INIT(&unspec->common, link); - - dns_rdata_toregion(rdata, &r); - unspec->datalen = r.length; - unspec->data = mem_maybedup(r.base, r.length); - if (unspec->data == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/uri_256.c b/usr.bin/dig/lib/dns/rdata/generic/uri_256.c index 8d6d2fdcad3..c2a98b892da 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/uri_256.c +++ b/usr.bin/dig/lib/dns/rdata/generic/uri_256.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: uri_256.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: uri_256.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ #ifndef GENERIC_URI_256_C #define GENERIC_URI_256_C 1 @@ -97,47 +97,6 @@ towire_uri(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_uri(ARGS_TOSTRUCT) { - dns_rdata_uri_t *uri = target; - isc_region_t sr; - - REQUIRE(rdata->type == dns_rdatatype_uri); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - uri->common.rdclass = rdata->rdclass; - uri->common.rdtype = rdata->type; - ISC_LINK_INIT(&uri->common, link); - - dns_rdata_toregion(rdata, &sr); - - /* - * Priority - */ - if (sr.length < 2) - return (ISC_R_UNEXPECTEDEND); - uri->priority = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* - * Weight - */ - if (sr.length < 2) - return (ISC_R_UNEXPECTEDEND); - uri->weight = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* - * Target URI - */ - uri->tgt_len = sr.length; - uri->target = mem_maybedup(sr.base, sr.length); - if (uri->target == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/generic/x25_19.c b/usr.bin/dig/lib/dns/rdata/generic/x25_19.c index a92f919f345..78fab66c3b7 100644 --- a/usr.bin/dig/lib/dns/rdata/generic/x25_19.c +++ b/usr.bin/dig/lib/dns/rdata/generic/x25_19.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: x25_19.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: x25_19.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Thu Mar 16 16:15:57 PST 2000 by bwelling */ @@ -67,28 +67,6 @@ towire_x25(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_x25(ARGS_TOSTRUCT) { - dns_rdata_x25_t *x25 = target; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_x25); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - x25->common.rdclass = rdata->rdclass; - x25->common.rdtype = rdata->type; - ISC_LINK_INIT(&x25->common, link); - - dns_rdata_toregion(rdata, &r); - x25->x25_len = uint8_fromregion(&r); - isc_region_consume(&r, 1); - x25->x25 = mem_maybedup(r.base, x25->x25_len); - if (x25->x25 == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/hs_4/a_1.c b/usr.bin/dig/lib/dns/rdata/hs_4/a_1.c index e6c5a8fe820..62bb716b7c0 100644 --- a/usr.bin/dig/lib/dns/rdata/hs_4/a_1.c +++ b/usr.bin/dig/lib/dns/rdata/hs_4/a_1.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: a_1.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: a_1.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* reviewed: Thu Mar 16 15:58:36 PST 2000 by brister */ @@ -85,26 +85,6 @@ towire_hs_a(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_hs_a(ARGS_TOSTRUCT) { - dns_rdata_hs_a_t *a = target; - uint32_t n; - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_a); - REQUIRE(rdata->rdclass == dns_rdataclass_hs); - REQUIRE(rdata->length == 4); - - a->common.rdclass = rdata->rdclass; - a->common.rdtype = rdata->type; - ISC_LINK_INIT(&a->common, link); - - dns_rdata_toregion(rdata, ®ion); - n = uint32_fromregion(®ion); - a->in_addr.s_addr = htonl(n); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/a6_38.c b/usr.bin/dig/lib/dns/rdata/in_1/a6_38.c index 6656d8c1e67..bc2d8196123 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/a6_38.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/a6_38.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: a6_38.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: a6_38.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* RFC2874 */ @@ -152,49 +152,6 @@ towire_in_a6(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_a6(ARGS_TOSTRUCT) { - dns_rdata_in_a6_t *a6 = target; - unsigned char octets; - dns_name_t name; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_a6); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - a6->common.rdclass = rdata->rdclass; - a6->common.rdtype = rdata->type; - ISC_LINK_INIT(&a6->common, link); - - dns_rdata_toregion(rdata, &r); - - a6->prefixlen = uint8_fromregion(&r); - isc_region_consume(&r, 1); - memset(a6->in6_addr.s6_addr, 0, sizeof(a6->in6_addr.s6_addr)); - - /* - * Suffix. - */ - if (a6->prefixlen != 128) { - octets = 16 - a6->prefixlen / 8; - INSIST(r.length >= octets); - memmove(a6->in6_addr.s6_addr + 16 - octets, r.base, octets); - isc_region_consume(&r, octets); - } - - /* - * Prefix. - */ - dns_name_init(&a6->prefix, NULL); - if (a6->prefixlen != 0) { - dns_name_init(&name, NULL); - dns_name_fromregion(&name, &r); - RETERR(name_duporclone(&name, &a6->prefix)); - } - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/a_1.c b/usr.bin/dig/lib/dns/rdata/in_1/a_1.c index a653e32a64f..da93d2a20fb 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/a_1.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/a_1.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: a_1.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: a_1.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */ @@ -88,26 +88,6 @@ towire_in_a(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_a(ARGS_TOSTRUCT) { - dns_rdata_in_a_t *a = target; - uint32_t n; - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_a); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(rdata->length == 4); - - a->common.rdclass = rdata->rdclass; - a->common.rdtype = rdata->type; - ISC_LINK_INIT(&a->common, link); - - dns_rdata_toregion(rdata, ®ion); - n = uint32_fromregion(®ion); - a->in_addr.s_addr = htonl(n); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/aaaa_28.c b/usr.bin/dig/lib/dns/rdata/in_1/aaaa_28.c index 8a5975f1eca..42809a23f55 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/aaaa_28.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/aaaa_28.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: aaaa_28.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: aaaa_28.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Thu Mar 16 16:52:50 PST 2000 by bwelling */ @@ -87,26 +87,6 @@ towire_in_aaaa(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_aaaa(ARGS_TOSTRUCT) { - dns_rdata_in_aaaa_t *aaaa = target; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_aaaa); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(target != NULL); - REQUIRE(rdata->length == 16); - - aaaa->common.rdclass = rdata->rdclass; - aaaa->common.rdtype = rdata->type; - ISC_LINK_INIT(&aaaa->common, link); - - dns_rdata_toregion(rdata, &r); - INSIST(r.length == 16); - memmove(aaaa->in6_addr.s6_addr, r.base, 16); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/apl_42.c b/usr.bin/dig/lib/dns/rdata/in_1/apl_42.c index 7bfece356ef..f0cba1c5712 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/apl_42.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/apl_42.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: apl_42.c,v 1.8 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: apl_42.c,v 1.9 2020/02/24 17:45:26 florian Exp $ */ /* RFC3123 */ @@ -151,27 +151,6 @@ towire_in_apl(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_apl(ARGS_TOSTRUCT) { - dns_rdata_in_apl_t *apl = target; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_apl); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - - apl->common.rdclass = rdata->rdclass; - apl->common.rdtype = rdata->type; - ISC_LINK_INIT(&apl->common, link); - - dns_rdata_toregion(rdata, &r); - apl->apl_len = r.length; - apl->apl = mem_maybedup(r.base, r.length); - if (apl->apl == NULL) - return (ISC_R_NOMEMORY); - - apl->offset = 0; - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/dhcid_49.c b/usr.bin/dig/lib/dns/rdata/in_1/dhcid_49.c index 2e47a308249..65b7d3fe0cb 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/dhcid_49.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/dhcid_49.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dhcid_49.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: dhcid_49.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* RFC 4701 */ @@ -92,28 +92,6 @@ towire_in_dhcid(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_dhcid(ARGS_TOSTRUCT) { - dns_rdata_in_dhcid_t *dhcid = target; - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_dhcid); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - dhcid->common.rdclass = rdata->rdclass; - dhcid->common.rdtype = rdata->type; - ISC_LINK_INIT(&dhcid->common, link); - - dns_rdata_toregion(rdata, ®ion); - - dhcid->dhcid = mem_maybedup(region.base, region.length); - if (dhcid->dhcid == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/kx_36.c b/usr.bin/dig/lib/dns/rdata/in_1/kx_36.c index 5c114fae466..c182e673870 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/kx_36.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/kx_36.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: kx_36.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: kx_36.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Thu Mar 16 17:24:54 PST 2000 by explorer */ @@ -100,32 +100,6 @@ towire_in_kx(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_kx(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_in_kx_t *kx = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_kx); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - kx->common.rdclass = rdata->rdclass; - kx->common.rdtype = rdata->type; - ISC_LINK_INIT(&kx->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - - kx->preference = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - - dns_name_fromregion(&name, ®ion); - dns_name_init(&kx->exchange, NULL); - RETERR(name_duporclone(&name, &kx->exchange)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/nsap-ptr_23.c b/usr.bin/dig/lib/dns/rdata/in_1/nsap-ptr_23.c index 88f4a63e198..3dc487cfe11 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/nsap-ptr_23.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/nsap-ptr_23.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsap-ptr_23.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: nsap-ptr_23.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Fri Mar 17 10:16:02 PST 2000 by gson */ @@ -83,28 +83,6 @@ towire_in_nsap_ptr(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_nsap_ptr(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_in_nsap_ptr_t *nsap_ptr = target; - dns_name_t name; - - REQUIRE(rdata->type == dns_rdatatype_nsap_ptr); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - nsap_ptr->common.rdclass = rdata->rdclass; - nsap_ptr->common.rdtype = rdata->type; - ISC_LINK_INIT(&nsap_ptr->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - dns_name_fromregion(&name, ®ion); - dns_name_init(&nsap_ptr->owner, NULL); - RETERR(name_duporclone(&name, &nsap_ptr->owner)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/nsap_22.c b/usr.bin/dig/lib/dns/rdata/in_1/nsap_22.c index a2887131bf5..5945d88b490 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/nsap_22.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/nsap_22.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsap_22.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: nsap_22.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Fri Mar 17 10:41:07 PST 2000 by gson */ @@ -80,28 +80,6 @@ towire_in_nsap(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_nsap(ARGS_TOSTRUCT) { - dns_rdata_in_nsap_t *nsap = target; - isc_region_t r; - - REQUIRE(rdata->type == dns_rdatatype_nsap); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - nsap->common.rdclass = rdata->rdclass; - nsap->common.rdtype = rdata->type; - ISC_LINK_INIT(&nsap->common, link); - - dns_rdata_toregion(rdata, &r); - nsap->nsap_len = r.length; - nsap->nsap = mem_maybedup(r.base, r.length); - if (nsap->nsap == NULL) - return (ISC_R_NOMEMORY); - - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/px_26.c b/usr.bin/dig/lib/dns/rdata/in_1/px_26.c index 233c95796f8..cccd3a995e2 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/px_26.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/px_26.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: px_26.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: px_26.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Mon Mar 20 10:44:27 PST 2000 */ @@ -139,45 +139,6 @@ towire_in_px(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_px(ARGS_TOSTRUCT) { - dns_rdata_in_px_t *px = target; - dns_name_t name; - isc_region_t region; - isc_result_t result; - - REQUIRE(rdata->type == dns_rdatatype_px); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - px->common.rdclass = rdata->rdclass; - px->common.rdtype = rdata->type; - ISC_LINK_INIT(&px->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - - px->preference = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - - dns_name_fromregion(&name, ®ion); - - dns_name_init(&px->map822, NULL); - RETERR(name_duporclone(&name, &px->map822)); - isc_region_consume(®ion, name_length(&px->map822)); - - dns_name_init(&px->mapx400, NULL); - result = name_duporclone(&name, &px->mapx400); - if (result != ISC_R_SUCCESS) - goto cleanup; - - return (result); - - cleanup: - dns_name_free(&px->map822); - return (ISC_R_NOMEMORY); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/srv_33.c b/usr.bin/dig/lib/dns/rdata/in_1/srv_33.c index 3afb64b10e8..73293e933fd 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/srv_33.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/srv_33.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: srv_33.c,v 1.7 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: srv_33.c,v 1.8 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Fri Mar 17 13:01:00 PST 2000 by bwelling */ @@ -134,34 +134,6 @@ towire_in_srv(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_srv(ARGS_TOSTRUCT) { - isc_region_t region; - dns_rdata_in_srv_t *srv = target; - dns_name_t name; - - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(rdata->type == dns_rdatatype_srv); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); - - srv->common.rdclass = rdata->rdclass; - srv->common.rdtype = rdata->type; - ISC_LINK_INIT(&srv->common, link); - - dns_name_init(&name, NULL); - dns_rdata_toregion(rdata, ®ion); - srv->priority = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - srv->weight = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - srv->port = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - dns_name_fromregion(&name, ®ion); - dns_name_init(&srv->target, NULL); - RETERR(name_duporclone(&name, &srv->target)); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/rdata/in_1/wks_11.c b/usr.bin/dig/lib/dns/rdata/in_1/wks_11.c index fbd4fd03c97..55e422ac77d 100644 --- a/usr.bin/dig/lib/dns/rdata/in_1/wks_11.c +++ b/usr.bin/dig/lib/dns/rdata/in_1/wks_11.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: wks_11.c,v 1.8 2020/02/24 17:44:45 florian Exp $ */ +/* $Id: wks_11.c,v 1.9 2020/02/24 17:45:26 florian Exp $ */ /* Reviewed: Fri Mar 17 15:01:49 PST 2000 by explorer */ @@ -113,32 +113,6 @@ towire_in_wks(ARGS_TOWIRE) { -static inline isc_result_t -tostruct_in_wks(ARGS_TOSTRUCT) { - dns_rdata_in_wks_t *wks = target; - uint32_t n; - isc_region_t region; - - REQUIRE(rdata->type == dns_rdatatype_wks); - REQUIRE(rdata->rdclass == dns_rdataclass_in); - REQUIRE(rdata->length != 0); - - wks->common.rdclass = rdata->rdclass; - wks->common.rdtype = rdata->type; - ISC_LINK_INIT(&wks->common, link); - - dns_rdata_toregion(rdata, ®ion); - n = uint32_fromregion(®ion); - wks->in_addr.s_addr = htonl(n); - isc_region_consume(®ion, 4); - wks->protocol = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - wks->map_len = region.length; - wks->map = mem_maybedup(region.base, region.length); - if (wks->map == NULL) - return (ISC_R_NOMEMORY); - return (ISC_R_SUCCESS); -} diff --git a/usr.bin/dig/lib/dns/tsig.c b/usr.bin/dig/lib/dns/tsig.c index e3a42620cc4..246ab437c1b 100644 --- a/usr.bin/dig/lib/dns/tsig.c +++ b/usr.bin/dig/lib/dns/tsig.c @@ -15,7 +15,7 @@ */ /* - * $Id: tsig.c,v 1.11 2020/02/24 17:44:44 florian Exp $ + * $Id: tsig.c,v 1.12 2020/02/24 17:45:25 florian Exp $ */ /*! \file */ @@ -496,7 +496,8 @@ dns_tsig_sign(dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_context; dns_rdataset_current(msg->querytsig, &querytsigrdata); - ret = dns_rdata_tostruct(&querytsigrdata, &querytsig); + ret = dns_rdata_tostruct_tsig(&querytsigrdata, + &querytsig); if (ret != ISC_R_SUCCESS) goto cleanup_context; isc_buffer_putuint16(&databuf, querytsig.siglen); @@ -756,7 +757,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg) if (ret != ISC_R_SUCCESS) return (ret); dns_rdataset_current(msg->tsig, &rdata); - ret = dns_rdata_tostruct(&rdata, &tsig); + ret = dns_rdata_tostruct_tsig(&rdata, &tsig); if (ret != ISC_R_SUCCESS) return (ret); dns_rdata_reset(&rdata); @@ -765,7 +766,7 @@ dns_tsig_verify(isc_buffer_t *source, dns_message_t *msg) if (ret != ISC_R_SUCCESS) return (ret); dns_rdataset_current(msg->querytsig, &rdata); - ret = dns_rdata_tostruct(&rdata, &querytsig); + ret = dns_rdata_tostruct_tsig(&rdata, &querytsig); if (ret != ISC_R_SUCCESS) return (ret); } @@ -1076,7 +1077,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { if (ret != ISC_R_SUCCESS) return (ret); dns_rdataset_current(msg->querytsig, &rdata); - ret = dns_rdata_tostruct(&rdata, &querytsig); + ret = dns_rdata_tostruct_tsig(&rdata, &querytsig); if (ret != ISC_R_SUCCESS) return (ret); dns_rdata_reset(&rdata); @@ -1092,7 +1093,7 @@ tsig_verify_tcp(isc_buffer_t *source, dns_message_t *msg) { if (ret != ISC_R_SUCCESS) goto cleanup_querystruct; dns_rdataset_current(msg->tsig, &rdata); - ret = dns_rdata_tostruct(&rdata, &tsig); + ret = dns_rdata_tostruct_tsig(&rdata, &tsig); if (ret != ISC_R_SUCCESS) goto cleanup_querystruct; diff --git a/usr.bin/dig/nslookup.c b/usr.bin/dig/nslookup.c index 5c5094a1a9f..86ec50794bd 100644 --- a/usr.bin/dig/nslookup.c +++ b/usr.bin/dig/nslookup.c @@ -162,8 +162,8 @@ printsoa(dns_rdata_t *rdata) { isc_result_t result; char namebuf[DNS_NAME_FORMATSIZE]; - result = dns_rdata_tostruct(rdata, &soa); - check_result(result, "dns_rdata_tostruct"); + result = dns_rdata_tostruct_soa(rdata, &soa); + check_result(result, "dns_rdata_tostruct_soa"); dns_name_format(&soa.origin, namebuf, sizeof(namebuf)); printf("\torigin = %s\n", namebuf); |