deps: update c-ares to v1.34.6

PR-URL: https://github.com/nodejs/node/pull/60997
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
This commit is contained in:
Node.js GitHub Bot 2025-12-11 00:01:22 +00:00 committed by GitHub
parent e50cbc1abd
commit 67527c427e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 2203 additions and 224 deletions

View File

@ -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)

View File

@ -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@

View File

@ -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)

View File

@ -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])

View File

@ -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

1892
deps/cares/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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@

View File

@ -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@

View File

@ -28,12 +28,12 @@
#define ARES__VERSION_H
/* This is the global package copyright */
#define ARES_COPYRIGHT "2004 - 2024 Daniel Stenberg, <daniel@haxx.se>."
#define ARES_COPYRIGHT "2004 - 2025 Daniel Stenberg, <daniel@haxx.se>."
#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

View File

@ -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 <moritz@klammler.eu>
#
# 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])])

View File

@ -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)

View File

@ -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@

View File

@ -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

View File

@ -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@

View File

@ -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 <dlfcn.h> header file. */
#undef HAVE_DLFCN_H

View File

@ -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;
}
}
}

View File

@ -41,6 +41,11 @@
#endif
#include <time.h>
#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

View File

@ -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;
}

View File

@ -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,

View File

@ -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);

View File

@ -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;
}

View File

@ -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 ...*/

View File

@ -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;
}

View File

@ -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

View File

@ -383,6 +383,7 @@ done:
# include <sys/types.h>
# include <unistd.h>
# include <stdbool.h>
# include <notify.h>
# include <dlfcn.h>
# include <fcntl.h>

View File

@ -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 */

View File

@ -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 <stdint.h>
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);

View File

@ -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++) {

View File

@ -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++) {

View File

@ -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@