diff options
| author | 2020-02-24 15:09:14 +0000 | |
|---|---|---|
| committer | 2020-02-24 15:09:14 +0000 | |
| commit | 8bc8da422db0ed3576cc9fbc611c7cad7bbc911c (patch) | |
| tree | 44a21b9b87cd9c8087a0240a903b355db434d471 | |
| parent | remove some uneeded includes (diff) | |
| download | wireguard-openbsd-8bc8da422db0ed3576cc9fbc611c7cad7bbc911c.tar.xz wireguard-openbsd-8bc8da422db0ed3576cc9fbc611c7cad7bbc911c.zip | |
remove some unused code
ok florian@
| -rw-r--r-- | usr.bin/dig/lib/dns/gen.c | 11 | ||||
| -rw-r--r-- | usr.bin/dig/lib/dns/include/dns/name.h | 92 | ||||
| -rw-r--r-- | usr.bin/dig/lib/dns/include/dns/rdata.h | 22 | ||||
| -rw-r--r-- | usr.bin/dig/lib/dns/name.c | 186 | ||||
| -rw-r--r-- | usr.bin/dig/lib/dns/rdata.c | 20 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/Makefile.inc | 4 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/include/isc/region.h | 26 | ||||
| -rw-r--r-- | usr.bin/dig/lib/isc/region.c | 44 |
8 files changed, 6 insertions, 399 deletions
diff --git a/usr.bin/dig/lib/dns/gen.c b/usr.bin/dig/lib/dns/gen.c index 12a4889cf64..5ea83852fa9 100644 --- a/usr.bin/dig/lib/dns/gen.c +++ b/usr.bin/dig/lib/dns/gen.c @@ -64,17 +64,6 @@ #define FREESTRUCTTYPE "common->rdtype" #define FREESTRUCTDEF NULL -#define COMPAREARGS "rdata1, rdata2" -#define COMPARECLASS "rdata1->rdclass" -#define COMPARETYPE "rdata1->type" -#define COMPAREDEF "use_default = ISC_TRUE" - - -#define CHECKOWNERARGS "name, rdclass, type, wildcard" -#define CHECKOWNERCLASS "rdclass" -#define CHECKOWNERTYPE "type" -#define CHECKOWNERDEF "result = ISC_TRUE" - static const char copyright[] = "/*\n" " * Copyright (C) 2004%s Internet Systems Consortium, Inc. (\"ISC\")\n" diff --git a/usr.bin/dig/lib/dns/include/dns/name.h b/usr.bin/dig/lib/dns/include/dns/name.h index a9975c91b61..a9868bddbb5 100644 --- a/usr.bin/dig/lib/dns/include/dns/name.h +++ b/usr.bin/dig/lib/dns/include/dns/name.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.h,v 1.8 2020/02/24 12:06:50 florian Exp $ */ +/* $Id: name.h,v 1.9 2020/02/24 15:09:14 jsg Exp $ */ #ifndef DNS_NAME_H #define DNS_NAME_H 1 @@ -390,27 +390,6 @@ dns_name_caseequal(const dns_name_t *name1, const dns_name_t *name2); * Case sensitive version of dns_name_equal(). */ -int -dns_name_rdatacompare(const dns_name_t *name1, const dns_name_t *name2); -/*%< - * Compare two names as if they are part of rdata in DNSSEC canonical - * form. - * - * Requires: - * \li 'name1' is a valid absolute name - * - * \li dns_name_countlabels(name1) > 0 - * - * \li 'name2' is a valid absolute name - * - * \li dns_name_countlabels(name2) > 0 - * - * Returns: - * \li < 0 'name1' is less than 'name2' - * \li 0 'name1' is equal to 'name2' - * \li > 0 'name1' is greater than 'name2' - */ - isc_boolean_t dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2); /*%< @@ -822,53 +801,6 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, *\li #DNS_R_NAMETOOLONG */ -void -dns_name_split(dns_name_t *name, unsigned int suffixlabels, - dns_name_t *prefix, dns_name_t *suffix); -/*%< - * - * Split 'name' into two pieces on a label boundary. - * - * Notes: - * \li 'name' is split such that 'suffix' holds the most significant - * 'suffixlabels' labels. All other labels are stored in 'prefix'. - * - *\li Copying name data is avoided as much as possible, so 'prefix' - * and 'suffix' will end up pointing at the data for 'name'. - * - *\li It is legitimate to pass a 'prefix' or 'suffix' that has - * its name data stored someplace other than the dedicated buffer. - * This is useful to avoid name copying in the calling function. - * - *\li It is also legitimate to pass a 'prefix' or 'suffix' that is - * the same dns_name_t as 'name'. - * - * Requires: - *\li 'name' is a valid name. - * - *\li 'suffixlabels' cannot exceed the number of labels in 'name'. - * - * \li 'prefix' is a valid name or NULL, and cannot be read-only. - * - *\li 'suffix' is a valid name or NULL, and cannot be read-only. - * - * Ensures: - * - *\li On success: - * If 'prefix' is not NULL it will contain the least significant - * labels. - * If 'suffix' is not NULL it will contain the most significant - * labels. dns_name_countlabels(suffix) will be equal to - * suffixlabels. - * - *\li On failure: - * Either 'prefix' or 'suffix' is invalidated (depending - * on which one the problem was encountered with). - * - * Returns: - *\li #ISC_R_SUCCESS No worries. (This function should always success). - */ - isc_result_t dns_name_dup(const dns_name_t *source, dns_name_t *target); @@ -1013,28 +945,6 @@ dns_name_copy(dns_name_t *source, dns_name_t *dest, isc_buffer_t *target); *\li #ISC_R_NOSPACE */ -isc_boolean_t -dns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard); -/*%< - * Return if 'name' is a valid hostname. RFC 952 / RFC 1123. - * If 'wildcard' is ISC_TRUE then allow the first label of name to - * be a wildcard. - * The root is also accepted. - * - * Requires: - * 'name' to be valid. - */ - - -isc_boolean_t -dns_name_ismailbox(const dns_name_t *name); -/*%< - * Return if 'name' is a valid mailbox. RFC 821. - * - * Requires: - * \li 'name' to be valid. - */ - #define DNS_NAME_INITABSOLUTE(A,B) { \ A, sizeof(A), sizeof(B), \ DNS_NAMEATTR_READONLY | DNS_NAMEATTR_ABSOLUTE, \ diff --git a/usr.bin/dig/lib/dns/include/dns/rdata.h b/usr.bin/dig/lib/dns/include/dns/rdata.h index 1884a221aea..33488bbeffb 100644 --- a/usr.bin/dig/lib/dns/include/dns/rdata.h +++ b/usr.bin/dig/lib/dns/include/dns/rdata.h @@ -420,17 +420,6 @@ dns_rdata_freestruct(void *source); */ isc_boolean_t -dns_rdatatype_issingleton(dns_rdatatype_t type); -/*%< - * Return true iff the rdata type 'type' is a singleton type, - * like CNAME or SOA. - * - * Requires: - * \li 'type' is a valid rdata type. - * - */ - -isc_boolean_t dns_rdatatype_isknown(dns_rdatatype_t type); /*%< * Return true iff the rdata type 'type' is known. @@ -440,17 +429,6 @@ dns_rdatatype_isknown(dns_rdatatype_t type); * */ -isc_boolean_t -dns_rdatatype_questiononly(dns_rdatatype_t type); -/*%< - * Return true iff rdata of type 'type' can only appear in the question - * section of a properly formatted message. - * - * Requires: - * \li 'type' is a valid rdata type. - * - */ - unsigned int dns_rdatatype_attributes(dns_rdatatype_t rdtype); /*%< diff --git a/usr.bin/dig/lib/dns/name.c b/usr.bin/dig/lib/dns/name.c index 4fafc0cdcea..18d267f136a 100644 --- a/usr.bin/dig/lib/dns/name.c +++ b/usr.bin/dig/lib/dns/name.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: name.c,v 1.10 2020/02/23 19:54:25 jung Exp $ */ +/* $Id: name.c,v 1.11 2020/02/24 15:09:14 jsg Exp $ */ /*! \file */ #include <ctype.h> @@ -228,107 +228,6 @@ dns_name_isabsolute(const dns_name_t *name) { return (ISC_FALSE); } -#define hyphenchar(c) ((c) == 0x2d) -#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \ - || ((c) >= 0x61 && (c) <= 0x7a)) -#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) -#define borderchar(c) (alphachar(c) || digitchar(c)) -#define middlechar(c) (borderchar(c) || hyphenchar(c)) -#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) - -isc_boolean_t -dns_name_ismailbox(const dns_name_t *name) { - unsigned char *ndata, ch; - unsigned int n; - isc_boolean_t first; - - REQUIRE(name->labels > 0); - REQUIRE(name->attributes & DNS_NAMEATTR_ABSOLUTE); - - /* - * Root label. - */ - if (name->length == 1) - return (ISC_TRUE); - - ndata = name->ndata; - n = *ndata++; - INSIST(n <= 63); - while (n--) { - ch = *ndata++; - if (!domainchar(ch)) - return (ISC_FALSE); - } - - if (ndata == name->ndata + name->length) - return (ISC_FALSE); - - /* - * RFC292/RFC1123 hostname. - */ - while (ndata < (name->ndata + name->length)) { - n = *ndata++; - INSIST(n <= 63); - first = ISC_TRUE; - while (n--) { - ch = *ndata++; - if (first || n == 0) { - if (!borderchar(ch)) - return (ISC_FALSE); - } else { - if (!middlechar(ch)) - return (ISC_FALSE); - } - first = ISC_FALSE; - } - } - return (ISC_TRUE); -} - -isc_boolean_t -dns_name_ishostname(const dns_name_t *name, isc_boolean_t wildcard) { - unsigned char *ndata, ch; - unsigned int n; - isc_boolean_t first; - - REQUIRE(name->labels > 0); - REQUIRE(name->attributes & DNS_NAMEATTR_ABSOLUTE); - - /* - * Root label. - */ - if (name->length == 1) - return (ISC_TRUE); - - /* - * Skip wildcard if this is a ownername. - */ - ndata = name->ndata; - if (wildcard && ndata[0] == 1 && ndata[1] == '*') - ndata += 2; - - /* - * RFC292/RFC1123 hostname. - */ - while (ndata < (name->ndata + name->length)) { - n = *ndata++; - INSIST(n <= 63); - first = ISC_TRUE; - while (n--) { - ch = *ndata++; - if (first || n == 0) { - if (!borderchar(ch)) - return (ISC_FALSE); - } else { - if (!middlechar(ch)) - return (ISC_FALSE); - } - first = ISC_FALSE; - } - } - return (ISC_TRUE); -} - unsigned int dns_name_hash(dns_name_t *name, isc_boolean_t case_sensitive) { unsigned int length; @@ -601,62 +500,6 @@ dns_name_caseequal(const dns_name_t *name1, const dns_name_t *name2) { return (ISC_TRUE); } -int -dns_name_rdatacompare(const dns_name_t *name1, const dns_name_t *name2) { - unsigned int l1, l2, l, count1, count2, count; - unsigned char c1, c2; - unsigned char *label1, *label2; - - /* - * Compare two absolute names as rdata. - */ - - REQUIRE(name1->labels > 0); - REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) != 0); - REQUIRE(name2->labels > 0); - REQUIRE((name2->attributes & DNS_NAMEATTR_ABSOLUTE) != 0); - - l1 = name1->labels; - l2 = name2->labels; - - l = (l1 < l2) ? l1 : l2; - - label1 = name1->ndata; - label2 = name2->ndata; - while (l > 0) { - l--; - count1 = *label1++; - count2 = *label2++; - - /* no bitstring support */ - INSIST(count1 <= 63 && count2 <= 63); - - if (count1 != count2) - return ((count1 < count2) ? -1 : 1); - count = count1; - while (count > 0) { - count--; - c1 = maptolower[*label1++]; - c2 = maptolower[*label2++]; - if (c1 < c2) - return (-1); - else if (c1 > c2) - return (1); - } - } - - /* - * If one name had more labels than the other, their common - * prefix must have been different because the shorter name - * ended with the root label and the longer one can't have - * a root label in the middle of it. Therefore, if we get - * to this point, the lengths must be equal. - */ - INSIST(l1 == l2); - - return (0); -} - isc_boolean_t dns_name_issubdomain(const dns_name_t *name1, const dns_name_t *name2) { int order; @@ -1713,33 +1556,6 @@ dns_name_concatenate(dns_name_t *prefix, dns_name_t *suffix, dns_name_t *name, return (ISC_R_SUCCESS); } -void -dns_name_split(dns_name_t *name, unsigned int suffixlabels, - dns_name_t *prefix, dns_name_t *suffix) - -{ - unsigned int splitlabel; - - REQUIRE(suffixlabels > 0); - REQUIRE(suffixlabels < name->labels); - REQUIRE(prefix != NULL || suffix != NULL); - REQUIRE(prefix == NULL || - BINDABLE(prefix)); - REQUIRE(suffix == NULL || - BINDABLE(suffix)); - - splitlabel = name->labels - suffixlabels; - - if (prefix != NULL) - dns_name_getlabelsequence(name, 0, splitlabel, prefix); - - if (suffix != NULL) - dns_name_getlabelsequence(name, splitlabel, - suffixlabels, suffix); - - return; -} - isc_result_t dns_name_dup(const dns_name_t *source, dns_name_t *target) diff --git a/usr.bin/dig/lib/dns/rdata.c b/usr.bin/dig/lib/dns/rdata.c index 5c542099f80..a9820413757 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.17 2020/02/24 13:49:38 jsg Exp $ */ +/* $Id: rdata.c,v 1.18 2020/02/24 15:09:14 jsg Exp $ */ /*! \file */ @@ -56,8 +56,6 @@ #define ARGS_TOWIRE dns_rdata_t *rdata, dns_compress_t *cctx, \ isc_buffer_t *target -#define ARGS_COMPARE const dns_rdata_t *rdata1, const dns_rdata_t *rdata2 - #define ARGS_FROMSTRUCT int rdclass, dns_rdatatype_t type, \ void *source, isc_buffer_t *target @@ -1257,22 +1255,6 @@ dns_rdata_covers(dns_rdata_t *rdata) { } isc_boolean_t -dns_rdatatype_issingleton(dns_rdatatype_t type) { - if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_SINGLETON) - != 0) - return (ISC_TRUE); - return (ISC_FALSE); -} - -isc_boolean_t -dns_rdatatype_questiononly(dns_rdatatype_t type) { - if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_QUESTIONONLY) - != 0) - return (ISC_TRUE); - return (ISC_FALSE); -} - -isc_boolean_t dns_rdatatype_isknown(dns_rdatatype_t type) { if ((dns_rdatatype_attributes(type) & DNS_RDATATYPEATTR_UNKNOWN) == 0) diff --git a/usr.bin/dig/lib/isc/Makefile.inc b/usr.bin/dig/lib/isc/Makefile.inc index 9a29ecc887a..f2c78e7ce26 100644 --- a/usr.bin/dig/lib/isc/Makefile.inc +++ b/usr.bin/dig/lib/isc/Makefile.inc @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile.inc,v 1.4 2020/02/13 09:29:34 jsg Exp $ +# $OpenBSD: Makefile.inc,v 1.5 2020/02/24 15:09:14 jsg Exp $ .PATH: ${.CURDIR}/lib/isc SRCS+= assertions.c base32.c base64.c netaddr.c buffer.c bufferlist.c SRCS+= error.c event.c hash.c heap.c hex.c hmacsha.c SRCS+= lex.c log.c regex.c sockaddr.c -SRCS+= task.c result.c parseint.c refcount.c region.c timer.c +SRCS+= task.c result.c parseint.c refcount.c timer.c SRCS+= safe.c serial.c sha1.c sha2.c symtab.c diff --git a/usr.bin/dig/lib/isc/include/isc/region.h b/usr.bin/dig/lib/isc/include/isc/region.h index 1f1d4ca7bfd..8375397f6de 100644 --- a/usr.bin/dig/lib/isc/include/isc/region.h +++ b/usr.bin/dig/lib/isc/include/isc/region.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: region.h,v 1.3 2020/02/23 06:22:46 jsg Exp $ */ +/* $Id: region.h,v 1.4 2020/02/24 15:09:14 jsg Exp $ */ #ifndef ISC_REGION_H #define ISC_REGION_H 1 @@ -47,30 +47,6 @@ struct isc_textregion { _r->base += _l; \ _r->length -= _l; \ } while (0) - -#define isc_textregion_consume(r,l) \ - do { \ - isc_textregion_t *_r = (r); \ - unsigned int _l = (l); \ - INSIST(_r->length >= _l); \ - _r->base += _l; \ - _r->length -= _l; \ - } while (0) /*@}*/ -int -isc_region_compare(isc_region_t *r1, isc_region_t *r2); -/*%< - * Compares the contents of two regions - * - * Requires: - *\li 'r1' is a valid region - *\li 'r2' is a valid region - * - * Returns: - *\li < 0 if r1 is lexicographically less than r2 - *\li = 0 if r1 is lexicographically identical to r2 - *\li > 0 if r1 is lexicographically greater than r2 - */ - #endif /* ISC_REGION_H */ diff --git a/usr.bin/dig/lib/isc/region.c b/usr.bin/dig/lib/isc/region.c deleted file mode 100644 index 6d9cbe3ac38..00000000000 --- a/usr.bin/dig/lib/isc/region.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: region.c,v 1.1 2020/02/07 09:58:54 florian Exp $ */ - -/*! \file */ - - - -#include <stdlib.h> -#include <string.h> - -#include <isc/region.h> -#include <isc/util.h> - -int -isc_region_compare(isc_region_t *r1, isc_region_t *r2) { - unsigned int l; - int result; - - REQUIRE(r1 != NULL); - REQUIRE(r2 != NULL); - - l = (r1->length < r2->length) ? r1->length : r2->length; - - if ((result = memcmp(r1->base, r2->base, l)) != 0) - return ((result < 0) ? -1 : 1); - else - return ((r1->length == r2->length) ? 0 : - (r1->length < r2->length) ? -1 : 1); -} |
