diff --git a/deps/cares/CHANGES b/deps/cares/CHANGES index 5ecd504f063ebd..d465143131d726 100644 --- a/deps/cares/CHANGES +++ b/deps/cares/CHANGES @@ -1,5 +1,232 @@ Changelog for the c-ares project. Generated with git2changes.pl +Version 1.19.1 (22 May 2023) + +bradh352 (22 May 2023) +- Makefile.inc Windows requires tabs not spaces for nmake + +GitHub (22 May 2023) +- [Daniel Stenberg brought this change] + + ares_expand_name: fix compiler warnings (#522) + + Fix some compiler warnings (not introduced in this release) + + Fix By: Daniel Stenberg (@bagder) + +bradh352 (22 May 2023) +- windows MSVC compiler fix on 32bit + +- update security advisory links + +- minor CI issues fixes for imported inet_net_pton + +- ares_rand static analysis fixes from CI + +- windows build fix + +- security release notes + +GitHub (22 May 2023) +- [Brad House brought this change] + + Merge pull request from GHSA-9g78-jv2r-p7vc + +- [Brad House brought this change] + + Merge pull request from GHSA-x6mf-cxr9-8q6v + + * Merged latest OpenBSD changes for inet_net_pton_ipv6() into c-ares. + * Always use our own IP conversion functions now, do not delegate to OS + so we can have consistency in testing and fuzzing. + * Removed bogus test cases that never should have passed. + * Add new test case for crash bug found. + + Fix By: Brad House (@bradh352) + +- [Brad House brought this change] + + Merge pull request from GHSA-8r8p-23f3-64c2 + + * segment random number generation into own file + + * abstract random code to make it more modular so we can have multiple backends + + * rand: add support for arc4random_buf() and also direct CARES_RANDOM_FILE reading + + * autotools: fix detection of arc4random_buf + + * rework initial rc4 seed for PRNG as last fallback + + * rc4: more proper implementation, simplified for clarity + + * clarifications + +bradh352 (20 May 2023) +- add public release note information + +- bump version to 1.19.1 + +GitHub (6 May 2023) +- [Gregor Jasny brought this change] + + test: fix warning about uninitialized memory (#515) + + fix warning in tests + + Fix By: Gregor Jasny (@gjasny) + +- [lifenjoiner brought this change] + + Turn off IPV6_V6ONLY on Windows if it is supported (#520) + + Turn off IPV6_V6ONLY on Windows if it is supported, support for IPv4-mapped IPv6 addresses. + + IPV6_V6ONLY refs: + https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses + https://github.com/golang/go/blob/master/src/net/ipsock_posix.go + https://en.wikipedia.org/wiki/Unix-like + off: + https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables + https://man.netbsd.org/inet6.4 + https://man.freebsd.org/cgi/man.cgi?query=inet6 + https://github.com/apple-oss-distributions/xnu/blob/main/bsd/man/man4/inet6.4 + on: + https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options + acts like off, but returns 1 and dummy setting: + https://man.dragonflybsd.org/?command=inet6 + https://man.dragonflybsd.org/?command=ip6 + unsupported and read-only returns 1: + https://man.openbsd.org/inet6.4 + + default value refs: + https://datatracker.ietf.org/doc/html/rfc3493#section-5.3 + https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables + +- [Brad House brought this change] + + Merge pull request from GHSA-54xr-f67r-4pc4 + + * CARES_RANDOM_FILE should always default to /dev/urandom + + During cross-compilation, CARES_RANDOM_FILE may not be able to be appropriately + detected, therefore we should always set it to /dev/urandom and allow the + entity requesting compilation override the value. The code does appropriately + fall back if CARES_RANDOM_FILE cannot be opened. + + * use set not option + +bradh352 (18 Mar 2023) +- ares_getaddrinfo using service of "0" should be allowed + + As per #517 glibc allows a service/servname of "0" to be treated the + same as if NULL was provided. Also, add a sanity check to ensure + the port number is in range instead of a blind cast. + + Fixes: #517 + Fix By: Brad House (@bradh352) + +GitHub (10 Feb 2023) +- [Nikolaos Chatzikonstantinou brought this change] + + fix memory leak in ares_send (#511) + + When the condition channel->nservers < 1 holds, the function returns + prematurely, without deallocating query->tcpbuf. We rearrange the + check to be done prior to the allocations, avoiding the memory + leak. In this way, we also avoid unnecessary allocations if + channel->nservers < 1 holds. + + Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount) + +- [Nikolaos Chatzikonstantinou brought this change] + + change comment style to old-style (#513) + + Following the README.md guidelines, + + "Comments must be written in the old-style" + + the comment is changed to the old style. + + Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount) + +- [Nikolaos Chatzikonstantinou brought this change] + + use strncasecmp in ares__strsplit (#512) + + strncasecmp on platforms that don't already have it is already #define'd to a private implementation. There is no need to have OS-specific logic. Also removes ares__strsplit.h as a header as ares_private.h already includes it. + + Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount) + +- [Yijie Ma brought this change] + + Fix a typo in ares_init_options.3 (#510) + + that -> than + + Fix By: Yijie Ma (@yijiem) + +- [Douglas R. Reno brought this change] + + Watcom Portability Improvements (#509) + + - Modify the Watcom Makefile for the source code reorganization (#352) + - Add *.map files into .gitignore + - Fix build errors with Watcom's builtin Windows SDK (which is rather + outdated). It's smart enough to understand Windows Vista, but doesn't + have PMIB_UNICASTIPADDRESS_TABLE or MIB_IPFORWARD_ROW2. + + It may be possible to use a different Windows SDK with the Watcom + compiler, such as the most recent Windows 10 SDK. Alternatively the SDK + in OpenWatcom 2.0 (which is in development) should fix this. + + I have no problems testing this Makefile prior to releases, just give me + a ping. + + Tested with Windows Vista, Windows 7, and Windows 10 using 'adig', + 'acountry', and 'ahost'. This also seems to work on Windows XP, though + this is likely due to the compiler in use. + + Fix By: Douglas R. Reno (@renodr) + Fixes Bug: #352 + +- [Jay Freeman (saurik) brought this change] + + ignore aminclude_static.am, as generated by AX_AM_MACROS_STATIC (#508) + + Fix By: Jay Freeman (@saurik) + +- [Jay Freeman (saurik) brought this change] + + sync ax_pthread.m4 with upstream (#507) + + The version in the repository is many years old so this PR simply pulls in the latest + available revision from: + http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4 + + Fix By: Jay Freeman (@saurik) + +- [Chilledheart brought this change] + + Windows: Invalid stack variable out of scope for HOSTS file path (#502) + + In some conditions Windows might try to use a stack address that has gone out of scope when determining where to read the hosts data from for file lookups. + + Fix By: @Chilledheart + +- [Brad House brought this change] + + sync ax_cxx_compile_stdcxx_11.m4 with upstream (#505) + + It was reported that ax_cxx_compile_stdcxx_11.m4 was not compatible with uclibc. + The version in the repository is many years old so this PR simply pulls in the latest + available revision from: + http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4 + + Fixes Bug: #504 + Fix By: Brad House (@bradh352) + Version 1.19.0 (18 Jan 2023) bradh352 (18 Jan 2023) @@ -5325,76 +5552,3 @@ Daniel Stenberg (23 Mar 2010) - git now, not CVS - ignore lots of generated files - -- [Daniel Johnson brought this change] - - Fix warnings for clang - -Yang Tse (17 Mar 2010) -- replaced intel compiler option -no-ansi-alias with -fno-strict-aliasing - -- update outdated serial number - -- fix compiler warning - -- watt32 compilation fix - -- Added another VS10 version string - -- fix line break - -- removed usage of 's6_addr', fixing compilation issue triggered with no - longer using 'in6_addr' but only our 'ares_in6_addr' struct - -Daniel Stenberg (5 Mar 2010) -- Daniel Johnson provided fixes for building with the clang compiler - -Yang Tse (5 Mar 2010) -- Added IPv6 name servers support - -Gisle Vanem (5 Mar 2010) -- Ops!. Readded ares_nowarn.h. - -- Added ares_nowarn.c. - -Yang Tse (28 Feb 2010) -- Added SIZEOF_INT and SIZEOF_SHORT definitions for non-configure systems - -- Added ares_nowarn.* to VC6 project file - -- Added SIZEOF_INT definition - -- fix compiler warning - -- fix compiler warning - -- fix compiler warning - -Daniel Stenberg (17 Feb 2010) -- ares_reinit() - - - To allow an app to force a re-read of /etc/resolv.conf etc, pretty much - like the res_init() resolver function offers - -- - Tommie Gannert pointed out a silly bug in ares_process_fd() since it didn't - check for broken connections like ares_process() did. Based on that, I - merged the two functions into a single generic one with two front-ends. - -Yang Tse (30 Dec 2009) -- VMS specific preprocessor symbol checking adjustments - -- Mention last changes - -- - Fix configure_socket() to use ares_socket_t instead of int data type. - -- - Where run-time error checks enabling compiler option /GZ was used it is now - replaced with equivalent /RTCsu for Visual Studio 2003 and newer versions. - - - Compiler option /GX is now replaced with equivalent /EHsc for all versions. - -- - Ingmar Runge noticed that Windows config-win32.h configuration file - did not include a definition for HAVE_CLOSESOCKET which resulted in - function close() being inappropriately used to close sockets. - -Daniel Stenberg (30 Nov 2009) -- start working on 1.7.1 diff --git a/deps/cares/CMakeLists.txt b/deps/cares/CMakeLists.txt index d11c0bba52d649..9379014296c44b 100644 --- a/deps/cares/CMakeLists.txt +++ b/deps/cares/CMakeLists.txt @@ -8,10 +8,10 @@ INCLUDE (CheckCSourceCompiles) INCLUDE (CheckStructHasMember) INCLUDE (CheckLibraryExists) -PROJECT (c-ares LANGUAGES C VERSION "1.19.0" ) +PROJECT (c-ares LANGUAGES C VERSION "1.19.1" ) # Set this version before release -SET (CARES_VERSION "1.19.0") +SET (CARES_VERSION "1.19.1") INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are wrong. @@ -26,7 +26,7 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w # For example, a version of 4:0:2 would generate output such as: # libname.so -> libname.so.2 # libname.so.2 -> libname.so.2.2.0 -SET (CARES_LIB_VERSIONINFO "8:0:6") +SET (CARES_LIB_VERSIONINFO "8:1:6") OPTION (CARES_STATIC "Build as a static library" OFF) @@ -36,6 +36,8 @@ OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent) OPTION (CARES_BUILD_TESTS "Build and run tests" OFF) OPTION (CARES_BUILD_CONTAINER_TESTS "Build and run container tests (implies CARES_BUILD_TESTS, Linux only)" OFF) OPTION (CARES_BUILD_TOOLS "Build tools" ON) +SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom") + # Tests require static to be enabled on Windows to be able to access otherwise hidden symbols IF (CARES_BUILD_TESTS AND (NOT CARES_STATIC) AND WIN32) @@ -391,6 +393,8 @@ CHECK_SYMBOL_EXISTS (strncasecmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCAS CHECK_SYMBOL_EXISTS (strncmpi "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCMPI) CHECK_SYMBOL_EXISTS (strnicmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNICMP) CHECK_SYMBOL_EXISTS (writev "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_WRITEV) +CHECK_SYMBOL_EXISTS (arc4random_buf "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_ARC4RANDOM_BUF) + # On Android, the system headers may define __system_property_get(), but excluded # from libc. We need to perform a link test instead of a header/symbol test. @@ -402,10 +406,6 @@ SET (CMAKE_REQUIRED_DEFINITIONS) SET (CMAKE_REQUIRED_LIBRARIES) -find_file(CARES_RANDOM_FILE urandom /dev) -mark_as_advanced(CARES_RANDOM_FILE) - - ################################################################################ # recv, recvfrom, send, getnameinfo, gethostname # ARGUMENTS AND RETURN VALUES diff --git a/deps/cares/RELEASE-NOTES b/deps/cares/RELEASE-NOTES index db705905bae50f..2524f3ccf413e8 100644 --- a/deps/cares/RELEASE-NOTES +++ b/deps/cares/RELEASE-NOTES @@ -1,91 +1,57 @@ -c-ares version 1.19.0 +c-ares version 1.19.1 -This is a feature and bugfix release. It addresses a couple of new feature -requests as well as a couple of bug fixes. +This is a security and bugfix release. -Security: - o Low. Stack overflow in ares_set_sortlist() which is used during c-ares - initialization and typically provided by an administrator and not an - end user. [24] +A special thanks goes out to the Open Source Technology Improvement Fund +(https://ostif.org) for sponsoring a security audit of c-ares performed by X41 +(https://x41-dsec.de). -Changes: - o Windows: Drop support for XP and derivatives which greatly cleans up - initialization code. [3] - o Add ARES_OPT_HOSTS_FILE similar to ARES_OPT_RESOLVCONF for specifying a - custom hosts file location. [10] - o Add vcpkg installation instructions [13] +Security: + o CVE-2023-32067. High. 0-byte UDP payload causes Denial of Service [12] + o CVE-2023-31147. Moderate. Insufficient randomness in generation of DNS + query IDs [13] + o CVE-2023-31130. Moderate. Buffer Underwrite in ares_inet_net_pton() [14] + o CVE-2023-31124. Low. AutoTools does not set CARES_RANDOM_FILE during cross + compilation [15] Bug fixes: - o Fix cross-compilation from Windows to Linux due to CPACK logic. [1] - o Fix memory leak in reading /etc/hosts when using localhost fallback. [2] - o Fix chain building c-ares when libresolv is already included by another - project [4] - o File lookup should not immediately abort as there may be other tries due to - search criteria. - o Asterisks should be allowed in host validation as CNAMEs may reference - wildcard domains [5] - o AutoTools build system referenced bad STDC_HEADERS macro [6] - o Even if one address class returns a failure for ares_getaddrinfo() we should - still return the results we have - o CMake Windows: DLLs did not include resource file to include versions [7] [8] - o CMake: Guard target creation in exported config [9] - o Fix ares_getaddrinfo() numerical address resolution with AF_UNSPEC [11] - o Apple: fix libresolv configured query times. [12] - o Fix tools and help information [14] [15] - o Various documentation fixes and cleanups [16] [22] [25] - o Add include guards to ares_data.h [17] - o c-ares could try to exceed maximum number of iovec entries supported by - system [18] - o CMake package config generation allow for absolute install paths [19] - o Intel compiler fixes [20] - o ares_strsplit bugs [21] [23] - o The RFC6761 6.3 states localhost subdomains must be offline too. [26] + o Fix uninitialized memory warning in test [1] + o Turn off IPV6_V6ONLY on Windows to allow IPv4-mapped IPv6 addresses [2] + o ares_getaddrinfo() should allow a port of 0 [3] + o Fix memory leak in ares_send() on error [4] + o Fix comment style in ares_data.h [5] + o Remove unneeded ifdef for Windows [6] + o Fix typo in ares_init_options.3 [7] + o Re-add support for Watcom compiler [8] + o Sync ax_pthread.m4 with upstream [9] + o Windows: Invalid stack variable used out of scope for HOSTS path [10] + o Sync ax_cxx_compile_stdcxx_11.m4 with upstream to fix uclibc support [11] Thanks go to these friendly people for their efforts and contributions: - Boby Reynolds (@reynoldsbd) Brad House (@bradh352) - Brad Spencer (@b-spencer) - @bsergean + @Chilledheart Daniel Stenberg (@bagder) - Dmitry Karpov - @FrankXie05 - @hopper-vul - Jonathan Ringer (@jonringer) - Kai Pastor (@dg0yt) + Douglas R. Reno (@renodr) + Gregor Jasny (@gjasny) + Jay Freeman (@saurik) @lifenjoiner - Manish Mehra (@mmehra) - @marc-groundctl Nikolaos Chatzikonstantinou (@createyourpersonalaccount) - Ridge Kennedy (@ridgek) - Sam James (@thesamesam) - Stephen Sachs (@stephenmsachs) - Thomas Dreibholz (@dreibh) -(18 contributors) + Yijie Ma (@yijiem) +(9 contributors) References to bug reports and discussions on issues: - [1] = https://github.com/c-ares/c-ares/pull/436 - [2] = https://github.com/c-ares/c-ares/issues/439 - [3] = https://github.com/c-ares/c-ares/pull/445 - [4] = https://github.com/c-ares/c-ares/pull/451 - [5] = https://github.com/c-ares/c-ares/issues/457 - [6] = https://github.com/c-ares/c-ares/pull/459 - [7] = https://github.com/c-ares/c-ares/issues/460 - [8] = https://github.com/c-ares/c-ares/pull/468 - [9] = https://github.com/c-ares/c-ares/pull/464 - [10] = https://github.com/c-ares/c-ares/pull/465 - [11] = https://github.com/c-ares/c-ares/pull/469 - [12] = https://github.com/c-ares/c-ares/pull/467 - [13] = https://github.com/c-ares/c-ares/pull/478 - [14] = https://github.com/c-ares/c-ares/pull/479 - [15] = https://github.com/c-ares/c-ares/pull/481 - [16] = https://github.com/c-ares/c-ares/pull/490 - [17] = https://github.com/c-ares/c-ares/pull/491 - [18] = https://github.com/c-ares/c-ares/pull/489 - [19] = https://github.com/c-ares/c-ares/pull/486 - [20] = https://github.com/c-ares/c-ares/pull/485 - [21] = https://github.com/c-ares/c-ares/pull/492 - [22] = https://github.com/c-ares/c-ares/pull/494 - [23] = https://github.com/c-ares/c-ares/pull/495 - [24] = https://github.com/c-ares/c-ares/pull/497 - [25] = https://github.com/c-ares/c-ares/issues/487 - [26] = https://github.com/c-ares/c-ares/issues/477 + [1] = https://github.com/c-ares/c-ares/pull/515 + [2] = https://github.com/c-ares/c-ares/pull/520 + [3] = https://github.com/c-ares/c-ares/issues/517 + [4] = https://github.com/c-ares/c-ares/pull/511 + [5] = https://github.com/c-ares/c-ares/pull/513 + [6] = https://github.com/c-ares/c-ares/pull/512 + [7] = https://github.com/c-ares/c-ares/pull/510 + [8] = https://github.com/c-ares/c-ares/pull/509 + [9] = https://github.com/c-ares/c-ares/pull/507 + [10] = https://github.com/c-ares/c-ares/pull/502 + [11] = https://github.com/c-ares/c-ares/pull/505 + [12] = https://github.com/c-ares/c-ares/security/advisories/GHSA-9g78-jv2r-p7vc + [13] = https://github.com/c-ares/c-ares/security/advisories/GHSA-8r8p-23f3-64c2 + [14] = https://github.com/c-ares/c-ares/security/advisories/GHSA-x6mf-cxr9-8q6v + [15] = https://github.com/c-ares/c-ares/security/advisories/GHSA-54xr-f67r-4pc4 diff --git a/deps/cares/aminclude_static.am b/deps/cares/aminclude_static.am index aad78eb4b1e0af..94db7e3a8c6d7c 100644 --- a/deps/cares/aminclude_static.am +++ b/deps/cares/aminclude_static.am @@ -1,6 +1,6 @@ # aminclude_static.am generated automatically by Autoconf -# from AX_AM_MACROS_STATIC on Sat Jan 28 22:07:59 CET 2023 +# from AX_AM_MACROS_STATIC on Mon May 22 14:23:05 CEST 2023 # Code coverage diff --git a/deps/cares/configure b/deps/cares/configure index 4c5e1a966c6d9f..2f182e0ce3177d 100755 --- a/deps/cares/configure +++ b/deps/cares/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for c-ares 1.19.0. +# Generated by GNU Autoconf 2.71 for c-ares 1.19.1. # # Report bugs to . # @@ -855,8 +855,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='c-ares' PACKAGE_TARNAME='c-ares' -PACKAGE_VERSION='1.19.0' -PACKAGE_STRING='c-ares 1.19.0' +PACKAGE_VERSION='1.19.1' +PACKAGE_STRING='c-ares 1.19.1' PACKAGE_BUGREPORT='c-ares mailing list: http://lists.haxx.se/listinfo/c-ares' PACKAGE_URL='' @@ -1650,7 +1650,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures c-ares 1.19.0 to adapt to many kinds of systems. +\`configure' configures c-ares 1.19.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1721,7 +1721,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of c-ares 1.19.0:";; + short | recursive ) echo "Configuration of c-ares 1.19.1:";; esac cat <<\_ACEOF @@ -1861,7 +1861,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -c-ares configure 1.19.0 +c-ares configure 1.19.1 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2453,7 +2453,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by c-ares $as_me 1.19.0, which was +It was created by c-ares $as_me 1.19.1, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3426,7 +3426,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -CARES_VERSION_INFO="8:0:6" +CARES_VERSION_INFO="8:1:6" @@ -6301,144 +6301,323 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - ax_cxx_compile_cxx11_required=false + ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=false ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_success=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5 -printf %s "checking whether $CXX supports C++11 features by default... " >&6; } -if test ${ax_cv_cxx_compile_cxx11+y} + + + + + + if test x$ac_success = xno; then + for alternative in ${ax_cxx_compile_alternatives}; do + for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 +printf %s "checking whether $CXX supports C++11 features with $switch... " >&6; } +if eval test \${$cachevar+y} then : printf %s "(cached) " >&6 else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - template + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +// MSVC always sets __cplusplus to 199711L in older versions; newer versions +// only set it correctly if /Zc:__cplusplus is specified as well as a +// /std:c++NN switch: +// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ +#elif __cplusplus < 201103L && !defined _MSC_VER + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template struct check { static_assert(sizeof(int) <= sizeof(T), "not big enough"); }; - struct Base { - virtual void f() {} + } + + namespace test_final_override + { + + struct Base + { + virtual ~Base() {} + virtual void f() {} }; - struct Child : public Base { - virtual void f() override {} + + struct Derived : public Base + { + virtual ~Derived() override {} + virtual void f() override {} }; - typedef check> right_angle_brackets; + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; - int a; - decltype(a) b; + } - typedef check check_type; - check_type c; - check_type&& cr = static_cast(c); + namespace test_decltype + { - auto d = a; - auto l = [](){}; + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this - namespace test_template_alias_sfinae { - struct foo {}; + } - template - using member = typename T::member_type; + namespace test_type_deduction + { - template - void func(...) {} + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; - template - void func(member*) {} + template < typename T > + struct is_same + { + static const bool value = true; + }; - void test(); + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } - void test() { - func(0); - } + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); } -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ax_cv_cxx_compile_cxx11=yes -else $as_nop - ax_cv_cxx_compile_cxx11=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5 -printf "%s\n" "$ax_cv_cxx_compile_cxx11" >&6; } - if test x$ax_cv_cxx_compile_cxx11 = xyes; then - ac_success=yes - fi + } + namespace test_noexcept + { + int f() { return 0; } + int g() noexcept { return 0; } - if test x$ac_success = xno; then - for switch in -std=c++11 -std=c++0x; do - cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5 -printf %s "checking whether $CXX supports C++11 features with $switch... " >&6; } -if eval test \${$cachevar+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); - template - struct check + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; }; - struct Base { - virtual void f() {} + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; }; - struct Child : public Base { - virtual void f() override {} + + template <> + struct sum<> + { + static constexpr auto value = 0; }; - typedef check> right_angle_brackets; + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); - int a; - decltype(a) b; + } - typedef check check_type; - check_type c; - check_type&& cr = static_cast(c); + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { - auto d = a; - auto l = [](){}; + struct foo {}; - // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae - // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this - namespace test_template_alias_sfinae { - struct foo {}; + template + using member = typename T::member_type; - template - using member = typename T::member_type; + template + void func(...) {} - template - void func(...) {} + template + void func(member*) {} - template - void func(member*) {} + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L - void test(); - void test() { - func(0); - } - } _ACEOF if ac_fn_cxx_try_compile "$LINENO" @@ -6448,14 +6627,21 @@ else $as_nop eval $cachevar=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CXXFLAGS="$ac_save_CXXFLAGS" + CXX="$ac_save_CXX" fi eval ac_res=\$$cachevar { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 printf "%s\n" "$ac_res" >&6; } - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + if test x$ac_success = xyes; then break fi done @@ -6470,22 +6656,20 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test x$ac_success = xno; then as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5 fi - else - if test x$ac_success = xno; then - HAVE_CXX11=0 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 + fi + if test x$ac_success = xno; then + HAVE_CXX11=0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5 printf "%s\n" "$as_me: No compiler with C++11 support was found" >&6;} - else - HAVE_CXX11=1 + else + HAVE_CXX11=1 printf "%s\n" "#define HAVE_CXX11 1" >>confdefs.h - fi - - fi + am__api_version='1.16' { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 @@ -6876,7 +7060,7 @@ fi # Define the identity of the package. PACKAGE='c-ares' - VERSION='1.19.0' + VERSION='1.19.1' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -33012,6 +33196,166 @@ printf "%s\n" "no" >&6; } fi + # + tst_links_arc4random_buf="unknown" + tst_proto_arc4random_buf="unknown" + tst_compi_arc4random_buf="unknown" + tst_allow_arc4random_buf="unknown" + # + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf can be linked" >&5 +printf %s "checking if arc4random_buf can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* Define arc4random_buf to an innocuous variant, in case declares arc4random_buf. + For example, HP-UX 11i declares gettimeofday. */ +#define arc4random_buf innocuous_arc4random_buf + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char arc4random_buf (); below. */ + +#include +#undef arc4random_buf + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char arc4random_buf (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_arc4random_buf || defined __stub___arc4random_buf +choke me +#endif + +int +main (void) +{ +return arc4random_buf (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + tst_links_arc4random_buf="yes" + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + tst_links_arc4random_buf="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_arc4random_buf" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf is prototyped" >&5 +printf %s "checking if arc4random_buf is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_stdlib + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "arc4random_buf" >/dev/null 2>&1 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + tst_proto_arc4random_buf="yes" + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + tst_proto_arc4random_buf="no" + +fi +rm -rf conftest* + + fi + # + if test "$tst_proto_arc4random_buf" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf is compilable" >&5 +printf %s "checking if arc4random_buf is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_stdlib + +int +main (void) +{ + + arc4random_buf(NULL, 0); + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + tst_compi_arc4random_buf="yes" + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + tst_compi_arc4random_buf="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + # + if test "$tst_compi_arc4random_buf" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf usage allowed" >&5 +printf %s "checking if arc4random_buf usage allowed... " >&6; } + if test "x$cares_disallow_arc4random_buf" != "xyes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + tst_allow_arc4random_buf="yes" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + tst_allow_arc4random_buf="no" + fi + fi + # + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf might be used" >&5 +printf %s "checking if arc4random_buf might be used... " >&6; } + if test "$tst_links_arc4random_buf" = "yes" && + test "$tst_proto_arc4random_buf" = "yes" && + test "$tst_compi_arc4random_buf" = "yes" && + test "$tst_allow_arc4random_buf" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_ARC4RANDOM_BUF 1" >>confdefs.h + + ac_cv_func_arc4random_buf="yes" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ac_cv_func_arc4random_buf="no" + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PF_INET6" >&5 @@ -33950,37 +34294,7 @@ if test ${with_random+y} then : withval=$with_random; CARES_RANDOM_FILE="$withval" else $as_nop - - if test "$cross_compiling" = "no"; then - as_ac_File=`printf "%s\n" "ac_cv_file_"/dev/urandom"" | $as_tr_sh` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for \"/dev/urandom\"" >&5 -printf %s "checking for \"/dev/urandom\"... " >&6; } -if eval test \${$as_ac_File+y} -then : - printf %s "(cached) " >&6 -else $as_nop - test "$cross_compiling" = yes && - as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 -if test -r ""/dev/urandom""; then - eval "$as_ac_File=yes" -else - eval "$as_ac_File=no" -fi -fi -eval ac_res=\$$as_ac_File - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } -if eval test \"x\$"$as_ac_File"\" = x"yes" -then : CARES_RANDOM_FILE="/dev/urandom" -fi - - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check for /dev/urandom while cross compiling; assuming none" >&5 -printf "%s\n" "$as_me: WARNING: cannot check for /dev/urandom while cross compiling; assuming none" >&2;} - fi - - fi @@ -34864,7 +35178,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by c-ares $as_me 1.19.0, which was +This file was extended by c-ares $as_me 1.19.1, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -34932,7 +35246,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -c-ares config.status 1.19.0 +c-ares config.status 1.19.1 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/deps/cares/configure.ac b/deps/cares/configure.ac index 56a570bce019b9..54e79d6e2a9680 100644 --- a/deps/cares/configure.ac +++ b/deps/cares/configure.ac @@ -1,9 +1,9 @@ AC_PREREQ([2.60]) -AC_INIT([c-ares], [1.19.0], +AC_INIT([c-ares], [1.19.1], [c-ares mailing list: http://lists.haxx.se/listinfo/c-ares]) -CARES_VERSION_INFO="8:0:6" +CARES_VERSION_INFO="8:1:6" dnl This flag accepts an argument of the form current[:revision[:age]]. So, dnl passing -version-info 3:12:1 sets current to 3, revision to 12, and age to dnl 1. @@ -683,6 +683,7 @@ CARES_CHECK_FUNC_STRNCASECMP CARES_CHECK_FUNC_STRNCMPI CARES_CHECK_FUNC_STRNICMP CARES_CHECK_FUNC_WRITEV +CARES_CHECK_FUNC_ARC4RANDOM_BUF dnl check for AF_INET6 @@ -896,17 +897,7 @@ AC_ARG_WITH(random, AS_HELP_STRING([--with-random=FILE], [read randomness from FILE (default=/dev/urandom)]), [ CARES_RANDOM_FILE="$withval" ], - [ - dnl Check for random device. If we're cross compiling, we can't - dnl check, and it's better to assume it doesn't exist than it is - dnl to fail on AC_CHECK_FILE or later. - if test "$cross_compiling" = "no"; then - AC_CHECK_FILE("/dev/urandom", [ CARES_RANDOM_FILE="/dev/urandom"] ) - else - AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none]) - fi - - ] + [ CARES_RANDOM_FILE="/dev/urandom" ] ) if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then AC_SUBST(CARES_RANDOM_FILE) diff --git a/deps/cares/include/ares_version.h b/deps/cares/include/ares_version.h index 4d8d62fd18ed67..35a1ed1a3d3035 100644 --- a/deps/cares/include/ares_version.h +++ b/deps/cares/include/ares_version.h @@ -7,11 +7,11 @@ #define ARES_VERSION_MAJOR 1 #define ARES_VERSION_MINOR 19 -#define ARES_VERSION_PATCH 0 +#define ARES_VERSION_PATCH 1 #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ (ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.19.0" +#define ARES_VERSION_STR "1.19.1" #if (ARES_VERSION >= 0x010700) # define CARES_HAVE_ARES_LIBRARY_INIT 1 diff --git a/deps/cares/src/lib/Makefile.in b/deps/cares/src/lib/Makefile.in index 71449c1c43b8bc..f1ed8a0b0c588e 100644 --- a/deps/cares/src/lib/Makefile.in +++ b/deps/cares/src/lib/Makefile.in @@ -15,7 +15,7 @@ @SET_MAKE@ # aminclude_static.am generated automatically by Autoconf -# from AX_AM_MACROS_STATIC on Sat Jan 28 10:29:54 CET 2023 +# from AX_AM_MACROS_STATIC on Mon May 22 13:34:17 CEST 2023 VPATH = @srcdir@ am__is_gnu_make = { \ @@ -106,6 +106,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \ $(top_srcdir)/m4/ax_am_macros_static.m4 \ $(top_srcdir)/m4/ax_check_gnu_make.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ + $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ @@ -194,13 +195,14 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \ libcares_la-ares_parse_txt_reply.lo \ libcares_la-ares_parse_uri_reply.lo \ libcares_la-ares_platform.lo libcares_la-ares_process.lo \ - libcares_la-ares_query.lo libcares_la-ares_search.lo \ - libcares_la-ares_send.lo libcares_la-ares_strcasecmp.lo \ - libcares_la-ares_strdup.lo libcares_la-ares_strerror.lo \ - libcares_la-ares_strsplit.lo libcares_la-ares_timeout.lo \ - libcares_la-ares_version.lo libcares_la-ares_writev.lo \ - libcares_la-bitncmp.lo libcares_la-inet_net_pton.lo \ - libcares_la-inet_ntop.lo libcares_la-windows_port.lo + libcares_la-ares_query.lo libcares_la-ares_rand.lo \ + libcares_la-ares_search.lo libcares_la-ares_send.lo \ + libcares_la-ares_strcasecmp.lo libcares_la-ares_strdup.lo \ + libcares_la-ares_strerror.lo libcares_la-ares_strsplit.lo \ + libcares_la-ares_timeout.lo libcares_la-ares_version.lo \ + libcares_la-ares_writev.lo libcares_la-bitncmp.lo \ + libcares_la-inet_net_pton.lo libcares_la-inet_ntop.lo \ + libcares_la-windows_port.lo am__objects_2 = am_libcares_la_OBJECTS = $(am__objects_1) $(am__objects_2) libcares_la_OBJECTS = $(am_libcares_la_OBJECTS) @@ -273,6 +275,7 @@ am__depfiles_remade = \ ./$(DEPDIR)/libcares_la-ares_platform.Plo \ ./$(DEPDIR)/libcares_la-ares_process.Plo \ ./$(DEPDIR)/libcares_la-ares_query.Plo \ + ./$(DEPDIR)/libcares_la-ares_rand.Plo \ ./$(DEPDIR)/libcares_la-ares_search.Plo \ ./$(DEPDIR)/libcares_la-ares_send.Plo \ ./$(DEPDIR)/libcares_la-ares_strcasecmp.Plo \ @@ -617,6 +620,7 @@ CSOURCES = ares__addrinfo2hostent.c \ ares_platform.c \ ares_process.c \ ares_query.c \ + ares_rand.c \ ares_search.c \ ares_send.c \ ares_strcasecmp.c \ @@ -793,6 +797,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_platform.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_process.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_query.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_rand.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_search.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_send.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_strcasecmp.Plo@am__quote@ # am--include-marker @@ -1159,6 +1164,13 @@ libcares_la-ares_query.lo: ares_query.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_query.lo `test -f 'ares_query.c' || echo '$(srcdir)/'`ares_query.c +libcares_la-ares_rand.lo: ares_rand.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_rand.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_rand.Tpo -c -o libcares_la-ares_rand.lo `test -f 'ares_rand.c' || echo '$(srcdir)/'`ares_rand.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_rand.Tpo $(DEPDIR)/libcares_la-ares_rand.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_rand.c' object='libcares_la-ares_rand.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_rand.lo `test -f 'ares_rand.c' || echo '$(srcdir)/'`ares_rand.c + libcares_la-ares_search.lo: ares_search.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_search.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_search.Tpo -c -o libcares_la-ares_search.lo `test -f 'ares_search.c' || echo '$(srcdir)/'`ares_search.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_search.Tpo $(DEPDIR)/libcares_la-ares_search.Plo @@ -1503,6 +1515,7 @@ distclean: distclean-recursive -rm -f ./$(DEPDIR)/libcares_la-ares_platform.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_process.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_query.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares_rand.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_search.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_send.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_strcasecmp.Plo @@ -1607,6 +1620,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/libcares_la-ares_platform.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_process.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_query.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares_rand.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_search.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_send.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_strcasecmp.Plo diff --git a/deps/cares/src/lib/ares_data.h b/deps/cares/src/lib/ares_data.h index 54d729d0e7eb62..a682ad54cb939d 100644 --- a/deps/cares/src/lib/ares_data.h +++ b/deps/cares/src/lib/ares_data.h @@ -78,4 +78,4 @@ struct ares_data { void *ares_malloc_data(ares_datatype type); -#endif // __ARES_DATA_H +#endif /* __ARES_DATA_H */ diff --git a/deps/cares/src/lib/ares_destroy.c b/deps/cares/src/lib/ares_destroy.c index 7ec2bde5a45d0d..62c899f82e01dd 100644 --- a/deps/cares/src/lib/ares_destroy.c +++ b/deps/cares/src/lib/ares_destroy.c @@ -95,6 +95,9 @@ void ares_destroy(ares_channel channel) if (channel->hosts_path) ares_free(channel->hosts_path); + if (channel->rand_state) + ares__destroy_rand_state(channel->rand_state); + ares_free(channel); } diff --git a/deps/cares/src/lib/ares_getaddrinfo.c b/deps/cares/src/lib/ares_getaddrinfo.c index bc9f19bf849fdc..cb494242f2807a 100644 --- a/deps/cares/src/lib/ares_getaddrinfo.c +++ b/deps/cares/src/lib/ares_getaddrinfo.c @@ -430,16 +430,20 @@ static int file_lookup(struct host_query *hquery) FILE *fp; int error; int status; - const char *path_hosts = NULL; + char *path_hosts = NULL; if (hquery->hints.ai_flags & ARES_AI_ENVHOSTS) { - path_hosts = getenv("CARES_HOSTS"); + path_hosts = ares_strdup(getenv("CARES_HOSTS")); + if (!path_hosts) + return ARES_ENOMEM; } if (hquery->channel->hosts_path) { - path_hosts = hquery->channel->hosts_path; + path_hosts = ares_strdup(hquery->channel->hosts_path); + if (!path_hosts) + return ARES_ENOMEM; } if (!path_hosts) @@ -473,15 +477,15 @@ static int file_lookup(struct host_query *hquery) return ARES_ENOTFOUND; strcat(PATH_HOSTS, WIN_PATH_HOSTS); - path_hosts = PATH_HOSTS; - #elif defined(WATT32) const char *PATH_HOSTS = _w32_GetHostsFile(); if (!PATH_HOSTS) return ARES_ENOTFOUND; #endif - path_hosts = PATH_HOSTS; + path_hosts = ares_strdup(PATH_HOSTS); + if (!path_hosts) + return ARES_ENOMEM; } fp = fopen(path_hosts, "r"); @@ -507,6 +511,7 @@ static int file_lookup(struct host_query *hquery) status = ares__readaddrinfo(fp, hquery->name, hquery->port, &hquery->hints, hquery->ai); fclose(fp); } + ares_free(path_hosts); /* RFC6761 section 6.3 #3 states that "Name resolution APIs and libraries * SHOULD recognize localhost names as special and SHOULD always return the @@ -665,26 +670,32 @@ void ares_getaddrinfo(ares_channel channel, { if (hints->ai_flags & ARES_AI_NUMERICSERV) { - port = (unsigned short)strtoul(service, NULL, 0); - if (!port) + unsigned long val; + errno = 0; + val = strtoul(service, NULL, 0); + if ((val == 0 && errno != 0) || val > 65535) { ares_free(alias_name); callback(arg, ARES_ESERVICE, 0, NULL); return; } + port = (unsigned short)val; } else { port = lookup_service(service, 0); if (!port) { - port = (unsigned short)strtoul(service, NULL, 0); - if (!port) + unsigned long val; + errno = 0; + val = strtoul(service, NULL, 0); + if ((val == 0 && errno != 0) || val > 65535) { ares_free(alias_name); callback(arg, ARES_ESERVICE, 0, NULL); return; } + port = (unsigned short)val; } } } diff --git a/deps/cares/src/lib/ares_init.c b/deps/cares/src/lib/ares_init.c index 3f9cec6521310e..0519f43e561a65 100644 --- a/deps/cares/src/lib/ares_init.c +++ b/deps/cares/src/lib/ares_init.c @@ -61,17 +61,6 @@ #undef WIN32 /* Redefined in MingW/MSVC headers */ #endif -/* Define RtlGenRandom = SystemFunction036. This is in advapi32.dll. There is - * no need to dynamically load this, other software used widely does not. - * http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx - * https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom - */ -#ifdef _WIN32 -BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength); -# ifndef RtlGenRandom -# define RtlGenRandom(a,b) SystemFunction036(a,b) -# endif -#endif static int init_by_options(ares_channel channel, const struct ares_options *options, @@ -87,7 +76,6 @@ static int config_nameserver(struct server_state **servers, int *nservers, static int set_search(ares_channel channel, const char *str); static int set_options(ares_channel channel, const char *str); static const char *try_option(const char *p, const char *q, const char *opt); -static int init_id_key(rc4_key* key,int key_data_len); static int config_sortlist(struct apattern **sortlist, int *nsort, const char *str); @@ -165,6 +153,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, channel->sock_func_cb_data = NULL; channel->resolvconf_path = NULL; channel->hosts_path = NULL; + channel->rand_state = NULL; channel->last_server = 0; channel->last_timeout_processed = (time_t)now.tv_sec; @@ -218,9 +207,13 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, /* Generate random key */ if (status == ARES_SUCCESS) { - status = init_id_key(&channel->id_key, ARES_ID_KEY_LEN); + channel->rand_state = ares__init_rand_state(); + if (channel->rand_state == NULL) { + status = ARES_ENOMEM; + } + if (status == ARES_SUCCESS) - channel->next_id = ares__generate_new_id(&channel->id_key); + channel->next_id = ares__generate_new_id(channel->rand_state); else DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n", ares_strerror(status))); @@ -242,6 +235,8 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ares_free(channel->resolvconf_path); if(channel->hosts_path) ares_free(channel->hosts_path); + if (channel->rand_state) + ares__destroy_rand_state(channel->rand_state); ares_free(channel); return status; } @@ -746,6 +741,17 @@ static ULONG getBestRouteMetric(IF_LUID * const luid, /* Can't be const :( */ const ULONG interfaceMetric) { /* On this interface, get the best route to that destination. */ +#if defined(__WATCOMC__) + /* OpenWatcom's builtin Windows SDK does not have a definition for + * MIB_IPFORWARD_ROW2, and also does not allow the usage of SOCKADDR_INET + * as a variable. Let's work around this by returning the worst possible + * metric, but only when using the OpenWatcom compiler. + * It may be worth investigating using a different version of the Windows + * SDK with OpenWatcom in the future, though this may be fixed in OpenWatcom + * 2.0. + */ + return (ULONG)-1; +#else MIB_IPFORWARD_ROW2 row; SOCKADDR_INET ignored; if(GetBestRoute2(/* The interface to use. The index is ignored since we are @@ -778,6 +784,7 @@ static ULONG getBestRouteMetric(IF_LUID * const luid, /* Can't be const :( */ * which describes the combination as a "sum". */ return row.Metric + interfaceMetric; +#endif /* __WATCOMC__ */ } /* @@ -2170,72 +2177,6 @@ static int sortlist_alloc(struct apattern **sortlist, int *nsort, } -/* initialize an rc4 key. If possible a cryptographically secure random key - is generated using a suitable function otherwise the code defaults to - cross-platform albeit less secure mechanism using rand -*/ -static void randomize_key(unsigned char* key,int key_data_len) -{ - int randomized = 0; - int counter=0; -#ifdef WIN32 - BOOLEAN res; - - res = RtlGenRandom(key, key_data_len); - if (res) - randomized = 1; - -#else /* !WIN32 */ -# ifdef CARES_RANDOM_FILE - FILE *f = fopen(CARES_RANDOM_FILE, "rb"); - if(f) { - setvbuf(f, NULL, _IONBF, 0); - counter = aresx_uztosi(fread(key, 1, key_data_len, f)); - fclose(f); - } -# endif -#endif /* WIN32 */ - - if (!randomized) { - for (;counterstate[0]; - for(counter = 0; counter < 256; counter++) - /* unnecessary AND but it keeps some compilers happier */ - state[counter] = (unsigned char)(counter & 0xff); - randomize_key(key->state,key_data_len); - key->x = 0; - key->y = 0; - index1 = 0; - index2 = 0; - for(counter = 0; counter < 256; counter++) - { - index2 = (unsigned char)((key_data_ptr[index1] + state[counter] + - index2) % 256); - ARES_SWAP_BYTE(&state[counter], &state[index2]); - - index1 = (unsigned char)((index1 + 1) % key_data_len); - } - ares_free(key_data_ptr); - return ARES_SUCCESS; -} - void ares_set_local_ip4(ares_channel channel, unsigned int local_ip) { channel->local_ip4 = local_ip; diff --git a/deps/cares/src/lib/ares_strsplit.c b/deps/cares/src/lib/ares_strsplit.c index 194375c8308e4d..d3e90c4a8f6515 100644 --- a/deps/cares/src/lib/ares_strsplit.c +++ b/deps/cares/src/lib/ares_strsplit.c @@ -18,7 +18,6 @@ #endif #include "ares_setup.h" -#include "ares_strsplit.h" #include "ares.h" #include "ares_private.h" @@ -55,7 +54,7 @@ char **ares__strsplit(const char *in, const char *delms, size_t *num_elm) { count++; p += i; } - } while(*p++ != 0); + } while (*p++ != 0); if (count == 0) return NULL; @@ -69,13 +68,8 @@ char **ares__strsplit(const char *in, const char *delms, size_t *num_elm) { i = strcspn(p, delms); if (i != 0) { for (k = 0; k < j; k++) { -#ifdef WIN32 - if (strnicmp(table[k], p, i) == 0 && table[k][i] == 0) - break; -#else if (strncasecmp(table[k], p, i) == 0 && table[k][i] == 0) break; -#endif } if (k == j) { /* copy unique strings only */