diff --git a/lib/dns/master.c b/lib/dns/master.c index 634a2c0dff..e2a1f70b61 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -978,7 +978,7 @@ check_ns(dns_loadctx_t *lctx, isc_token_t *token, const char *source, */ if (tmp[strlen(tmp) - 1] == '.') tmp[strlen(tmp) - 1] = '\0'; - if (inet_aton(tmp, &addr) == 1 || + if (inet_pton(AF_INET, tmp, &addr) == 1 || inet_pton(AF_INET6, tmp, &addr6) == 1) result = DNS_R_NSISADDRESS; } diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 38096bba06..e72b49909a 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -383,11 +383,9 @@ getquad(const void *src, struct in_addr *dst, isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks) { int result; - struct in_addr tmp; - result = inet_aton(src, dst); - if (result == 1 && callbacks != NULL && - inet_pton(AF_INET, src, &tmp) != 1) { + result = inet_pton(AF_INET, src, dst); + if (result != 1 && callbacks != NULL) { const char *name = isc_lex_getsourcename(lexer); if (name == NULL) name = "UNKNOWN"; diff --git a/lib/dns/rdata/generic/mx_15.c b/lib/dns/rdata/generic/mx_15.c index 652e304446..dfc9a7ab1a 100644 --- a/lib/dns/rdata/generic/mx_15.c +++ b/lib/dns/rdata/generic/mx_15.c @@ -35,9 +35,10 @@ check_mx(isc_token_t *token) { if (tmp[strlen(tmp) - 1] == '.') tmp[strlen(tmp) - 1] = '\0'; - if (inet_aton(tmp, &addr) == 1 || - inet_pton(AF_INET6, tmp, &addr6) == 1) + if (inet_pton(AF_INET, tmp, &addr) == 1 || + inet_pton(AF_INET6, tmp, &addr6) == 1) { return (ISC_FALSE); + } return (ISC_TRUE); } diff --git a/lib/irs/resconf.c b/lib/irs/resconf.c index 2bfd4ae656..6cb4ce327a 100644 --- a/lib/irs/resconf.c +++ b/lib/irs/resconf.c @@ -252,7 +252,7 @@ create_addr(const char *buffer, isc_netaddr_t *addr, int convert_zero) { struct in_addr v4; struct in6_addr v6; - if (inet_aton(buffer, &v4) == 1) { + if (inet_pton(AF_INET, buffer, &v4) == 1) { if (convert_zero) { unsigned char zeroaddress[] = {0, 0, 0, 0}; unsigned char loopaddress[] = {127, 0, 0, 1}; diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 0c62a99c70..30deb48716 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -53,7 +53,7 @@ OBJS = @ISC_EXTRA_OBJS@ @ISC_PK11_O@ @ISC_PK11_RESULT_O@ \ bind9.@O@ buffer.@O@ bufferlist.@O@ \ commandline.@O@ counter.@O@ crc64.@O@ error.@O@ event.@O@ \ hash.@O@ ht.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ \ - hmacsha.@O@ httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \ + hmacsha.@O@ httpd.@O@ iterated_hash.@O@ \ lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \ md5.@O@ mem.@O@ mutexblock.@O@ \ netaddr.@O@ netscope.@O@ pool.@O@ \ @@ -73,7 +73,7 @@ SRCS = @ISC_EXTRA_SRCS@ @ISC_PK11_C@ @ISC_PK11_RESULT_C@ \ aes.c assertions.c backtrace.c base32.c base64.c bind9.c \ buffer.c bufferlist.c commandline.c counter.c crc64.c \ error.c event.c hash.c ht.c heap.c hex.c hmacmd5.c \ - hmacsha.c httpd.c inet_aton.c iterated_hash.c \ + hmacsha.c httpd.c iterated_hash.c \ lex.c lfsr.c lib.c log.c \ md5.c mem.c mutexblock.c \ netaddr.c netscope.c pool.c \ diff --git a/lib/isc/inet_aton.c b/lib/isc/inet_aton.c deleted file mode 100644 index 02d451c26a..0000000000 --- a/lib/isc/inet_aton.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Portions Copyright (C) 1996-2001, 2004, 2005, 2007, 2008, 2012-2014, 2016-2018 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. - */ - -/* - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and 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, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION 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. - */ -/*! \file */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; -static char rcsid[] = "$Id: inet_aton.c,v 1.23 2008/12/01 23:47:45 tbox Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include - -#include -#include /* Required for NULL. */ - -#include -#include - -/*% - * Check whether "cp" is a valid ascii representation - * of an Internet address and convert to a binary address. - * Returns 1 if the address is valid, 0 if not. - * This replaces inet_addr, the return value from which - * cannot distinguish between failure and a local broadcast address. - */ -int -isc_net_aton(const char *cp, struct in_addr *addr) { - isc_uint32_t val; - int base; - ptrdiff_t n; - unsigned char c; - isc_uint32_t parts[4]; - isc_uint32_t *pp = parts; - int digit; - - c = *cp; - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, isdigit=decimal. - */ - if (!isdigit(c & 0xff)) - return (0); - val = 0; base = 10; digit = 0; - if (c == '0') { - c = *++cp; - if (c == 'x' || c == 'X') - base = 16, c = *++cp; - else { - base = 8; - digit = 1; - } - } - for (;;) { - /* - * isascii() is valid for all integer values, and - * when it is true, c is known to be in scope - * for isdigit(). No cast necessary. Similar - * comment applies for later ctype uses. - */ - if (isascii(c) && isdigit(c)) { - if (base == 8 && (c == '8' || c == '9')) - return (0); - val = (val * base) + (c - '0'); - c = *++cp; - digit = 1; - } else if (base == 16 && isascii(c) && isxdigit(c)) { - val = (val << 4) | - (c + 10 - (islower(c) ? 'a' : 'A')); - c = *++cp; - digit = 1; - } else - break; - } - if (c == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16 bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3 || val > 0xffU) - return (0); - *pp++ = val; - c = *++cp; - } else - break; - } - /* - * Check for trailing characters. - */ - if (c != '\0' && (!isascii(c) || !isspace(c))) - return (0); - /* - * Did we get a valid digit? - */ - if (!digit) - return (0); - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts + 1; - switch (n) { - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (val > 0xffffffU) - return (0); - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffffU) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xffU) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - if (addr != NULL) - addr->s_addr = htonl(val); - - return (1); -} diff --git a/lib/isc/unix/include/isc/net.h b/lib/isc/unix/include/isc/net.h index 3dd792bef0..211b8af4b9 100644 --- a/lib/isc/unix/include/isc/net.h +++ b/lib/isc/unix/include/isc/net.h @@ -38,7 +38,7 @@ * * It declares ntoh[sl]() and hton[sl](). * - * It declares inet_aton(), inet_ntop(), and inet_pton(). + * It declares inet_ntop(), and inet_pton(). * * It ensures that #INADDR_LOOPBACK, #INADDR_ANY, #IN6ADDR_ANY_INIT, * IN6ADDR_V4MAPPED_INIT, in6addr_any, and in6addr_loopback are available. @@ -406,11 +406,6 @@ isc_net_pton(int af, const char *src, void *dst); #define inet_pton isc_net_pton #endif -int -isc_net_aton(const char *cp, struct in_addr *addr); -#undef inet_aton -#define inet_aton isc_net_aton - ISC_LANG_ENDDECLS #endif /* ISC_NET_H */ diff --git a/lib/isc/win32/include/isc/net.h b/lib/isc/win32/include/isc/net.h index 38f25630fc..00a38db2dc 100644 --- a/lib/isc/win32/include/isc/net.h +++ b/lib/isc/win32/include/isc/net.h @@ -34,7 +34,7 @@ * * It declares ntoh[sl]() and hton[sl](). * - * It declares inet_aton(), inet_ntop(), and inet_pton(). + * It declares inet_ntop(), and inet_pton(). * * It ensures that INADDR_ANY, IN6ADDR_ANY_INIT, in6addr_any, and * in6addr_loopback are available. @@ -410,10 +410,6 @@ isc_net_pton(int af, const char *src, void *dst); #define inet_pton isc_net_pton #endif -int -isc_net_aton(const char *cp, struct in_addr *addr); -#define inet_aton isc_net_aton - ISC_LANG_ENDDECLS #endif /* ISC_NET_H */ diff --git a/lib/isc/win32/libisc.vcxproj.filters.in b/lib/isc/win32/libisc.vcxproj.filters.in index 44cdd9dd3a..eaf019fd77 100644 --- a/lib/isc/win32/libisc.vcxproj.filters.in +++ b/lib/isc/win32/libisc.vcxproj.filters.in @@ -543,9 +543,6 @@ Library Source Files - - Library Source Files - Library Source Files diff --git a/lib/isc/win32/libisc.vcxproj.in b/lib/isc/win32/libisc.vcxproj.in index c1125b493b..0815eac2e8 100644 --- a/lib/isc/win32/libisc.vcxproj.in +++ b/lib/isc/win32/libisc.vcxproj.in @@ -447,7 +447,6 @@ copy InstallFiles ..\Build\Release\ - diff --git a/lib/ns/update.c b/lib/ns/update.c index 05bf794cf1..8ad98a1c72 100644 --- a/lib/ns/update.c +++ b/lib/ns/update.c @@ -1741,7 +1741,7 @@ check_mx(ns_client_t *client, dns_zone_t *zone, strlcpy(tmp, namebuf, sizeof(tmp)) < sizeof(tmp)) { if (tmp[strlen(tmp) - 1] == '.') tmp[strlen(tmp) - 1] = '\0'; - if (inet_aton(tmp, &addr) == 1 || + if (inet_pton(AF_INET, tmp, &addr) == 1 || inet_pton(AF_INET6, tmp, &addr6) == 1) isaddress = ISC_TRUE; } diff --git a/util/copyrights b/util/copyrights index 4ad85285f7..b661ea5239 100644 --- a/util/copyrights +++ b/util/copyrights @@ -3965,7 +3965,6 @@ ./lib/isc/include/pkcs11/pkcs11.h X 2014,2016,2018 ./lib/isc/include/pkcs11/pkcs11f.h X 2014,2016,2018 ./lib/isc/include/pkcs11/pkcs11t.h X 2014,2016,2018 -./lib/isc/inet_aton.c C.PORTION 1996,1997,1998,1999,2000,2001,2004,2005,2007,2008,2012,2013,2014,2016,2017,2018 ./lib/isc/inet_ntop.c C 1996,1997,1998,1999,2000,2001,2004,2005,2007,2009,2016,2017,2018 ./lib/isc/inet_pton.c C 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2007,2013,2014,2016,2017,2018 ./lib/isc/iterated_hash.c C 2006,2008,2009,2016,2018