From 67527c427efd608b3062f758bfc17d811ef5ad91 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Thu, 11 Dec 2025 00:01:22 +0000 Subject: [PATCH] deps: update c-ares to v1.34.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/60997 Reviewed-By: Richard Lau Reviewed-By: Marco Ippolito Reviewed-By: Luigi Pinca Reviewed-By: Juan José Arboleda Reviewed-By: Rafael Gonzaga Reviewed-By: Colin Ihrig Reviewed-By: Ethan Arrowood --- deps/cares/CMakeLists.txt | 16 +- deps/cares/Makefile.in | 4 +- deps/cares/RELEASE-NOTES.md | 42 +- deps/cares/aclocal.m4 | 1 - deps/cares/aminclude_static.am | 2 +- deps/cares/configure | 1892 ++++++++++++++++- deps/cares/configure.ac | 24 +- deps/cares/docs/Makefile.in | 4 +- deps/cares/include/Makefile.in | 4 +- deps/cares/include/ares_version.h | 6 +- deps/cares/m4/ax_cxx_compile_stdcxx_14.m4 | 34 - deps/cares/m4/ax_pthread.m4 | 2 +- deps/cares/src/Makefile.in | 4 +- deps/cares/src/lib/CMakeLists.txt | 8 + deps/cares/src/lib/Makefile.in | 6 +- deps/cares/src/lib/ares_config.h.in | 3 + deps/cares/src/lib/ares_getaddrinfo.c | 29 +- deps/cares/src/lib/ares_hosts_file.c | 5 + deps/cares/src/lib/ares_init.c | 41 +- deps/cares/src/lib/ares_private.h | 32 +- deps/cares/src/lib/ares_process.c | 130 +- deps/cares/src/lib/ares_qcache.c | 20 +- .../cares/src/lib/ares_set_socket_functions.c | 4 +- deps/cares/src/lib/ares_sysconfig_win.c | 67 +- deps/cares/src/lib/cares.rc | 2 +- .../src/lib/event/ares_event_configchg.c | 1 + deps/cares/src/lib/event/ares_event_thread.c | 8 + deps/cares/src/lib/util/ares_math.h | 22 +- deps/cares/src/lib/util/ares_rand.c | 8 +- deps/cares/src/lib/util/ares_uri.c | 2 +- deps/cares/src/tools/Makefile.in | 4 +- 31 files changed, 2203 insertions(+), 224 deletions(-) delete mode 100644 deps/cares/m4/ax_cxx_compile_stdcxx_14.m4 diff --git a/deps/cares/CMakeLists.txt b/deps/cares/CMakeLists.txt index 49f98cac268..a2a9c19329e 100644 --- a/deps/cares/CMakeLists.txt +++ b/deps/cares/CMakeLists.txt @@ -12,7 +12,7 @@ INCLUDE (CheckCSourceCompiles) INCLUDE (CheckStructHasMember) INCLUDE (CheckLibraryExists) -PROJECT (c-ares LANGUAGES C VERSION "1.34.5" ) +PROJECT (c-ares LANGUAGES C VERSION "1.34.6" ) # Set this version before release SET (CARES_VERSION "${PROJECT_VERSION}") @@ -30,7 +30,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 "21:4:19") +SET (CARES_LIB_VERSIONINFO "21:5:19") OPTION (CARES_STATIC "Build as a static library" OFF) @@ -45,15 +45,6 @@ OPTION (CARES_THREADS "Build with thread-safety support" OPTION (CARES_COVERAGE "Build for code coverage" OFF) SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom") - -# Tests require a C++14 compiler -IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS) - set(CMAKE_CXX_STANDARD 14) - set(CMAKE_CXX_STANDARD_REQUIRED TRUE) - set(CMAKE_CXX_EXTENSIONS FALSE) - enable_language(CXX) -ENDIF () - # Tests require static to be enabled on Windows to be able to access otherwise hidden symbols IF ((CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS) AND (NOT CARES_STATIC) AND WIN32) SET (CARES_STATIC ON) @@ -269,7 +260,7 @@ ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "SunOS") LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=600) ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX") LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=700 -D_USE_IRS) -ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") +ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD") # Don't define _XOPEN_SOURCE on FreeBSD, it actually reduces visibility instead of increasing it ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "QNX") LIST (APPEND SYSFLAGS -D_QNX_SOURCE) @@ -630,6 +621,7 @@ IF (HAVE_GETADDRINFO) CMAKE_SYSTEM_NAME STREQUAL "NetBSD" OR CMAKE_SYSTEM_NAME STREQUAL "SunOS" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR + CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD" OR CMAKE_SYSTEM_NAME STREQUAL "AIX" OR WIN32) SET (HAVE_GETADDRINFO_THREADSAFE 1) diff --git a/deps/cares/Makefile.in b/deps/cares/Makefile.in index bf8645bf260..ba5253f890c 100644 --- a/deps/cares/Makefile.in +++ b/deps/cares/Makefile.in @@ -133,7 +133,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ @@ -334,10 +333,13 @@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ GMOCK112_LIBS = @GMOCK112_LIBS@ +GMOCK117_CFLAGS = @GMOCK117_CFLAGS@ +GMOCK117_LIBS = @GMOCK117_LIBS@ GMOCK_CFLAGS = @GMOCK_CFLAGS@ GMOCK_LIBS = @GMOCK_LIBS@ GREP = @GREP@ HAVE_CXX14 = @HAVE_CXX14@ +HAVE_CXX17 = @HAVE_CXX17@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/deps/cares/RELEASE-NOTES.md b/deps/cares/RELEASE-NOTES.md index 1a8d8d22333..ded75001b54 100644 --- a/deps/cares/RELEASE-NOTES.md +++ b/deps/cares/RELEASE-NOTES.md @@ -1,28 +1,42 @@ -## c-ares version 1.34.5 - April 8 2025 +## c-ares version 1.34.6 - December 8 2025 This is a security release. Security: -* CVE-2025-31498. A use-after-free bug has been uncovered in read_answers() that - was introduced in v1.32.3. Please see https://github.com/c-ares/c-ares/security/advisories/GHSA-6hxc-62jh-p29v +* CVE-2025-62408. A use-after-free bug has been uncovered in read_answers() that + was introduced in v1.32.3. Please see https://github.com/c-ares/c-ares/security/advisories/GHSA-jq53-42q6-pqr5 Changes: -* Restore Windows XP support. [PR #958](https://github.com/c-ares/c-ares/pull/958) +* Ignore Windows IDN Search Domains until proper IDN support is added. [PR #1034](https://github.com/c-ares/c-ares/pull/1034) Bugfixes: -* A missing mutex initialization would make busy polling for configuration - changes (platforms other than Windows, Linux, MacOS) eat too much CPU - [PR #974](https://github.com/c-ares/c-ares/pull/974) -* Pkgconfig may be generated wrong for static builds in relation to `-pthread` - [PR #965](https://github.com/c-ares/c-ares/pull/965) -* Localhost resolution can fail if only one address family is in `/etc/hosts` - [PR #947](https://github.com/c-ares/c-ares/pull/947) +* Event Thread could stall when not notified of new queries on existing + connections that are in a bad state + [PR #1032](https://github.com/c-ares/c-ares/pull/1032) +* fix conversion of invalid service to port number in ares_getaddrinfo() + [PR #1029](https://github.com/c-ares/c-ares/pull/1029) +* fix memory leak in ares_uri + [PR #1012](https://github.com/c-ares/c-ares/pull/1012) +* Ignore ares_event_configchg_init failures + [PR #1009](https://github.com/c-ares/c-ares/pull/1009) +* Use XOR for random seed generation on fallback logic. + [PR #994](https://github.com/c-ares/c-ares/pull/994) +* Fix clang build on windows. + [PR #996](https://github.com/c-ares/c-ares/pull/996) +* Fix IPv6 link-local nameservers in /etc/resolv.conf + [PR #996](https://github.com/c-ares/c-ares/pull/997) +* Fix a few build issues on MidnightBSD. + [PR #983](https://github.com/c-ares/c-ares/pull/983) Thanks go to these friendly people for their efforts and contributions for this release: * Brad House (@bradh352) -* Erik Lax (@eriklax) -* Florian Pfisterer (@FlorianPfisterer) -* Kai Pastor (@dg0yt) +* (@F3lixTheCat) +* Lucas Holt (@laffer1) +* @oargon +* Pavel P (@pps83) +* Sean Harmer (@seanharmer) +* Uwe (@nixblik) + diff --git a/deps/cares/aclocal.m4 b/deps/cares/aclocal.m4 index 04f8786c9c0..a732fb0e2e1 100644 --- a/deps/cares/aclocal.m4 +++ b/deps/cares/aclocal.m4 @@ -1236,7 +1236,6 @@ m4_include([m4/ax_check_link_flag.m4]) m4_include([m4/ax_code_coverage.m4]) m4_include([m4/ax_compiler_vendor.m4]) m4_include([m4/ax_cxx_compile_stdcxx.m4]) -m4_include([m4/ax_cxx_compile_stdcxx_14.m4]) m4_include([m4/ax_file_escapes.m4]) m4_include([m4/ax_pthread.m4]) m4_include([m4/ax_require_defined.m4]) diff --git a/deps/cares/aminclude_static.am b/deps/cares/aminclude_static.am index 57c265006f0..07239563e6a 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 Tue Apr 8 12:12:30 UTC 2025 +# from AX_AM_MACROS_STATIC on Mon Dec 8 16:21:41 UTC 2025 # Code coverage diff --git a/deps/cares/configure b/deps/cares/configure index 7a29494d6fa..f91e2c95686 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.34.5. +# Generated by GNU Autoconf 2.71 for c-ares 1.34.6. # # Report bugs to . # @@ -621,8 +621,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='c-ares' PACKAGE_TARNAME='c-ares' -PACKAGE_VERSION='1.34.5' -PACKAGE_STRING='c-ares 1.34.5' +PACKAGE_VERSION='1.34.6' +PACKAGE_STRING='c-ares 1.34.6' PACKAGE_BUGREPORT='c-ares mailing list: http://lists.haxx.se/listinfo/c-ares' PACKAGE_URL='' @@ -669,6 +669,8 @@ AM_CPPFLAGS AM_CFLAGS BUILD_TESTS_FALSE BUILD_TESTS_TRUE +GMOCK117_LIBS +GMOCK117_CFLAGS GMOCK112_LIBS GMOCK112_CFLAGS GMOCK_LIBS @@ -779,6 +781,7 @@ am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +HAVE_CXX17 HAVE_CXX14 ac_ct_CXX CXXFLAGS @@ -876,7 +879,9 @@ PKG_CONFIG_LIBDIR GMOCK_CFLAGS GMOCK_LIBS GMOCK112_CFLAGS -GMOCK112_LIBS' +GMOCK112_LIBS +GMOCK117_CFLAGS +GMOCK117_LIBS' # Initialize some variables set by options. @@ -1425,7 +1430,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.34.5 to adapt to many kinds of systems. +\`configure' configures c-ares 1.34.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1496,7 +1501,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of c-ares 1.34.5:";; + short | recursive ) echo "Configuration of c-ares 1.34.6:";; esac cat <<\_ACEOF @@ -1570,6 +1575,10 @@ Some influential environment variables: C compiler flags for GMOCK112, overriding pkg-config GMOCK112_LIBS linker flags for GMOCK112, overriding pkg-config + GMOCK117_CFLAGS + C compiler flags for GMOCK117, overriding pkg-config + GMOCK117_LIBS + linker flags for GMOCK117, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1638,7 +1647,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -c-ares configure 1.34.5 +c-ares configure 1.34.6 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2262,7 +2271,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.34.5, which was +It was created by c-ares $as_me 1.34.6, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3236,7 +3245,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -CARES_VERSION_INFO="21:4:19" +CARES_VERSION_INFO="21:5:19" @@ -5355,6 +5364,887 @@ printf "%s\n" "#define HAVE_CXX14 1" >>confdefs.h fi + ax_cxx_compile_alternatives="17 1z" ax_cxx_compile_cxx17_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 + + + + + + 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}" MSVC; do + if test x"$switch" = xMSVC; then + switch=-std:c++${alternative} + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx17_${switch}_MSVC" | $as_tr_sh` + else + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx17_$switch" | $as_tr_sh` + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++17 features with $switch" >&5 +printf %s "checking whether $CXX supports C++17 features with $switch... " >&6; } +if eval test \${$cachevar+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// 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/ +// +// The value __cplusplus ought to have is available in _MSVC_LANG since +// Visual Studio 2015 Update 3: +// +// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros +// +// This was also the first MSVC version to support C++14 so we can't use the +// value of either __cplusplus or _MSVC_LANG to quickly rule out MSVC having +// C++11 or C++14 support, but we can check _MSVC_LANG for C++17 and later. +#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"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual ~Base() {} + virtual void f() {} + }; + + struct Derived : public Base + { + virtual ~Derived() override {} + virtual void f() override {} + }; + + } + + 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; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + 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); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + 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}; + }; + + 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; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + 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, ""); + + } + + // 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 + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L && !defined _MSC_VER + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + + + + +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 201703L + +#error "This is not a C++17 compiler" + +#else + +#include +#include +#include + +namespace cxx17 +{ + + namespace test_constexpr_lambdas + { + + constexpr int foo = [](){return 42;}(); + + } + + namespace test::nested_namespace::definitions + { + + } + + namespace test_fold_expression + { + + template + int multiply(Args... args) + { + return (args * ... * 1); + } + + template + bool all(Args... args) + { + return (args && ...); + } + + } + + namespace test_extended_static_assert + { + + static_assert (true); + + } + + namespace test_auto_brace_init_list + { + + auto foo = {5}; + auto bar {5}; + + static_assert(std::is_same, decltype(foo)>::value); + static_assert(std::is_same::value); + } + + namespace test_typename_in_template_template_parameter + { + + template typename X> struct D; + + } + + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + + int f1() + { + return 42; + } + + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } + + } + + namespace test_extended_aggregate_initialization + { + + struct base1 + { + int b1, b2 = 42; + }; + + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + + struct derived : base1, base2 + { + int d; + }; + + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases + + } + + namespace test_general_range_based_for_loop + { + + struct iter + { + int i; + + int& operator* () + { + return i; + } + + const int& operator* () const + { + return i; + } + + iter& operator++() + { + ++i; + return *this; + } + }; + + struct sentinel + { + int i; + }; + + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + + struct range + { + iter begin() const + { + return {0}; + } + + sentinel end() const + { + return {5}; + } + }; + + void f() + { + range r {}; + + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + + } + + namespace test_lambda_capture_asterisk_this_by_value + { + + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + + } + + namespace test_enum_class_construction + { + + enum class byte : unsigned char + {}; + + byte foo {42}; + + } + + namespace test_constexpr_if + { + + template + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + + } + + namespace test_selection_statement_with_initializer + { + + int f() + { + return 13; + } + + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } + + switch (auto i = f(); i + 4) + { + case 17: + return 2; + + default: + return 1; + } + } + + } + + namespace test_template_argument_deduction_for_class_templates + { + + template + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} + + T1 m1; + T2 m2; + }; + + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } + + } + + namespace test_non_type_auto_template_parameters + { + + template + struct B + {}; + + B<5> b1; + B<'a'> b2; + + } + + namespace test_structured_bindings + { + + int arr[2] = { 1, 2 }; + std::pair pr = { 1, 2 }; + + auto f1() -> int(&)[2] + { + return arr; + } + + auto f2() -> std::pair& + { + return pr; + } + + struct S + { + int x1 : 2; + volatile double y1; + }; + + S f3() + { + return {}; + } + + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); + + } + + namespace test_exception_spec_type_system + { + + struct Good {}; + struct Bad {}; + + void g1() noexcept; + void g2(); + + template + Bad + f(T*, T*); + + template + Good + f(T1*, T2*); + + static_assert (std::is_same_v); + + } + + namespace test_inline_variables + { + + template void f(T) + {} + + template inline T g(T) + { + return T{}; + } + + template<> inline void f<>(int) + {} + + template<> int g<>(int) + { + return 5; + } + + } + +} // namespace cxx17 + +#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 201703L + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + eval $cachevar=yes +else $as_nop + eval $cachevar=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + 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 + 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 + fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test x$ax_cxx_compile_cxx17_required = xtrue; then + if test x$ac_success = xno; then + as_fn_error $? "*** A compiler with support for C++17 language features is required." "$LINENO" 5 + fi + fi + if test x$ac_success = xno; then + HAVE_CXX17=0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++17 support was found" >&5 +printf "%s\n" "$as_me: No compiler with C++17 support was found" >&6;} + else + HAVE_CXX17=1 + +printf "%s\n" "#define HAVE_CXX17 1" >>confdefs.h + + fi + + am__api_version='1.16' @@ -5928,7 +6818,7 @@ fi # Define the identity of the package. PACKAGE='c-ares' - VERSION='1.34.5' + VERSION='1.34.6' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -23369,7 +24259,7 @@ ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread -- case $host_os in - freebsd*) + freebsd*|midnightbsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) @@ -24066,15 +24956,6 @@ BUILD_SUBDIRS="include src docs" -if test "x$build_tests" != "xno" -a "x$HAVE_CXX14" = "0" ; then - if test "x$build_tests" = "xmaybe" ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot build tests without a CXX14 compiler" >&5 -printf "%s\n" "$as_me: WARNING: cannot build tests without a CXX14 compiler" >&2;} - build_tests=no - else - as_fn_error $? "*** Building tests requires a CXX14 compiler" "$LINENO" 5 - fi -fi if test "x$build_tests" != "xno" -a "x$cross_compiling" = "xyes" ; then if test "x$build_tests" = "xmaybe" ; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot build tests when cross compiling" >&5 @@ -24555,12 +25436,961 @@ printf "%s\n" "#define HAVE_UTS_NAMESPACE 1" >>confdefs.h fi fi - fi -fi -if test "x$build_tests" != "xno" ; then - build_tests=yes - ax_cxx_compile_alternatives="14 1y" ax_cxx_compile_cxx14_required=true +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for gmock >= 1.17.0" >&5 +printf %s "checking for gmock >= 1.17.0... " >&6; } + +if test -n "$GMOCK117_CFLAGS"; then + pkg_cv_GMOCK117_CFLAGS="$GMOCK117_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gmock >= 1.17.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gmock >= 1.17.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GMOCK117_CFLAGS=`$PKG_CONFIG --cflags "gmock >= 1.17.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GMOCK117_LIBS"; then + pkg_cv_GMOCK117_LIBS="$GMOCK117_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gmock >= 1.17.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gmock >= 1.17.0") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GMOCK117_LIBS=`$PKG_CONFIG --libs "gmock >= 1.17.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GMOCK117_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "gmock >= 1.17.0" 2>&1` + else + GMOCK117_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "gmock >= 1.17.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GMOCK117_PKG_ERRORS" >&5 + + have_gmock_v117=no +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + have_gmock_v117=no +else + GMOCK117_CFLAGS=$pkg_cv_GMOCK117_CFLAGS + GMOCK117_LIBS=$pkg_cv_GMOCK117_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + have_gmock_v117=yes +fi + if test "x$have_gmock_v117" = "xyes" ; then + ax_cxx_compile_alternatives="17 1z" ax_cxx_compile_cxx17_required=true + 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 + + + + + + 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}" MSVC; do + if test x"$switch" = xMSVC; then + switch=-std:c++${alternative} + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx17_${switch}_MSVC" | $as_tr_sh` + else + cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx17_$switch" | $as_tr_sh` + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++17 features with $switch" >&5 +printf %s "checking whether $CXX supports C++17 features with $switch... " >&6; } +if eval test \${$cachevar+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CXX="$CXX" + CXX="$CXX $switch" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +// 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/ +// +// The value __cplusplus ought to have is available in _MSVC_LANG since +// Visual Studio 2015 Update 3: +// +// https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros +// +// This was also the first MSVC version to support C++14 so we can't use the +// value of either __cplusplus or _MSVC_LANG to quickly rule out MSVC having +// C++11 or C++14 support, but we can check _MSVC_LANG for C++17 and later. +#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"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual ~Base() {} + virtual void f() {} + }; + + struct Derived : public Base + { + virtual ~Derived() override {} + virtual void f() override {} + }; + + } + + 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; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + 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); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + 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}; + }; + + 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; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + 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, ""); + + } + + // 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 + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + + + + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L && !defined _MSC_VER + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_separators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + + + + +// If the compiler admits that it is not ready for C++17, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 201703L + +#error "This is not a C++17 compiler" + +#else + +#include +#include +#include + +namespace cxx17 +{ + + namespace test_constexpr_lambdas + { + + constexpr int foo = [](){return 42;}(); + + } + + namespace test::nested_namespace::definitions + { + + } + + namespace test_fold_expression + { + + template + int multiply(Args... args) + { + return (args * ... * 1); + } + + template + bool all(Args... args) + { + return (args && ...); + } + + } + + namespace test_extended_static_assert + { + + static_assert (true); + + } + + namespace test_auto_brace_init_list + { + + auto foo = {5}; + auto bar {5}; + + static_assert(std::is_same, decltype(foo)>::value); + static_assert(std::is_same::value); + } + + namespace test_typename_in_template_template_parameter + { + + template typename X> struct D; + + } + + namespace test_fallthrough_nodiscard_maybe_unused_attributes + { + + int f1() + { + return 42; + } + + [[nodiscard]] int f2() + { + [[maybe_unused]] auto unused = f1(); + + switch (f1()) + { + case 17: + f1(); + [[fallthrough]]; + case 42: + f1(); + } + return f1(); + } + + } + + namespace test_extended_aggregate_initialization + { + + struct base1 + { + int b1, b2 = 42; + }; + + struct base2 + { + base2() { + b3 = 42; + } + int b3; + }; + + struct derived : base1, base2 + { + int d; + }; + + derived d1 {{1, 2}, {}, 4}; // full initialization + derived d2 {{}, {}, 4}; // value-initialized bases + + } + + namespace test_general_range_based_for_loop + { + + struct iter + { + int i; + + int& operator* () + { + return i; + } + + const int& operator* () const + { + return i; + } + + iter& operator++() + { + ++i; + return *this; + } + }; + + struct sentinel + { + int i; + }; + + bool operator== (const iter& i, const sentinel& s) + { + return i.i == s.i; + } + + bool operator!= (const iter& i, const sentinel& s) + { + return !(i == s); + } + + struct range + { + iter begin() const + { + return {0}; + } + + sentinel end() const + { + return {5}; + } + }; + + void f() + { + range r {}; + + for (auto i : r) + { + [[maybe_unused]] auto v = i; + } + } + + } + + namespace test_lambda_capture_asterisk_this_by_value + { + + struct t + { + int i; + int foo() + { + return [*this]() + { + return i; + }(); + } + }; + + } + + namespace test_enum_class_construction + { + + enum class byte : unsigned char + {}; + + byte foo {42}; + + } + + namespace test_constexpr_if + { + + template + int f () + { + if constexpr(cond) + { + return 13; + } + else + { + return 42; + } + } + + } + + namespace test_selection_statement_with_initializer + { + + int f() + { + return 13; + } + + int f2() + { + if (auto i = f(); i > 0) + { + return 3; + } + + switch (auto i = f(); i + 4) + { + case 17: + return 2; + + default: + return 1; + } + } + + } + + namespace test_template_argument_deduction_for_class_templates + { + + template + struct pair + { + pair (T1 p1, T2 p2) + : m1 {p1}, + m2 {p2} + {} + + T1 m1; + T2 m2; + }; + + void f() + { + [[maybe_unused]] auto p = pair{13, 42u}; + } + + } + + namespace test_non_type_auto_template_parameters + { + + template + struct B + {}; + + B<5> b1; + B<'a'> b2; + + } + + namespace test_structured_bindings + { + + int arr[2] = { 1, 2 }; + std::pair pr = { 1, 2 }; + + auto f1() -> int(&)[2] + { + return arr; + } + + auto f2() -> std::pair& + { + return pr; + } + + struct S + { + int x1 : 2; + volatile double y1; + }; + + S f3() + { + return {}; + } + + auto [ x1, y1 ] = f1(); + auto& [ xr1, yr1 ] = f1(); + auto [ x2, y2 ] = f2(); + auto& [ xr2, yr2 ] = f2(); + const auto [ x3, y3 ] = f3(); + + } + + namespace test_exception_spec_type_system + { + + struct Good {}; + struct Bad {}; + + void g1() noexcept; + void g2(); + + template + Bad + f(T*, T*); + + template + Good + f(T1*, T2*); + + static_assert (std::is_same_v); + + } + + namespace test_inline_variables + { + + template void f(T) + {} + + template inline T g(T) + { + return T{}; + } + + template<> inline void f<>(int) + {} + + template<> int g<>(int) + { + return 5; + } + + } + +} // namespace cxx17 + +#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 201703L + + + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + eval $cachevar=yes +else $as_nop + eval $cachevar=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + 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 + 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 + fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + if test x$ax_cxx_compile_cxx17_required = xtrue; then + if test x$ac_success = xno; then + as_fn_error $? "*** A compiler with support for C++17 language features is required." "$LINENO" 5 + fi + fi + if test x$ac_success = xno; then + HAVE_CXX17=0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++17 support was found" >&5 +printf "%s\n" "$as_me: No compiler with C++17 support was found" >&6;} + else + HAVE_CXX17=1 + +printf "%s\n" "#define HAVE_CXX17 1" >>confdefs.h + + fi + + + else + ax_cxx_compile_alternatives="14 1y" ax_cxx_compile_cxx14_required=true ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -25063,6 +26893,12 @@ printf "%s\n" "#define HAVE_CXX14 1" >>confdefs.h fi + fi + fi +fi +if test "x$build_tests" != "xno" ; then + build_tests=yes + if test "$ac_cv_native_windows" != "yes" ; then @@ -25167,7 +27003,7 @@ ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread -- case $host_os in - freebsd*) + freebsd*|midnightbsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) @@ -26402,7 +28238,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.34.5, which was +This file was extended by c-ares $as_me 1.34.6, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -26470,7 +28306,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.34.5 +c-ares config.status 1.34.6 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 72c06e7773e..744a99be56a 100644 --- a/deps/cares/configure.ac +++ b/deps/cares/configure.ac @@ -2,10 +2,10 @@ dnl Copyright (C) The c-ares project and its contributors dnl SPDX-License-Identifier: MIT AC_PREREQ([2.69]) -AC_INIT([c-ares], [1.34.5], +AC_INIT([c-ares], [1.34.6], [c-ares mailing list: http://lists.haxx.se/listinfo/c-ares]) -CARES_VERSION_INFO="21:4:19" +CARES_VERSION_INFO="21:5:19" 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. @@ -40,7 +40,8 @@ AC_CONFIG_HEADERS([src/lib/ares_config.h include/ares_build.h]) AC_CONFIG_AUX_DIR(config) AC_CONFIG_MACRO_DIR([m4]) AC_USE_SYSTEM_EXTENSIONS -AX_CXX_COMPILE_STDCXX_14([noext],[optional]) +AX_CXX_COMPILE_STDCXX(14,[noext],[optional]) +AX_CXX_COMPILE_STDCXX(17,[noext],[optional]) AM_INIT_AUTOMAKE([foreign subdir-objects 1.9.6]) LT_INIT([win32-dll,pic,disable-fast-install,aix-soname=svr4]) AC_LANG([C]) @@ -806,14 +807,6 @@ BUILD_SUBDIRS="include src docs" dnl ******** TESTS ******* -if test "x$build_tests" != "xno" -a "x$HAVE_CXX14" = "0" ; then - if test "x$build_tests" = "xmaybe" ; then - AC_MSG_WARN([cannot build tests without a CXX14 compiler]) - build_tests=no - else - AC_MSG_ERROR([*** Building tests requires a CXX14 compiler]) - fi -fi if test "x$build_tests" != "xno" -a "x$cross_compiling" = "xyes" ; then if test "x$build_tests" = "xmaybe" ; then AC_MSG_WARN([cannot build tests when cross compiling]) @@ -844,12 +837,19 @@ if test "x$build_tests" != "xno" ; then ARES_CHECK_USER_NAMESPACE ARES_CHECK_UTS_NAMESPACE fi + PKG_CHECK_MODULES([GMOCK117], [gmock >= 1.17.0], [ have_gmock_v117=yes ], [ have_gmock_v117=no ]) + if test "x$have_gmock_v117" = "xyes" ; then + dnl GMock v1.17.0 requires C++17 or higher + AX_CXX_COMPILE_STDCXX(17,[noext],[mandatory]) + else + dnl older version needed v1.14.0 + AX_CXX_COMPILE_STDCXX(14,[noext],[mandatory]) + fi fi fi if test "x$build_tests" != "xno" ; then build_tests=yes - AX_CXX_COMPILE_STDCXX_14([noext],[mandatory]) if test "$ac_cv_native_windows" != "yes" ; then AX_PTHREAD([ CARES_TEST_PTHREADS="yes" ], [ AC_MSG_ERROR([threading required for tests]) ]) fi diff --git a/deps/cares/docs/Makefile.in b/deps/cares/docs/Makefile.in index f3e2b35746d..501364eb8d9 100644 --- a/deps/cares/docs/Makefile.in +++ b/deps/cares/docs/Makefile.in @@ -107,7 +107,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ @@ -228,10 +227,13 @@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ GMOCK112_LIBS = @GMOCK112_LIBS@ +GMOCK117_CFLAGS = @GMOCK117_CFLAGS@ +GMOCK117_LIBS = @GMOCK117_LIBS@ GMOCK_CFLAGS = @GMOCK_CFLAGS@ GMOCK_LIBS = @GMOCK_LIBS@ GREP = @GREP@ HAVE_CXX14 = @HAVE_CXX14@ +HAVE_CXX17 = @HAVE_CXX17@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/deps/cares/include/Makefile.in b/deps/cares/include/Makefile.in index 8c6782a15ec..3588b27a927 100644 --- a/deps/cares/include/Makefile.in +++ b/deps/cares/include/Makefile.in @@ -105,7 +105,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ @@ -239,10 +238,13 @@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ GMOCK112_LIBS = @GMOCK112_LIBS@ +GMOCK117_CFLAGS = @GMOCK117_CFLAGS@ +GMOCK117_LIBS = @GMOCK117_LIBS@ GMOCK_CFLAGS = @GMOCK_CFLAGS@ GMOCK_LIBS = @GMOCK_LIBS@ GREP = @GREP@ HAVE_CXX14 = @HAVE_CXX14@ +HAVE_CXX17 = @HAVE_CXX17@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/deps/cares/include/ares_version.h b/deps/cares/include/ares_version.h index 7da82f2a15b..006029c12df 100644 --- a/deps/cares/include/ares_version.h +++ b/deps/cares/include/ares_version.h @@ -28,12 +28,12 @@ #define ARES__VERSION_H /* This is the global package copyright */ -#define ARES_COPYRIGHT "2004 - 2024 Daniel Stenberg, ." +#define ARES_COPYRIGHT "2004 - 2025 Daniel Stenberg, ." #define ARES_VERSION_MAJOR 1 #define ARES_VERSION_MINOR 34 -#define ARES_VERSION_PATCH 5 -#define ARES_VERSION_STR "1.34.5" +#define ARES_VERSION_PATCH 6 +#define ARES_VERSION_STR "1.34.6" /* NOTE: We cannot make the version string a C preprocessor stringify operation * due to assumptions made by integrators that aren't properly using diff --git a/deps/cares/m4/ax_cxx_compile_stdcxx_14.m4 b/deps/cares/m4/ax_cxx_compile_stdcxx_14.m4 deleted file mode 100644 index 094db0d025c..00000000000 --- a/deps/cares/m4/ax_cxx_compile_stdcxx_14.m4 +++ /dev/null @@ -1,34 +0,0 @@ -# ============================================================================= -# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html -# ============================================================================= -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the C++14 -# standard; if necessary, add switches to CXX and CXXCPP to enable -# support. -# -# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX -# macro with the version set to C++14. The two optional arguments are -# forwarded literally as the second and third argument respectively. -# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for -# more information. If you want to use this macro, you also need to -# download the ax_cxx_compile_stdcxx.m4 file. -# -# LICENSE -# -# Copyright (c) 2015 Moritz Klammler -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 5 - -AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) -AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])]) diff --git a/deps/cares/m4/ax_pthread.m4 b/deps/cares/m4/ax_pthread.m4 index 9f35d139149..f882317660b 100644 --- a/deps/cares/m4/ax_pthread.m4 +++ b/deps/cares/m4/ax_pthread.m4 @@ -160,7 +160,7 @@ ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread -- case $host_os in - freebsd*) + freebsd*|midnightbsd*) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) diff --git a/deps/cares/src/Makefile.in b/deps/cares/src/Makefile.in index 575d391a3fe..ff4275b6baf 100644 --- a/deps/cares/src/Makefile.in +++ b/deps/cares/src/Makefile.in @@ -104,7 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ @@ -250,10 +249,13 @@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ GMOCK112_LIBS = @GMOCK112_LIBS@ +GMOCK117_CFLAGS = @GMOCK117_CFLAGS@ +GMOCK117_LIBS = @GMOCK117_LIBS@ GMOCK_CFLAGS = @GMOCK_CFLAGS@ GMOCK_LIBS = @GMOCK_LIBS@ GREP = @GREP@ HAVE_CXX14 = @HAVE_CXX14@ +HAVE_CXX17 = @HAVE_CXX17@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/deps/cares/src/lib/CMakeLists.txt b/deps/cares/src/lib/CMakeLists.txt index 9d4e10924d0..bdb2690fb67 100644 --- a/deps/cares/src/lib/CMakeLists.txt +++ b/deps/cares/src/lib/CMakeLists.txt @@ -15,6 +15,14 @@ IF (CARES_SHARED) # Include resource file in windows builds for versioned DLLs IF (WIN32) TARGET_SOURCES (${PROJECT_NAME} PRIVATE cares.rc) + + # Check for use of llvm-rc (implies clang is being used). We need to set the + # compile flags to use the correct codepage for the resource compiler. + # This is needed for the copyright symbol to be encoded correctly. + # The default codepage is 1252 (Windows Latin-1) but llvm-rc defaults to UTF-8. + if (CMAKE_RC_COMPILER MATCHES "llvm-rc") + set_source_files_properties(cares.rc PROPERTIES COMPILE_FLAGS "/C 1252") + endif() ENDIF() # Convert CARES_LIB_VERSIONINFO libtool version format into VERSION and SOVERSION diff --git a/deps/cares/src/lib/Makefile.in b/deps/cares/src/lib/Makefile.in index 942dae01ccf..e92732eaf72 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 Tue Apr 8 12:12:30 UTC 2025 +# from AX_AM_MACROS_STATIC on Mon Dec 8 16:21:41 UTC 2025 # Copyright (C) The c-ares project and its contributors # SPDX-License-Identifier: MIT @@ -115,7 +115,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ @@ -495,10 +494,13 @@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ GMOCK112_LIBS = @GMOCK112_LIBS@ +GMOCK117_CFLAGS = @GMOCK117_CFLAGS@ +GMOCK117_LIBS = @GMOCK117_LIBS@ GMOCK_CFLAGS = @GMOCK_CFLAGS@ GMOCK_LIBS = @GMOCK_LIBS@ GREP = @GREP@ HAVE_CXX14 = @HAVE_CXX14@ +HAVE_CXX17 = @HAVE_CXX17@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/deps/cares/src/lib/ares_config.h.in b/deps/cares/src/lib/ares_config.h.in index 0ed9e32be76..c56e426ea59 100644 --- a/deps/cares/src/lib/ares_config.h.in +++ b/deps/cares/src/lib/ares_config.h.in @@ -87,6 +87,9 @@ /* define if the compiler supports basic C++14 syntax */ #undef HAVE_CXX14 +/* define if the compiler supports basic C++17 syntax */ +#undef HAVE_CXX17 + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H diff --git a/deps/cares/src/lib/ares_getaddrinfo.c b/deps/cares/src/lib/ares_getaddrinfo.c index eabd17fcbac..6009de36a3d 100644 --- a/deps/cares/src/lib/ares_getaddrinfo.c +++ b/deps/cares/src/lib/ares_getaddrinfo.c @@ -575,6 +575,23 @@ static void host_callback(void *arg, ares_status_t status, size_t timeouts, /* at this point we keep on waiting for the next query to finish */ } +static ares_bool_t numeric_service_to_port(const char *service, + unsigned short *port) +{ + char *end; + unsigned long val; + + errno = 0; + val = strtoul(service, &end, 10); + + if (errno == 0 && *end == '\0' && val <= 65535) { + *port = (unsigned short)val; + return ARES_TRUE; + } + + return ARES_FALSE; +} + static void ares_getaddrinfo_int(ares_channel_t *channel, const char *name, const char *service, const struct ares_addrinfo_hints *hints, @@ -606,25 +623,17 @@ static void ares_getaddrinfo_int(ares_channel_t *channel, const char *name, if (service) { if (hints->ai_flags & ARES_AI_NUMERICSERV) { - unsigned long val; - errno = 0; - val = strtoul(service, NULL, 0); - if ((val == 0 && errno != 0) || val > 65535) { + if (!numeric_service_to_port(service, &port)) { callback(arg, ARES_ESERVICE, 0, NULL); return; } - port = (unsigned short)val; } else { port = lookup_service(service, 0); if (!port) { - unsigned long val; - errno = 0; - val = strtoul(service, NULL, 0); - if ((val == 0 && errno != 0) || val > 65535) { + if (!numeric_service_to_port(service, &port)) { callback(arg, ARES_ESERVICE, 0, NULL); return; } - port = (unsigned short)val; } } } diff --git a/deps/cares/src/lib/ares_hosts_file.c b/deps/cares/src/lib/ares_hosts_file.c index d18863b8f66..c0fb80766a7 100644 --- a/deps/cares/src/lib/ares_hosts_file.c +++ b/deps/cares/src/lib/ares_hosts_file.c @@ -41,6 +41,11 @@ #endif #include +#ifdef USE_WINSOCK +# define DATABASEPATH "DatabasePath" +# define WIN_PATH_HOSTS "\\hosts" +#endif + /* HOSTS FILE PROCESSING OVERVIEW * ============================== * The hosts file on the system contains static entries to be processed locally diff --git a/deps/cares/src/lib/ares_init.c b/deps/cares/src/lib/ares_init.c index ae78262a112..dc094c4df6e 100644 --- a/deps/cares/src/lib/ares_init.c +++ b/deps/cares/src/lib/ares_init.c @@ -271,6 +271,8 @@ int ares_init_options(ares_channel_t **channelptr, goto done; } + ares_set_socket_functions_def(channel); + /* Initialize Server List */ channel->servers = ares_slist_create(channel->rand_state, server_sort_cb, server_destroy_cb); @@ -346,8 +348,6 @@ int ares_init_options(ares_channel_t **channelptr, goto done; } - ares_set_socket_functions_def(channel); - /* Initialize the event thread */ if (channel->optmask & ARES_OPT_EVENT_THREAD) { ares_event_thread_t *e = NULL; @@ -362,7 +362,8 @@ int ares_init_options(ares_channel_t **channelptr, e = channel->sock_state_cb_data; status = ares_event_configchg_init(&e->configchg, e); if (status != ARES_SUCCESS && status != ARES_ENOTIMP) { - goto done; /* LCOV_EXCL_LINE: UntestablePath */ + DEBUGF(fprintf(stderr, "Error: ares_event_configchg_init failed: %s\n", + ares_strerror(status))); } status = ARES_SUCCESS; } @@ -484,16 +485,20 @@ int ares_dup(ares_channel_t **dest, const ares_channel_t *src) ares_channel_lock(src); /* Now clone the options that ares_save_options() doesn't support, but are * user-provided */ - (*dest)->sock_create_cb = src->sock_create_cb; - (*dest)->sock_create_cb_data = src->sock_create_cb_data; - (*dest)->sock_config_cb = src->sock_config_cb; - (*dest)->sock_config_cb_data = src->sock_config_cb_data; + (*dest)->sock_create_cb = src->sock_create_cb; + (*dest)->sock_create_cb_data = src->sock_create_cb_data; + (*dest)->sock_config_cb = src->sock_config_cb; + (*dest)->sock_config_cb_data = src->sock_config_cb_data; memcpy(&(*dest)->sock_funcs, &(src->sock_funcs), sizeof((*dest)->sock_funcs)); - (*dest)->sock_func_cb_data = src->sock_func_cb_data; - (*dest)->legacy_sock_funcs = src->legacy_sock_funcs; - (*dest)->legacy_sock_funcs_cb_data = src->legacy_sock_funcs_cb_data; - (*dest)->server_state_cb = src->server_state_cb; - (*dest)->server_state_cb_data = src->server_state_cb_data; + (*dest)->sock_func_cb_data = src->sock_func_cb_data; + (*dest)->legacy_sock_funcs = src->legacy_sock_funcs; + (*dest)->legacy_sock_funcs_cb_data = src->legacy_sock_funcs_cb_data; + (*dest)->server_state_cb = src->server_state_cb; + (*dest)->server_state_cb_data = src->server_state_cb_data; + (*dest)->notify_pending_write_cb = src->notify_pending_write_cb; + (*dest)->notify_pending_write_cb_data = src->notify_pending_write_cb_data; + (*dest)->query_enqueue_cb = src->query_enqueue_cb; + (*dest)->query_enqueue_cb_data = src->query_enqueue_cb_data; ares_strcpy((*dest)->local_dev_name, src->local_dev_name, sizeof((*dest)->local_dev_name)); @@ -598,3 +603,15 @@ int ares_set_sortlist(ares_channel_t *channel, const char *sortstr) ares_channel_unlock(channel); return (int)status; } + +void ares_set_query_enqueue_cb(ares_channel_t *channel, + ares_query_enqueue_cb callback, + void *user_data) +{ + if (channel == NULL) { + return; + } + + channel->query_enqueue_cb = callback; + channel->query_enqueue_cb_data = user_data; +} diff --git a/deps/cares/src/lib/ares_private.h b/deps/cares/src/lib/ares_private.h index 3d7cea3d3a0..d6bd426d39c 100644 --- a/deps/cares/src/lib/ares_private.h +++ b/deps/cares/src/lib/ares_private.h @@ -83,21 +83,7 @@ #define CARES_INADDR_CAST(type, var) ((type)((const void *)var)) #if defined(USE_WINSOCK) - -# define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" # define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" -# define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" -# define WIN_NT_DNSCLIENT \ - "Software\\Policies\\Microsoft\\Windows NT\\DNSClient" -# define NAMESERVER "NameServer" -# define DHCPNAMESERVER "DhcpNameServer" -# define DATABASEPATH "DatabasePath" -# define WIN_PATH_HOSTS "\\hosts" -# define SEARCHLIST_KEY "SearchList" -# define PRIMARYDNSSUFFIX_KEY "PrimaryDNSSuffix" -# define INTERFACES_KEY "Interfaces" -# define DOMAIN_KEY "Domain" -# define DHCPDOMAIN_KEY "DhcpDomain" # define PATH_RESOLV_CONF "" #elif defined(WATT32) @@ -145,6 +131,8 @@ W32_FUNC const char *_w32_GetHostsFile(void); #define DEFAULT_SERVER_RETRY_CHANCE 10 #define DEFAULT_SERVER_RETRY_DELAY 5000 +typedef void (*ares_query_enqueue_cb)(void *data); + struct ares_query; typedef struct ares_query ares_query_t; @@ -269,6 +257,9 @@ struct ares_channeldata { void *notify_pending_write_cb_data; ares_bool_t notify_pending_write; + ares_query_enqueue_cb query_enqueue_cb; + void *query_enqueue_cb_data; + /* Path for resolv.conf file, configurable via ares_options */ char *resolvconf_path; @@ -321,7 +312,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server /* Optional */, ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t *now, ares_status_t status, ares_bool_t inc_try_count, - const ares_dns_record_t *dnsrec, + ares_dns_record_t *dnsrec, ares_array_t **requeue); /*! Count the number of labels (dots+1) in a domain */ @@ -367,6 +358,9 @@ ares_status_t ares_init_servers_state(ares_channel_t *channel); ares_status_t ares_init_by_options(ares_channel_t *channel, const struct ares_options *options, int optmask); +void ares_set_query_enqueue_cb(ares_channel_t *channel, + ares_query_enqueue_cb callback, + void *user_data); ares_status_t ares_init_by_sysconfig(ares_channel_t *channel); void ares_set_socket_functions_def(ares_channel_t *channel); @@ -594,10 +588,10 @@ ares_status_t ares_qcache_create(ares_rand_state *rand_state, unsigned int max_ttl, ares_qcache_t **cache_out); void ares_qcache_flush(ares_qcache_t *cache); -ares_status_t ares_qcache_insert(ares_channel_t *channel, - const ares_timeval_t *now, - const ares_query_t *query, - ares_dns_record_t *dnsrec); +ares_status_t ares_qcache_insert(ares_channel_t *channel, + const ares_timeval_t *now, + const ares_query_t *query, + const ares_dns_record_t *dnsrec); ares_status_t ares_qcache_fetch(ares_channel_t *channel, const ares_timeval_t *now, const ares_dns_record_t *dnsrec, diff --git a/deps/cares/src/lib/ares_process.c b/deps/cares/src/lib/ares_process.c index c5834fa100e..9352968419e 100644 --- a/deps/cares/src/lib/ares_process.c +++ b/deps/cares/src/lib/ares_process.c @@ -64,7 +64,8 @@ static ares_bool_t same_questions(const ares_query_t *query, const ares_dns_record_t *arec); static void end_query(ares_channel_t *channel, ares_server_t *server, ares_query_t *query, ares_status_t status, - const ares_dns_record_t *dnsrec); + ares_dns_record_t *dnsrec, + ares_array_t **requeue); static void ares_query_remove_from_conn(ares_query_t *query) { @@ -230,11 +231,14 @@ static ares_status_t ares_process_fds_nolock(ares_channel_t *channel, } if (!(flags & ARES_PROCESS_FLAG_SKIP_NON_FD)) { - ares_check_cleanup_conns(channel); status = process_timeouts(channel, &now); if (status == ARES_ENOMEM) { goto done; } + + /* Cleanup should be done after processing timeouts as it may invalidate + * connections */ + ares_check_cleanup_conns(channel); } done: @@ -511,16 +515,27 @@ static ares_status_t read_conn_packets(ares_conn_t *conn) return ARES_SUCCESS; } +typedef enum { + REQUEUE_REQUEUE = 1, + REQUEUE_ENDQUERY = 2 +} requeue_type_t; + /* Simple data structure to store a query that needs to be requeued with * optional server */ typedef struct { - unsigned short qid; - ares_server_t *server; /* optional */ + requeue_type_t type; /* type of entry, requeue or endquery */ + unsigned short qid; /* query id */ + ares_server_t *server; /* requeue only: optional */ + ares_status_t status; /* endquery only */ + ares_dns_record_t *dnsrec; /* endquery only: optional */ } ares_requeue_t; -static ares_status_t ares_append_requeue(ares_array_t **requeue, - ares_query_t *query, - ares_server_t *server) +static ares_status_t ares_append_requeue_int(ares_array_t **requeue, + requeue_type_t type, + ares_query_t *query, + ares_server_t *server, + ares_status_t status, + ares_dns_record_t *dnsrec) { ares_requeue_t entry; @@ -533,16 +548,36 @@ static ares_status_t ares_append_requeue(ares_array_t **requeue, ares_query_remove_from_conn(query); + entry.type = type; entry.qid = query->qid; entry.server = server; + entry.status = status; + entry.dnsrec = dnsrec; return ares_array_insertdata_last(*requeue, &entry); } +static ares_status_t ares_append_requeue(ares_array_t **requeue, + ares_query_t *query, + ares_server_t *server) +{ + return ares_append_requeue_int(requeue, REQUEUE_REQUEUE, query, server, 0, + NULL); +} + +static ares_status_t ares_append_endqueue(ares_array_t **requeue, + ares_query_t *query, + ares_status_t status, + ares_dns_record_t *dnsrec) +{ + return ares_append_requeue_int(requeue, REQUEUE_ENDQUERY, query, NULL, status, + dnsrec); +} + static ares_status_t read_answers(ares_conn_t *conn, const ares_timeval_t *now) { ares_status_t status; - ares_channel_t *channel = conn->server->channel; - ares_array_t *requeue = NULL; + ares_channel_t *channel = conn->server->channel; + ares_array_t *requeue = NULL; /* Process all queued answers */ while (1) { @@ -602,18 +637,30 @@ cleanup: break; } - /* Query disappeared */ query = ares_htable_szvp_get_direct(channel->queries_by_qid, entry.qid); - if (query == NULL) { - continue; - } - internal_status = ares_send_query(entry.server, query, now); - /* We only care about ARES_ENOMEM */ - if (internal_status == ARES_ENOMEM) { - status = ARES_ENOMEM; + if (entry.type == REQUEUE_REQUEUE) { + /* query disappeared */ + if (query == NULL) { + continue; + } + internal_status = ares_send_query(entry.server, query, now); + /* We only care about ARES_ENOMEM */ + if (internal_status == ARES_ENOMEM) { + status = ARES_ENOMEM; + } + } else { /* REQUEUE_ENDQUERY */ + if (query != NULL) { + query->callback(query->arg, entry.status, query->timeouts, entry.dnsrec); + ares_free_query(query); + } + ares_dns_record_destroy(entry.dnsrec); } } + /* Don't forget to send notification if queue emptied */ + if (requeue != NULL) { + ares_queue_notify_empty(channel); + } ares_array_destroy(requeue); return status; @@ -669,7 +716,7 @@ static ares_status_t process_timeouts(ares_channel_t *channel, conn = query->conn; server_increment_failures(conn->server, query->using_tcp); status = ares_requeue_query(query, now, ARES_ETIMEOUT, ARES_TRUE, NULL, - NULL); + NULL); if (status == ARES_ENOMEM) { goto done; } @@ -824,7 +871,7 @@ static ares_status_t process_answer(ares_channel_t *channel, if (issue_might_be_edns(query->query, rdnsrec)) { status = rewrite_without_edns(query); if (status != ARES_SUCCESS) { - end_query(channel, server, query, status, NULL); + end_query(channel, server, query, status, NULL, NULL); goto cleanup; } @@ -869,7 +916,9 @@ static ares_status_t process_answer(ares_channel_t *channel, } server_increment_failures(server, query->using_tcp); - status = ares_requeue_query(query, now, status, ARES_TRUE, rdnsrec, requeue); + status = ares_requeue_query(query, now, status, ARES_TRUE, rdnsrec, + requeue); + rdnsrec = NULL; /* Free'd by ares_requeue_query() */ if (status != ARES_ENOMEM) { /* Should any of these cause a connection termination? @@ -882,12 +931,11 @@ static ares_status_t process_answer(ares_channel_t *channel, /* If cache insertion was successful, it took ownership. We ignore * other cache insertion failures. */ - if (ares_qcache_insert(channel, now, query, rdnsrec) == ARES_SUCCESS) { - is_cached = ARES_TRUE; - } + ares_qcache_insert(channel, now, query, rdnsrec); server_set_good(server, query->using_tcp); - end_query(channel, server, query, ARES_SUCCESS, rdnsrec); + end_query(channel, server, query, ARES_SUCCESS, rdnsrec, requeue); + rdnsrec = NULL; /* Free'd by the requeue */ status = ARES_SUCCESS; @@ -922,7 +970,7 @@ static void handle_conn_error(ares_conn_t *conn, ares_bool_t critical_failure, ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t *now, ares_status_t status, ares_bool_t inc_try_count, - const ares_dns_record_t *dnsrec, + ares_dns_record_t *dnsrec, ares_array_t **requeue) { ares_channel_t *channel = query->channel; @@ -939,6 +987,7 @@ ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t *now, } if (query->try_count < max_tries && !query->no_retries) { + ares_dns_record_destroy(dnsrec); if (requeue != NULL) { return ares_append_requeue(requeue, query, NULL); } @@ -950,7 +999,7 @@ ares_status_t ares_requeue_query(ares_query_t *query, const ares_timeval_t *now, query->error_status = ARES_ETIMEOUT; } - end_query(channel, NULL, query, query->error_status, dnsrec); + end_query(channel, NULL, query, query->error_status, dnsrec, requeue); return ARES_ETIMEOUT; } @@ -1156,6 +1205,12 @@ static ares_conn_t *ares_fetch_connection(const ares_channel_t *channel, return NULL; } + /* If the associated server has failures, don't use it. It should be cleaned + * up later. */ + if (conn->server->consec_failures > 0) { + return NULL; + } + /* Used too many times */ if (channel->udp_max_queries > 0 && conn->total_queries >= channel->udp_max_queries) { @@ -1217,7 +1272,6 @@ ares_status_t ares_send_query(ares_server_t *requested_server, ares_status_t status; ares_bool_t probe_downed_server = ARES_TRUE; - /* Choose the server to send the query to */ if (requested_server != NULL) { server = requested_server; @@ -1232,7 +1286,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server, } if (server == NULL) { - end_query(channel, server, query, ARES_ENOSERVER /* ? */, NULL); + end_query(channel, server, query, ARES_ENOSERVER /* ? */, NULL, NULL); return ARES_ENOSERVER; } @@ -1260,7 +1314,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server, /* Anything else is not retryable, likely ENOMEM */ default: - end_query(channel, server, query, status, NULL); + end_query(channel, server, query, status, NULL, NULL); return status; } } @@ -1274,7 +1328,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server, case ARES_ENOMEM: /* Not retryable */ - end_query(channel, server, query, status, NULL); + end_query(channel, server, query, status, NULL, NULL); return status; /* These conditions are retryable as they are server-specific @@ -1306,7 +1360,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server, ares_slist_insert(channel->queries_by_timeout, query); if (!query->node_queries_by_timeout) { /* LCOV_EXCL_START: OutOfMemory */ - end_query(channel, server, query, ARES_ENOMEM, NULL); + end_query(channel, server, query, ARES_ENOMEM, NULL, NULL); return ARES_ENOMEM; /* LCOV_EXCL_STOP */ } @@ -1319,7 +1373,7 @@ ares_status_t ares_send_query(ares_server_t *requested_server, if (query->node_queries_to_conn == NULL) { /* LCOV_EXCL_START: OutOfMemory */ - end_query(channel, server, query, ARES_ENOMEM, NULL); + end_query(channel, server, query, ARES_ENOMEM, NULL, NULL); return ARES_ENOMEM; /* LCOV_EXCL_STOP */ } @@ -1333,6 +1387,10 @@ ares_status_t ares_send_query(ares_server_t *requested_server, ares_probe_failed_server(channel, server, query); } + if (channel->query_enqueue_cb) { + channel->query_enqueue_cb(channel->query_enqueue_cb_data); + } + return ARES_SUCCESS; } @@ -1407,7 +1465,7 @@ static void ares_detach_query(ares_query_t *query) static void end_query(ares_channel_t *channel, ares_server_t *server, ares_query_t *query, ares_status_t status, - const ares_dns_record_t *dnsrec) + ares_dns_record_t *dnsrec, ares_array_t **requeue) { /* If we were probing for the server to come back online, lets mark it as * no longer being probed */ @@ -1417,6 +1475,12 @@ static void end_query(ares_channel_t *channel, ares_server_t *server, ares_metrics_record(query, server, status, dnsrec); + /* Delay calling the query callback */ + if (requeue != NULL) { + ares_append_endqueue(requeue, query, status, dnsrec); + return; + } + /* Invoke the callback. */ query->callback(query->arg, status, query->timeouts, dnsrec); ares_free_query(query); diff --git a/deps/cares/src/lib/ares_qcache.c b/deps/cares/src/lib/ares_qcache.c index 97c0a9137da..4050ff54bf1 100644 --- a/deps/cares/src/lib/ares_qcache.c +++ b/deps/cares/src/lib/ares_qcache.c @@ -421,10 +421,20 @@ done: return status; } -ares_status_t ares_qcache_insert(ares_channel_t *channel, - const ares_timeval_t *now, - const ares_query_t *query, - ares_dns_record_t *dnsrec) +ares_status_t ares_qcache_insert(ares_channel_t *channel, + const ares_timeval_t *now, + const ares_query_t *query, + const ares_dns_record_t *dnsrec) { - return ares_qcache_insert_int(channel->qcache, dnsrec, query->query, now); + ares_dns_record_t *dupdns = ares_dns_record_duplicate(dnsrec); + ares_status_t status; + + if (dupdns == NULL) { + return ARES_ENOMEM; + } + status = ares_qcache_insert_int(channel->qcache, dupdns, query->query, now); + if (status != ARES_SUCCESS) { + ares_dns_record_destroy(dupdns); + } + return status; } diff --git a/deps/cares/src/lib/ares_set_socket_functions.c b/deps/cares/src/lib/ares_set_socket_functions.c index 7216ffa933f..9994e81df51 100644 --- a/deps/cares/src/lib/ares_set_socket_functions.c +++ b/deps/cares/src/lib/ares_set_socket_functions.c @@ -61,7 +61,7 @@ # define TFO_USE_SENDTO 0 # define TFO_USE_CONNECTX 0 # define TFO_CLIENT_SOCKOPT TCP_FASTOPEN_CONNECT -#elif defined(__FreeBSD__) && defined(TCP_FASTOPEN) +#elif (defined(__MidnightBSD__) || defined(__FreeBSD__)) && defined(TCP_FASTOPEN) # define TFO_SUPPORTED 1 # define TFO_SKIP_CONNECT 1 # define TFO_USE_SENDTO 1 @@ -127,6 +127,8 @@ ares_status_t channel->sock_funcs.asendto = funcs->asendto; channel->sock_funcs.agetsockname = funcs->agetsockname; channel->sock_funcs.abind = funcs->abind; + channel->sock_funcs.aif_nametoindex = funcs->aif_nametoindex; + channel->sock_funcs.aif_indextoname = funcs->aif_indextoname; } /* Implement newer versions here ...*/ diff --git a/deps/cares/src/lib/ares_sysconfig_win.c b/deps/cares/src/lib/ares_sysconfig_win.c index 01109a89ba4..35f4bd8e72a 100644 --- a/deps/cares/src/lib/ares_sysconfig_win.c +++ b/deps/cares/src/lib/ares_sysconfig_win.c @@ -55,6 +55,19 @@ #include "ares_inet_net_pton.h" #if defined(USE_WINSOCK) + +# define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" +# define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" +# define WIN_NT_DNSCLIENT \ + "Software\\Policies\\Microsoft\\Windows NT\\DNSClient" +# define NAMESERVER "NameServer" +# define DHCPNAMESERVER "DhcpNameServer" +# define SEARCHLIST_KEY L"SearchList" +# define PRIMARYDNSSUFFIX_KEY L"PrimaryDNSSuffix" +# define INTERFACES_KEY "Interfaces" +# define DOMAIN_KEY L"Domain" +# define DHCPDOMAIN_KEY L"DhcpDomain" + /* * get_REG_SZ() * @@ -69,38 +82,48 @@ * * Supported on Windows NT 3.5 and newer. */ -static ares_bool_t get_REG_SZ(HKEY hKey, const char *leafKeyName, char **outptr) +static ares_bool_t get_REG_SZ(HKEY hKey, const WCHAR *leafKeyName, char **outptr) { - DWORD size = 0; - int res; + DWORD size = 0; + int res; + int len; + WCHAR *val = NULL; *outptr = NULL; /* Find out size of string stored in registry */ - res = RegQueryValueExA(hKey, leafKeyName, 0, NULL, NULL, &size); + res = RegQueryValueExW(hKey, leafKeyName, 0, NULL, NULL, &size); if ((res != ERROR_SUCCESS && res != ERROR_MORE_DATA) || !size) { return ARES_FALSE; } /* Allocate buffer of indicated size plus one given that string might have been stored without null termination */ - *outptr = ares_malloc(size + 1); - if (!*outptr) { + val = ares_malloc_zero(size + sizeof(WCHAR)); + if (val == NULL) { return ARES_FALSE; } /* Get the value for real */ - res = RegQueryValueExA(hKey, leafKeyName, 0, NULL, (unsigned char *)*outptr, - &size); - if ((res != ERROR_SUCCESS) || (size == 1)) { + res = RegQueryValueExW(hKey, leafKeyName, 0, NULL, (BYTE *)val, &size); + if (res != ERROR_SUCCESS || size == 1) { + ares_free(val); + return ARES_FALSE; + } + + /* Convert to UTF8 */ + len = WideCharToMultiByte(CP_UTF8, 0, val, -1, NULL, 0, NULL, NULL); + if (len == 0) { + return ARES_FALSE; + } + *outptr = ares_malloc_zero((size_t)len + 1); + if (WideCharToMultiByte(CP_UTF8, 0, val, -1, *outptr, len, NULL, NULL) + == 0) { ares_free(*outptr); *outptr = NULL; return ARES_FALSE; } - /* Null terminate buffer always */ - *(*outptr + size) = '\0'; - return ARES_TRUE; } @@ -135,6 +158,14 @@ static void commajoin(char **dst, const char *src) commanjoin(dst, src, ares_strlen(src)); } +static void commajoin_asciionly(char **dst, const char *src) +{ + if (!ares_str_isprint(src, ares_strlen(src))) { + return; + } + commanjoin(dst, src, ares_strlen(src)); +} + /* A structure to hold the string form of IPv4 and IPv6 addresses so we can * sort them by a metric. */ @@ -523,7 +554,7 @@ static ares_bool_t get_SuffixList_Windows(char **outptr) ERROR_SUCCESS) { get_REG_SZ(hKey, SEARCHLIST_KEY, outptr); if (get_REG_SZ(hKey, DOMAIN_KEY, &p)) { - commajoin(outptr, p); + commajoin_asciionly(outptr, p); ares_free(p); p = NULL; } @@ -533,7 +564,7 @@ static ares_bool_t get_SuffixList_Windows(char **outptr) if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NT_DNSCLIENT, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { if (get_REG_SZ(hKey, SEARCHLIST_KEY, &p)) { - commajoin(outptr, p); + commajoin_asciionly(outptr, p); ares_free(p); p = NULL; } @@ -545,7 +576,7 @@ static ares_bool_t get_SuffixList_Windows(char **outptr) if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_DNSCLIENT, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { if (get_REG_SZ(hKey, PRIMARYDNSSUFFIX_KEY, &p)) { - commajoin(outptr, p); + commajoin_asciionly(outptr, p); ares_free(p); p = NULL; } @@ -567,17 +598,17 @@ static ares_bool_t get_SuffixList_Windows(char **outptr) } /* p can be comma separated (SearchList) */ if (get_REG_SZ(hKeyEnum, SEARCHLIST_KEY, &p)) { - commajoin(outptr, p); + commajoin_asciionly(outptr, p); ares_free(p); p = NULL; } if (get_REG_SZ(hKeyEnum, DOMAIN_KEY, &p)) { - commajoin(outptr, p); + commajoin_asciionly(outptr, p); ares_free(p); p = NULL; } if (get_REG_SZ(hKeyEnum, DHCPDOMAIN_KEY, &p)) { - commajoin(outptr, p); + commajoin_asciionly(outptr, p); ares_free(p); p = NULL; } diff --git a/deps/cares/src/lib/cares.rc b/deps/cares/src/lib/cares.rc index 9275b0796bf..49fa71ceec3 100644 --- a/deps/cares/src/lib/cares.rc +++ b/deps/cares/src/lib/cares.rc @@ -63,7 +63,7 @@ BEGIN #endif VALUE "ProductName", "The c-ares library\0" VALUE "ProductVersion", ARES_VERSION_STR "\0" - VALUE "LegalCopyright", "© " ARES_COPYRIGHT "\0" + VALUE "LegalCopyright", "Copyright (c) " ARES_COPYRIGHT "\0" VALUE "License", "https://c-ares.org/license.html\0" END END diff --git a/deps/cares/src/lib/event/ares_event_configchg.c b/deps/cares/src/lib/event/ares_event_configchg.c index 2a8c780c2cc..add729574e4 100644 --- a/deps/cares/src/lib/event/ares_event_configchg.c +++ b/deps/cares/src/lib/event/ares_event_configchg.c @@ -383,6 +383,7 @@ done: # include # include +# include # include # include # include diff --git a/deps/cares/src/lib/event/ares_event_thread.c b/deps/cares/src/lib/event/ares_event_thread.c index c77514e02c1..35e86377c29 100644 --- a/deps/cares/src/lib/event/ares_event_thread.c +++ b/deps/cares/src/lib/event/ares_event_thread.c @@ -235,6 +235,12 @@ static void notifywrite_cb(void *data) ares_event_thread_wake(e); } +static void notifyenqueue_cb(void *data) +{ + ares_event_thread_t *e = data; + ares_event_thread_wake(e); +} + static void ares_event_process_updates(ares_event_thread_t *e) { ares_llist_node_t *node; @@ -415,6 +421,7 @@ void ares_event_thread_destroy(ares_channel_t *channel) channel->sock_state_cb = NULL; channel->notify_pending_write_cb = NULL; channel->notify_pending_write_cb_data = NULL; + ares_set_query_enqueue_cb(channel, NULL, NULL); } static const ares_event_sys_t *ares_event_fetch_sys(ares_evsys_t evsys) @@ -521,6 +528,7 @@ ares_status_t ares_event_thread_init(ares_channel_t *channel) channel->sock_state_cb_data = e; channel->notify_pending_write_cb = notifywrite_cb; channel->notify_pending_write_cb_data = e; + ares_set_query_enqueue_cb(channel, notifyenqueue_cb, e); if (!e->ev_sys->init(e)) { /* LCOV_EXCL_START: UntestablePath */ diff --git a/deps/cares/src/lib/util/ares_math.h b/deps/cares/src/lib/util/ares_math.h index 52fa1facf01..3b60b00bdbb 100644 --- a/deps/cares/src/lib/util/ares_math.h +++ b/deps/cares/src/lib/util/ares_math.h @@ -26,13 +26,21 @@ #ifndef __ARES_MATH_H #define __ARES_MATH_H -#ifdef _MSC_VER -typedef __int64 ares_int64_t; -typedef unsigned __int64 ares_uint64_t; -#else -typedef long long ares_int64_t; -typedef unsigned long long ares_uint64_t; -#endif +#include "ares_setup.h" + +#ifdef HAVE_STDINT_H +# include + typedef int64_t ares_int64_t; + typedef uint64_t ares_uint64_t; +#else /* HAVE_STDINT_H */ +# ifdef _MSC_VER + typedef __int64 ares_int64_t; + typedef unsigned __int64 ares_uint64_t; +# else + typedef long long ares_int64_t; + typedef unsigned long long ares_uint64_t; +# endif /* _MSC_VER */ +#endif /* HAVE_STDINT_H */ ares_bool_t ares_is_64bit(void); size_t ares_round_up_pow2(size_t n); diff --git a/deps/cares/src/lib/util/ares_rand.c b/deps/cares/src/lib/util/ares_rand.c index 408999951a7..367dfa21ab1 100644 --- a/deps/cares/src/lib/util/ares_rand.c +++ b/deps/cares/src/lib/util/ares_rand.c @@ -56,7 +56,7 @@ static unsigned int ares_u32_from_ptr(void *addr) { /* LCOV_EXCL_START: FallbackCode */ if (ares_is_64bit()) { - return (unsigned int)((((ares_uint64_t)addr >> 32) & 0xFFFFFFFF) | + return (unsigned int)((((ares_uint64_t)addr >> 32) & 0xFFFFFFFF) ^ ((ares_uint64_t)addr & 0xFFFFFFFF)); } return (unsigned int)((size_t)addr & 0xFFFFFFFF); @@ -94,12 +94,12 @@ static void ares_rc4_generate_key(ares_rand_rc4 *rc4_state, unsigned char *key, len += sizeof(data); ares_tvnow(&tv); - data = (unsigned int)((tv.sec | tv.usec) & 0xFFFFFFFF); + data = (unsigned int)((tv.sec ^ tv.usec) & 0xFFFFFFFF); memcpy(key + len, &data, sizeof(data)); len += sizeof(data); - srand(ares_u32_from_ptr(rc4_state) | ares_u32_from_ptr(&i) | - (unsigned int)((tv.sec | tv.usec) & 0xFFFFFFFF)); + srand(ares_u32_from_ptr(rc4_state) ^ ares_u32_from_ptr(&i) ^ + (unsigned int)((tv.sec ^ tv.usec) & 0xFFFFFFFF)); #endif for (i = len; i < key_len; i++) { diff --git a/deps/cares/src/lib/util/ares_uri.c b/deps/cares/src/lib/util/ares_uri.c index d656f8347f5..04bad0074a7 100644 --- a/deps/cares/src/lib/util/ares_uri.c +++ b/deps/cares/src/lib/util/ares_uri.c @@ -533,7 +533,7 @@ static char *ares_uri_path_normalize(const char *path) status = ares_buf_split_str_array(inpath, (const unsigned char *)"/", 1, ARES_BUF_SPLIT_TRIM, 0, &arr); if (status != ARES_SUCCESS) { - return NULL; + goto done; } for (i = 0; i < (ares_ssize_t)ares_array_len(arr); i++) { diff --git a/deps/cares/src/tools/Makefile.in b/deps/cares/src/tools/Makefile.in index 932d1a98375..b3f8333f090 100644 --- a/deps/cares/src/tools/Makefile.in +++ b/deps/cares/src/tools/Makefile.in @@ -106,7 +106,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \ $(top_srcdir)/m4/ax_code_coverage.m4 \ $(top_srcdir)/m4/ax_compiler_vendor.m4 \ $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \ - $(top_srcdir)/m4/ax_cxx_compile_stdcxx_14.m4 \ $(top_srcdir)/m4/ax_file_escapes.m4 \ $(top_srcdir)/m4/ax_pthread.m4 \ $(top_srcdir)/m4/ax_require_defined.m4 \ @@ -269,10 +268,13 @@ GCOV = @GCOV@ GENHTML = @GENHTML@ GMOCK112_CFLAGS = @GMOCK112_CFLAGS@ GMOCK112_LIBS = @GMOCK112_LIBS@ +GMOCK117_CFLAGS = @GMOCK117_CFLAGS@ +GMOCK117_LIBS = @GMOCK117_LIBS@ GMOCK_CFLAGS = @GMOCK_CFLAGS@ GMOCK_LIBS = @GMOCK_LIBS@ GREP = @GREP@ HAVE_CXX14 = @HAVE_CXX14@ +HAVE_CXX17 = @HAVE_CXX17@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@