]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove UNSPEC rrtype
authorWitold Kręcicki <wpk@culm.net>
Wed, 27 Feb 2019 09:04:37 +0000 (10:04 +0100)
committerOndřej Surý <ondrej@sury.org>
Mon, 13 May 2019 03:53:21 +0000 (10:53 +0700)
(cherry picked from commit a8e2ca6f7d956324911766fd8e83ee6461b8056e)

bin/tests/system/genzone.sh
bin/tests/system/xfer/dig1.good
bin/tests/system/xfer/dig2.good
lib/dns/gen.c
lib/dns/rdata.c
lib/dns/rdata/generic/unspec_103.c [deleted file]
lib/dns/rdata/generic/unspec_103.h [deleted file]
util/copyrights

index a4cf7c1c3e5bad49f74655bb92d805f029b2c16e..5896638e6db524cbc2507b960fa00bb3defd57e4 100644 (file)
@@ -390,7 +390,8 @@ uid01                       UID     \# 1 02
 ; type 102 (GID - not implemented by BIND - unknown record format only)
 gid01                  GID     \# 1 03
 
-; type 103 (UNSPEC - XXXMUKS TODO - this has some weird encoding - see btoa_totext())
+; type 103 (UNSPEC - not implemented by BIND - unknown record format only)
+unspec01               UNSPEC  \# 1 04
 
 ; type 104
 nid                    NID     10 0014:4fff:ff20:ee64
index 7e4acf5c4ab6124600a02aaf10881d045fb2a0f5..ba9baff21d4e561db361df426a65bb849bc5b9f6 100644 (file)
@@ -52,6 +52,7 @@ eid01.example.                3600    IN      EID     1289AB
 eui48.example.         3600    IN      EUI48   01-23-45-67-89-ab
 eui64.example.         3600    IN      EUI64   01-23-45-67-89-ab-cd-ef
 gid01.example.         3600    IN      GID     \# 1 03
+unspec01.example.      3600    IN      UNSPEC  \# 1 04
 gpos01.example.                3600    IN      GPOS    "-22.6882" "116.8652" "250.0"
 gpos02.example.                3600    IN      GPOS    "" "" ""
 hinfo01.example.       3600    IN      HINFO   "Generic PC clone" "NetBSD-1.4"
index 6d01d35d680ada35af78c3ee76103f9e3885a8fa..6d2dcc4af29622b2c52b529a13472a3b0dda239d 100644 (file)
@@ -52,6 +52,7 @@ eid01.example.                3600    IN      EID     1289AB
 eui48.example.         3600    IN      EUI48   01-23-45-67-89-ab
 eui64.example.         3600    IN      EUI64   01-23-45-67-89-ab-cd-ef
 gid01.example.         3600    IN      GID     \# 1 03
+unspec01.example.      3600    IN      UNSPEC  \# 1 04
 gpos01.example.                3600    IN      GPOS    "-22.6882" "116.8652" "250.0"
 gpos02.example.                3600    IN      GPOS    "" "" ""
 hinfo01.example.       3600    IN      HINFO   "Generic PC clone" "NetBSD-1.4"
index b3691f9bd22ed82b63225a8f42b4aa261e8e0226..f816f47aa7536530e9c27388968bf88dff18807c 100644 (file)
@@ -723,6 +723,7 @@ main(int argc, char **argv) {
                insert_into_typenames(100, "uinfo", RESERVEDNAME);
                insert_into_typenames(101, "uid", RESERVEDNAME);
                insert_into_typenames(102, "gid", RESERVEDNAME);
+               insert_into_typenames(103, "unspec", RESERVEDNAME);
                insert_into_typenames(251, "ixfr", METAQUESTIONONLY);
                insert_into_typenames(252, "axfr", METAQUESTIONONLY);
                insert_into_typenames(253, "mailb", METAQUESTIONONLY);
index 9e91ac3892dc0e0c9dd7516c6f4203f656cd0d21..7d52d9d94d846ed8c46afae2a4937d6ac47507a0 100644 (file)
@@ -191,12 +191,6 @@ hexvalue(char value);
 static int
 decvalue(char value);
 
-static isc_result_t
-btoa_totext(unsigned char *inbuf, int inbuflen, isc_buffer_t *target);
-
-static isc_result_t
-atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target);
-
 static void
 default_fromtext_callback(dns_rdatacallbacks_t *callbacks, const char *, ...)
      ISC_FORMAT_PRINTF(2, 3);
@@ -1891,278 +1885,6 @@ decvalue(char value) {
        return (int)(s - decdigits);
 }
 
-static const char atob_digits[86] =
-       "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`" \
-       "abcdefghijklmnopqrstu";
-/*
- * Subroutines to convert between 8 bit binary bytes and printable ASCII.
- * Computes the number of bytes, and three kinds of simple checksums.
- * Incoming bytes are collected into 32-bit words, then printed in base 85:
- *     exp(85,5) > exp(2,32)
- * The ASCII characters used are between '!' and 'u';
- * 'z' encodes 32-bit zero; 'x' is used to mark the end of encoded data.
- *
- * Originally by Paul Rutter (philabs!per) and Joe Orost (petsd!joe) for
- * the atob/btoa programs, released with the compress program, in mod.sources.
- * Modified by Mike Schwartz 8/19/86 for use in BIND.
- * Modified to be re-entrant 3/2/99.
- */
-
-
-struct state {
-       int32_t Ceor;
-       int32_t Csum;
-       int32_t Crot;
-       int32_t word;
-       int32_t bcount;
-};
-
-#define Ceor state->Ceor
-#define Csum state->Csum
-#define Crot state->Crot
-#define word state->word
-#define bcount state->bcount
-
-#define times85(x)     ((((((x<<2)+x)<<2)+x)<<2)+x)
-
-static isc_result_t    byte_atob(int c, isc_buffer_t *target,
-                                 struct state *state);
-static isc_result_t    putbyte(int c, isc_buffer_t *, struct state *state);
-static isc_result_t    byte_btoa(int c, isc_buffer_t *, struct state *state);
-
-/*
- * Decode ASCII-encoded byte c into binary representation and
- * place into *bufp, advancing bufp.
- */
-static isc_result_t
-byte_atob(int c, isc_buffer_t *target, struct state *state) {
-       const char *s;
-       if (c == 'z') {
-               if (bcount != 0)
-                       return(DNS_R_SYNTAX);
-               else {
-                       RETERR(putbyte(0, target, state));
-                       RETERR(putbyte(0, target, state));
-                       RETERR(putbyte(0, target, state));
-                       RETERR(putbyte(0, target, state));
-               }
-       } else if ((s = strchr(atob_digits, c)) != NULL) {
-               if (bcount == 0) {
-                       word = (int32_t)(s - atob_digits);
-                       ++bcount;
-               } else if (bcount < 4) {
-                       word = times85(word);
-                       word += (int32_t)(s - atob_digits);
-                       ++bcount;
-               } else {
-                       word = times85(word);
-                       word += (int32_t)(s - atob_digits);
-                       RETERR(putbyte((word >> 24) & 0xff, target, state));
-                       RETERR(putbyte((word >> 16) & 0xff, target, state));
-                       RETERR(putbyte((word >> 8) & 0xff, target, state));
-                       RETERR(putbyte(word & 0xff, target, state));
-                       word = 0;
-                       bcount = 0;
-               }
-       } else
-               return(DNS_R_SYNTAX);
-       return(ISC_R_SUCCESS);
-}
-
-/*
- * Compute checksum info and place c into target.
- */
-static isc_result_t
-putbyte(int c, isc_buffer_t *target, struct state *state) {
-       isc_region_t tr;
-
-       Ceor ^= c;
-       Csum += c;
-       Csum += 1;
-       if ((Crot & 0x80000000)) {
-               Crot <<= 1;
-               Crot += 1;
-       } else {
-               Crot <<= 1;
-       }
-       Crot += c;
-       isc_buffer_availableregion(target, &tr);
-       if (tr.length < 1)
-               return (ISC_R_NOSPACE);
-       tr.base[0] = c;
-       isc_buffer_add(target, 1);
-       return (ISC_R_SUCCESS);
-}
-
-/*
- * Read the ASCII-encoded data from inbuf, of length inbuflen, and convert
- * it into T_UNSPEC (binary data) in outbuf, not to exceed outbuflen bytes;
- * outbuflen must be divisible by 4.  (Note: this is because outbuf is filled
- * in 4 bytes at a time.  If the actual data doesn't end on an even 4-byte
- * boundary, there will be no problem...it will be padded with 0 bytes, and
- * numbytes will indicate the correct number of bytes.  The main point is
- * that since the buffer is filled in 4 bytes at a time, even if there is
- * not a full 4 bytes of data at the end, there has to be room to 0-pad the
- * data, so the buffer must be of size divisible by 4).  Place the number of
- * output bytes in numbytes, and return a failure/success status.
- */
-
-static isc_result_t
-atob_tobuffer(isc_lex_t *lexer, isc_buffer_t *target) {
-       long oeor, osum, orot;
-       struct state statebuf, *state= &statebuf;
-       isc_token_t token;
-       char c;
-       char *e;
-
-       Ceor = Csum = Crot = word = bcount = 0;
-
-       RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
-                                     false));
-       while (token.value.as_textregion.length != 0) {
-               if ((c = token.value.as_textregion.base[0]) == 'x') {
-                       break;
-               } else
-                       RETERR(byte_atob(c, target, state));
-               isc_textregion_consume(&token.value.as_textregion, 1);
-       }
-
-       /*
-        * Number of bytes.
-        */
-       RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
-                                     false));
-       if ((token.value.as_ulong % 4) != 0U) {
-               unsigned long padding = 4 - (token.value.as_ulong % 4);
-               if (isc_buffer_usedlength(target) < padding)
-                       return (DNS_R_SYNTAX);
-               isc_buffer_subtract(target, padding);
-       }
-
-       /*
-        * Checksum.
-        */
-       RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
-                                     false));
-       oeor = strtol(DNS_AS_STR(token), &e, 16);
-       if (*e != 0)
-               return (DNS_R_SYNTAX);
-
-       /*
-        * Checksum.
-        */
-       RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
-                                     false));
-       osum = strtol(DNS_AS_STR(token), &e, 16);
-       if (*e != 0)
-               return (DNS_R_SYNTAX);
-
-       /*
-        * Checksum.
-        */
-       RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
-                                     false));
-       orot = strtol(DNS_AS_STR(token), &e, 16);
-       if (*e != 0)
-               return (DNS_R_SYNTAX);
-
-       if ((oeor != Ceor) || (osum != Csum) || (orot != Crot))
-               return(DNS_R_BADCKSUM);
-       return (ISC_R_SUCCESS);
-}
-
-/*
- * Encode binary byte c into ASCII representation and place into *bufp,
- * advancing bufp.
- */
-static isc_result_t
-byte_btoa(int c, isc_buffer_t *target, struct state *state) {
-       isc_region_t tr;
-
-       isc_buffer_availableregion(target, &tr);
-       Ceor ^= c;
-       Csum += c;
-       Csum += 1;
-       if ((Crot & 0x80000000)) {
-               Crot <<= 1;
-               Crot += 1;
-       } else {
-               Crot <<= 1;
-       }
-       Crot += c;
-
-       word <<= 8;
-       word |= c;
-       if (bcount == 3) {
-               if (word == 0) {
-                       if (tr.length < 1)
-                               return (ISC_R_NOSPACE);
-                       tr.base[0] = 'z';
-                       isc_buffer_add(target, 1);
-               } else {
-                   register int tmp = 0;
-                   register int32_t tmpword = word;
-
-                   if (tmpword < 0) {
-                          /*
-                           * Because some don't support u_long.
-                           */
-                       tmp = 32;
-                       tmpword -= (int32_t)(85 * 85 * 85 * 85 * 32);
-                   }
-                   if (tmpword < 0) {
-                       tmp = 64;
-                       tmpword -= (int32_t)(85 * 85 * 85 * 85 * 32);
-                   }
-                       if (tr.length < 5)
-                               return (ISC_R_NOSPACE);
-                       tr.base[0] = atob_digits[(tmpword /
-                                             (int32_t)(85 * 85 * 85 * 85))
-                                               + tmp];
-                       tmpword %= (int32_t)(85 * 85 * 85 * 85);
-                       tr.base[1] = atob_digits[tmpword / (85 * 85 * 85)];
-                       tmpword %= (85 * 85 * 85);
-                       tr.base[2] = atob_digits[tmpword / (85 * 85)];
-                       tmpword %= (85 * 85);
-                       tr.base[3] = atob_digits[tmpword / 85];
-                       tmpword %= 85;
-                       tr.base[4] = atob_digits[tmpword];
-                       isc_buffer_add(target, 5);
-               }
-               bcount = 0;
-       } else {
-               bcount += 1;
-       }
-       return (ISC_R_SUCCESS);
-}
-
-
-/*
- * Encode the binary data from inbuf, of length inbuflen, into a
- * target.  Return success/failure status
- */
-static isc_result_t
-btoa_totext(unsigned char *inbuf, int inbuflen, isc_buffer_t *target) {
-       int inc;
-       struct state statebuf, *state = &statebuf;
-       char buf[sizeof("x 2000000000 ffffffff ffffffff ffffffff")];
-
-       Ceor = Csum = Crot = word = bcount = 0;
-       for (inc = 0; inc < inbuflen; inbuf++, inc++)
-               RETERR(byte_btoa(*inbuf, target, state));
-
-       while (bcount != 0)
-               RETERR(byte_btoa(0, target, state));
-
-       /*
-        * Put byte count and checksum information at end of buffer,
-        * delimited by 'x'
-        */
-       snprintf(buf, sizeof(buf), "x %d %x %x %x", inbuflen, Ceor, Csum, Crot);
-       return (str_totext(buf, target));
-}
-
-
 static void
 default_fromtext_callback(dns_rdatacallbacks_t *callbacks, const char *fmt,
                          ...)
diff --git a/lib/dns/rdata/generic/unspec_103.c b/lib/dns/rdata/generic/unspec_103.c
deleted file mode 100644 (file)
index 1c4654f..0000000
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- */
-
-
-#ifndef RDATA_GENERIC_UNSPEC_103_C
-#define RDATA_GENERIC_UNSPEC_103_C
-
-#define RRTYPE_UNSPEC_ATTRIBUTES (0)
-
-static inline isc_result_t
-fromtext_unspec(ARGS_FROMTEXT) {
-
-       REQUIRE(type == dns_rdatatype_unspec);
-
-       UNUSED(type);
-       UNUSED(rdclass);
-       UNUSED(origin);
-       UNUSED(options);
-       UNUSED(callbacks);
-
-       return (atob_tobuffer(lexer, target));
-}
-
-static inline isc_result_t
-totext_unspec(ARGS_TOTEXT) {
-
-       REQUIRE(rdata->type == dns_rdatatype_unspec);
-
-       UNUSED(tctx);
-
-       return (btoa_totext(rdata->data, rdata->length, target));
-}
-
-static inline isc_result_t
-fromwire_unspec(ARGS_FROMWIRE) {
-       isc_region_t sr;
-
-       REQUIRE(type == dns_rdatatype_unspec);
-
-       UNUSED(type);
-       UNUSED(rdclass);
-       UNUSED(dctx);
-       UNUSED(options);
-
-       isc_buffer_activeregion(source, &sr);
-       isc_buffer_forward(source, sr.length);
-       return (mem_tobuffer(target, sr.base, sr.length));
-}
-
-static inline isc_result_t
-towire_unspec(ARGS_TOWIRE) {
-
-       REQUIRE(rdata->type == dns_rdatatype_unspec);
-
-       UNUSED(cctx);
-
-       return (mem_tobuffer(target, rdata->data, rdata->length));
-}
-
-static inline int
-compare_unspec(ARGS_COMPARE) {
-       isc_region_t r1;
-       isc_region_t r2;
-
-       REQUIRE(rdata1->type == rdata2->type);
-       REQUIRE(rdata1->rdclass == rdata2->rdclass);
-       REQUIRE(rdata1->type == dns_rdatatype_unspec);
-
-       dns_rdata_toregion(rdata1, &r1);
-       dns_rdata_toregion(rdata2, &r2);
-       return (isc_region_compare(&r1, &r2));
-}
-
-static inline isc_result_t
-fromstruct_unspec(ARGS_FROMSTRUCT) {
-       dns_rdata_unspec_t *unspec = source;
-
-       REQUIRE(type == dns_rdatatype_unspec);
-       REQUIRE(source != NULL);
-       REQUIRE(unspec->common.rdtype == type);
-       REQUIRE(unspec->common.rdclass == rdclass);
-       REQUIRE(unspec->data != NULL || unspec->datalen == 0);
-
-       UNUSED(type);
-       UNUSED(rdclass);
-
-       return (mem_tobuffer(target, unspec->data, unspec->datalen));
-}
-
-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(mctx, r.base, r.length);
-       if (unspec->data == NULL)
-               return (ISC_R_NOMEMORY);
-
-       unspec->mctx = mctx;
-       return (ISC_R_SUCCESS);
-}
-
-static inline void
-freestruct_unspec(ARGS_FREESTRUCT) {
-       dns_rdata_unspec_t *unspec = source;
-
-       REQUIRE(source != NULL);
-       REQUIRE(unspec->common.rdtype == dns_rdatatype_unspec);
-
-       if (unspec->mctx == NULL)
-               return;
-
-       if (unspec->data != NULL)
-               isc_mem_free(unspec->mctx, unspec->data);
-       unspec->mctx = NULL;
-}
-
-static inline isc_result_t
-additionaldata_unspec(ARGS_ADDLDATA) {
-       REQUIRE(rdata->type == dns_rdatatype_unspec);
-
-       UNUSED(rdata);
-       UNUSED(add);
-       UNUSED(arg);
-
-       return (ISC_R_SUCCESS);
-}
-
-static inline isc_result_t
-digest_unspec(ARGS_DIGEST) {
-       isc_region_t r;
-
-       REQUIRE(rdata->type == dns_rdatatype_unspec);
-
-       dns_rdata_toregion(rdata, &r);
-
-       return ((digest)(arg, &r));
-}
-
-static inline bool
-checkowner_unspec(ARGS_CHECKOWNER) {
-
-       REQUIRE(type == dns_rdatatype_unspec);
-
-       UNUSED(name);
-       UNUSED(type);
-       UNUSED(rdclass);
-       UNUSED(wildcard);
-
-       return (true);
-}
-
-static inline bool
-checknames_unspec(ARGS_CHECKNAMES) {
-
-       REQUIRE(rdata->type == dns_rdatatype_unspec);
-
-       UNUSED(rdata);
-       UNUSED(owner);
-       UNUSED(bad);
-
-       return (true);
-}
-
-static inline int
-casecompare_unspec(ARGS_COMPARE) {
-       return (compare_unspec(rdata1, rdata2));
-}
-
-#endif /* RDATA_GENERIC_UNSPEC_103_C */
diff --git a/lib/dns/rdata/generic/unspec_103.h b/lib/dns/rdata/generic/unspec_103.h
deleted file mode 100644 (file)
index 9afb1bd..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- */
-
-/* */
-#ifndef GENERIC_UNSPEC_103_H
-#define GENERIC_UNSPEC_103_H 1
-
-
-typedef struct dns_rdata_unspec_t {
-       dns_rdatacommon_t       common;
-       isc_mem_t               *mctx;
-       unsigned char           *data;
-       uint16_t                datalen;
-} dns_rdata_unspec_t;
-
-#endif /* GENERIC_UNSPEC_103_H */
index 2de5600de43f9d19d0e6e784d3de0e8344ffa3be..d2e60bf9e90f4cb254b40c960228e202b7632edf 100644 (file)
 ./lib/dns/rdata/generic/tlsa_52.h              C       2012,2014,2016,2018,2019
 ./lib/dns/rdata/generic/txt_16.c               C       1998,1999,2000,2001,2002,2004,2007,2008,2009,2012,2014,2015,2016,2018,2019
 ./lib/dns/rdata/generic/txt_16.h               C       1998,1999,2000,2001,2004,2005,2007,2016,2018,2019
-./lib/dns/rdata/generic/unspec_103.c           C       1999,2000,2001,2002,2004,2007,2009,2015,2016,2018,2019
-./lib/dns/rdata/generic/unspec_103.h           C       1999,2000,2001,2004,2005,2007,2016,2018,2019
 ./lib/dns/rdata/generic/uri_256.c              C       2011,2012,2014,2015,2016,2017,2018,2019
 ./lib/dns/rdata/generic/uri_256.h              C       2011,2012,2016,2018,2019
 ./lib/dns/rdata/generic/x25_19.c               C       1999,2000,2001,2002,2004,2005,2007,2009,2014,2015,2016,2018,2019