deps: update c-ares to v1.34.4

PR-URL: https://github.com/nodejs/node/pull/56256
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Node.js GitHub Bot 2024-12-16 20:02:29 -05:00 committed by GitHub
parent fb5bc18638
commit 2cd385ef67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
40 changed files with 1105 additions and 594 deletions

View File

@ -1,6 +1,6 @@
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
CMAKE_MINIMUM_REQUIRED (VERSION 3.5.0)
CMAKE_MINIMUM_REQUIRED (VERSION 3.5.0...3.10.0)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
@ -12,7 +12,7 @@ INCLUDE (CheckCSourceCompiles)
INCLUDE (CheckStructHasMember)
INCLUDE (CheckLibraryExists)
PROJECT (c-ares LANGUAGES C VERSION "1.34.3" )
PROJECT (c-ares LANGUAGES C VERSION "1.34.4" )
# 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:2:19")
SET (CARES_LIB_VERSIONINFO "21:3:19")
OPTION (CARES_STATIC "Build as a static library" OFF)
@ -271,6 +271,8 @@ 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")
# 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)
ELSEIF (WIN32)
LIST (APPEND SYSFLAGS -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602)
ENDIF ()
@ -406,6 +408,7 @@ ENDIF ()
CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID LANGUAGE C)
CHECK_SYMBOL_EXISTS (strnlen "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNLEN)
CHECK_SYMBOL_EXISTS (memmem "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_MEMMEM)
CHECK_SYMBOL_EXISTS (closesocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET)
CHECK_SYMBOL_EXISTS (CloseSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET_CAMEL)

View File

@ -3,17 +3,24 @@
# Copyright (C) the Massachusetts Institute of Technology.
# Copyright (C) Daniel Stenberg
#
# Permission to use, copy, modify, and distribute this
# software and its documentation for any purpose and without
# fee is hereby granted, provided that the above copyright
# notice appear in all copies and that both that copyright
# notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in
# advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
# M.I.T. makes no representations about the suitability of
# this software for any purpose. It is provided "as is"
# without express or implied warranty.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# SPDX-License-Identifier: MIT
#

View File

@ -19,17 +19,24 @@
# Copyright (C) the Massachusetts Institute of Technology.
# Copyright (C) Daniel Stenberg
#
# Permission to use, copy, modify, and distribute this
# software and its documentation for any purpose and without
# fee is hereby granted, provided that the above copyright
# notice appear in all copies and that both that copyright
# notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in
# advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
# M.I.T. makes no representations about the suitability of
# this software for any purpose. It is provided "as is"
# without express or implied warranty.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# SPDX-License-Identifier: MIT
#
@ -111,7 +118,9 @@ build_triplet = @build@
host_triplet = @host@
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \
$(top_srcdir)/m4/ares_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_ac_print_to_file.m4 \
$(top_srcdir)/m4/ax_add_am_macro_static.m4 \
$(top_srcdir)/m4/ax_am_macros_static.m4 \
@ -121,8 +130,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
$(top_srcdir)/m4/ax_check_link_flag.m4 \
$(top_srcdir)/m4/ax_check_user_namespace.m4 \
$(top_srcdir)/m4/ax_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_code_coverage.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \

View File

@ -1,17 +1,24 @@
# Copyright (C) 2009-2013 by Daniel Stenberg
#
# Permission to use, copy, modify, and distribute this
# software and its documentation for any purpose and without
# fee is hereby granted, provided that the above copyright
# notice appear in all copies and that both that copyright
# notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in
# advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
# M.I.T. makes no representations about the suitability of
# this software for any purpose. It is provided "as is"
# without express or implied warranty.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice (including the next
# paragraph) shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# SPDX-License-Identifier: MIT

View File

@ -1,97 +1,25 @@
## c-ares version 1.34.3 - November 9 2024
## c-ares version 1.34.4 - December 14 2024
This is a bugfix release.
Changes:
* Build the release package in an automated way so we can provide
provenance as per [SLSA3](https://slsa.dev/).
[PR #906](https://github.com/c-ares/c-ares/pull/906)
* QNX Port: Port to QNX 8, add primary config reading support, add CI build. [PR #934](https://github.com/c-ares/c-ares/pull/934), [PR #937](https://github.com/c-ares/c-ares/pull/937), [PR #938](https://github.com/c-ares/c-ares/pull/938)
Bugfixes:
* Some upstream servers are non-compliant with EDNS options, resend queries
without EDNS. [Issue #911](https://github.com/c-ares/c-ares/issues/911)
* Android: <=7 needs sys/system_properties.h
[a70637c](https://github.com/c-ares/c-ares/commit/a70637c)
* Android: CMake needs `-D_GNU_SOURCE` and others.
[PR #915](https://github.com/c-ares/c-ares/pull/914)
* TSAN warns on missing lock, but lock isn't actually necessary.
[PR #915](https://github.com/c-ares/c-ares/pull/915)
* `ares_getaddrinfo()` for `AF_UNSPEC` should retry IPv4 if only IPv6 is
received. [765d558](https://github.com/c-ares/c-ares/commit/765d558)
* `ares_send()` shouldn't return `ARES_EBADRESP`, its `ARES_EBADQUERY`.
[91519e7](https://github.com/c-ares/c-ares/commit/91519e7)
* Fix typos in man pages. [PR #905](https://github.com/c-ares/c-ares/pull/905)
* Empty TXT records were not being preserved. [PR #922](https://github.com/c-ares/c-ares/pull/922)
* docs: update deprecation notices for `ares_create_query()` and `ares_mkquery()`. [PR #910](https://github.com/c-ares/c-ares/pull/910)
* license: some files weren't properly updated. [PR #920](https://github.com/c-ares/c-ares/pull/920)
* Fix bind local device regression from 1.34.0. [PR #929](https://github.com/c-ares/c-ares/pull/929), [PR #931](https://github.com/c-ares/c-ares/pull/931), [PR #935](https://github.com/c-ares/c-ares/pull/935)
* CMake: set policy version to prevent deprecation warnings. [PR #932](https://github.com/c-ares/c-ares/pull/932)
* CMake: shared and static library names should be the same on unix platforms like autotools uses. [PR #933](https://github.com/c-ares/c-ares/pull/933)
* Update to latest autoconf archive macros for enhanced system compatibility. [PR #936](https://github.com/c-ares/c-ares/pull/936)
Thanks go to these friendly people for their efforts and contributions for this
release:
* Brad House (@bradh352)
* Jiwoo Park (@jimmy-park)
## c-ares version 1.34.2 - October 15 2024
This release contains a fix for downstream packages detecting the c-ares
version based on the contents of the header file rather than the
distributed pkgconf or cmake files.
## c-ares version 1.34.1 - October 9 2024
This release fixes a packaging issue.
## c-ares version 1.34.0 - October 9 2024
This is a feature and bugfix release.
Features:
* adig: read arguments from adigrc.
[PR #856](https://github.com/c-ares/c-ares/pull/856)
* Add new pending write callback optimization via `ares_set_pending_write_cb`.
[PR #857](https://github.com/c-ares/c-ares/pull/857)
* New function `ares_process_fds()`.
[PR #875](https://github.com/c-ares/c-ares/pull/875)
* Failed servers should be probed rather than redirecting queries which could
cause unexpected latency.
[PR #877](https://github.com/c-ares/c-ares/pull/877)
* adig: rework command line arguments to mimic dig from bind.
[PR #890](https://github.com/c-ares/c-ares/pull/890)
* Add new method for overriding network functions
`ares_set_socket_function_ex()` to properly support all new functionality.
[PR #894](https://github.com/c-ares/c-ares/pull/894)
* Fix regression with custom socket callbacks due to DNS cookie support.
[PR #895](https://github.com/c-ares/c-ares/pull/895)
* ares_socket: set IP_BIND_ADDRESS_NO_PORT on ares_set_local_ip* tcp sockets
[PR #887](https://github.com/c-ares/c-ares/pull/887)
* URI parser/writer for ares_set_servers_csv()/ares_get_servers_csv().
[PR #882](https://github.com/c-ares/c-ares/pull/882)
Changes:
* Connection handling modularization.
[PR #857](https://github.com/c-ares/c-ares/pull/857),
[PR #876](https://github.com/c-ares/c-ares/pull/876)
* Expose library/utility functions to tools.
[PR #860](https://github.com/c-ares/c-ares/pull/860)
* Remove `ares__` prefix, just use `ares_` for internal functions.
[PR #872](https://github.com/c-ares/c-ares/pull/872)
Bugfixes:
* fix: potential WIN32_LEAN_AND_MEAN redefinition.
[PR #869](https://github.com/c-ares/c-ares/pull/869)
* Fix googletest v1.15 compatibility.
[PR #874](https://github.com/c-ares/c-ares/pull/874)
* Fix pkgconfig thread dependencies.
[PR #884](https://github.com/c-ares/c-ares/pull/884)
Thanks go to these friendly people for their efforts and contributions for this
release:
* Brad House (@bradh352)
* Cristian Rodríguez (@crrodriguez)
* Georg (@tacerus)
* @lifenjoiner
* Shelley Vohr (@codebytere)
* 前进,前进,进 (@leleliu008)
* Daniel Stenberg (@bagder)
* Gregor Jasny (@gjasny)
* @marcovsz
* Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
* @vlasovsoft1979

View File

@ -1221,6 +1221,8 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/ares_check_user_namespace.m4])
m4_include([m4/ares_check_uts_namespace.m4])
m4_include([m4/ax_ac_append_to_file.m4])
m4_include([m4/ax_ac_print_to_file.m4])
m4_include([m4/ax_add_am_macro_static.m4])
@ -1231,8 +1233,6 @@ m4_include([m4/ax_append_link_flags.m4])
m4_include([m4/ax_check_compile_flag.m4])
m4_include([m4/ax_check_gnu_make.m4])
m4_include([m4/ax_check_link_flag.m4])
m4_include([m4/ax_check_user_namespace.m4])
m4_include([m4/ax_check_uts_namespace.m4])
m4_include([m4/ax_code_coverage.m4])
m4_include([m4/ax_compiler_vendor.m4])
m4_include([m4/ax_cxx_compile_stdcxx.m4])

View File

@ -1,6 +1,6 @@
# aminclude_static.am generated automatically by Autoconf
# from AX_AM_MACROS_STATIC on Sat Nov 9 17:40:37 UTC 2024
# from AX_AM_MACROS_STATIC on Sat Dec 14 15:15:44 UTC 2024
# Code coverage
@ -66,7 +66,7 @@ code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE);
code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN);
code_coverage_v_lcov_ign_0 = @echo " LCOV --remove" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN);
code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)";
@ -85,7 +85,7 @@ check-code-coverage:
# Capture code coverage data
code-coverage-capture: code-coverage-capture-hook
$(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
-@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp"
$(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
@echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"

677
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.3],
AC_INIT([c-ares], [1.34.4],
[c-ares mailing list: http://lists.haxx.se/listinfo/c-ares])
CARES_VERSION_INFO="21:2:19"
CARES_VERSION_INFO="21:3: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.
@ -245,18 +245,25 @@ AC_SUBST(CARES_SYMBOL_HIDING_CFLAG)
if test "$enable_warnings" = "yes"; then
AX_APPEND_COMPILE_FLAGS([-Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdouble-promotion -Wfloat-equal -Wformat-security -Winit-self -Wjump-misses-init -Wlogical-op -Wmissing-braces -Wmissing-declarations -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-prototypes -Wnested-externs -Wno-coverage-mismatch -Wold-style-definition -Wpacked -Wpedantic -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-conversion -Wstrict-overflow -Wstrict-prototypes -Wtrampolines -Wundef -Wunreachable-code -Wunused -Wvariadic-macros -Wvla -Wwrite-strings -Werror=implicit-int -Werror=implicit-function-declaration -Werror=partial-availability -Wno-long-long ],
[AM_CFLAGS], [-Werror])
dnl Android requires c99, all others should use c90
case $host_os in
*android*)
AX_APPEND_COMPILE_FLAGS([-std=c99], [AM_CFLAGS], [-Werror])
;;
*)
AX_APPEND_COMPILE_FLAGS([-std=c90], [AM_CFLAGS], [-Werror])
;;
esac
fi
dnl Android and QNX require c99, all others should use c90
case $host_os in
*qnx*|*android*)
AX_APPEND_COMPILE_FLAGS([-std=c99], [AM_CFLAGS], [-Werror])
;;
*)
AX_APPEND_COMPILE_FLAGS([-std=c90], [AM_CFLAGS], [-Werror])
;;
esac
dnl QNX needs -D_QNX_SOURCE
case $host_os in
*qnx*)
AX_APPEND_COMPILE_FLAGS([-D_QNX_SOURCE], [AM_CPPFLAGS], [-Werror])
;;
esac
if test "$ax_cv_c_compiler_vendor" = "intel"; then
AX_APPEND_COMPILE_FLAGS([-shared-intel], [AM_CFLAGS])
fi
@ -543,6 +550,7 @@ dnl https://mailman.videolan.org/pipermail/vlc-devel/2015-March/101802.html
dnl which would require we check each individually and provide function arguments
dnl for the test.
AC_CHECK_DECL(strnlen, [AC_DEFINE([HAVE_STRNLEN], 1, [Define to 1 if you have `strnlen`] )], [], $cares_all_includes)
AC_CHECK_DECL(memmem, [AC_DEFINE([HAVE_MEMMEM], 1, [Define to 1 if you have `memmem`] )], [], $cares_all_includes)
AC_CHECK_DECL(recv, [AC_DEFINE([HAVE_RECV], 1, [Define to 1 if you have `recv`] )], [], $cares_all_includes)
AC_CHECK_DECL(recvfrom, [AC_DEFINE([HAVE_RECVFROM], 1, [Define to 1 if you have `recvfrom`] )], [], $cares_all_includes)
@ -813,6 +821,13 @@ if test "x$build_tests" != "xno" -a "x$cross_compiling" = "xyes" ; then
AC_MSG_ERROR([*** Tests not supported when cross compiling])
fi
fi
dnl Forces compiling of tests even when cross-compiling.
AC_ARG_ENABLE(tests-crossbuild,
AS_HELP_STRING([--enable-tests-crossbuild], [Enable test building even when cross building]),
[build_tests="$enableval"]
)
if test "x$build_tests" != "xno" ; then
PKG_CHECK_MODULES([GMOCK], [gmock], [ have_gmock=yes ], [ have_gmock=no ])
if test "x$have_gmock" = "xno" ; then
@ -825,8 +840,8 @@ if test "x$build_tests" != "xno" ; then
else
PKG_CHECK_MODULES([GMOCK112], [gmock >= 1.12.0], [ have_gmock_v112=yes ], [ have_gmock_v112=no ])
if test "x$have_gmock_v112" = "xyes" ; then
AX_CHECK_USER_NAMESPACE
AX_CHECK_UTS_NAMESPACE
ARES_CHECK_USER_NAMESPACE
ARES_CHECK_UTS_NAMESPACE
fi
fi
fi

View File

@ -92,7 +92,9 @@ build_triplet = @build@
host_triplet = @host@
subdir = docs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \
$(top_srcdir)/m4/ares_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_ac_print_to_file.m4 \
$(top_srcdir)/m4/ax_add_am_macro_static.m4 \
$(top_srcdir)/m4/ax_am_macros_static.m4 \
@ -102,8 +104,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
$(top_srcdir)/m4/ax_check_link_flag.m4 \
$(top_srcdir)/m4/ax_check_user_namespace.m4 \
$(top_srcdir)/m4/ax_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_code_coverage.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \

View File

@ -19,6 +19,9 @@ int ares_create_query(const char *\fIname\fP,
int \fImax_udp_size\fP)
.fi
.SH DESCRIPTION
This function is deprecated as of c-ares 1.22, please use
\fIares_dns_record_create(3)\fP instead.
The \fIares_create_query(3)\fP function composes a DNS query with a single
question. The parameter \fIname\fP gives the query name as a NUL-terminated C
string of period-separated labels optionally ending with a period; periods and

View File

@ -14,7 +14,8 @@ int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
int *\fIbuflen\fP)
.fi
.SH DESCRIPTION
Deprecated function. See \fIares_create_query(3)\fP instead!
This function is deprecated as of c-ares 1.10, please use
\fIares_dns_record_create(3)\fP instead.
The
.B ares_mkquery

View File

@ -113,6 +113,9 @@ is being destroyed; the query will not be completed.
.B ARES_ENOSERVER
The query will not be completed because no DNS servers were configured on the
channel.
.TP 19
.B ARES_EBADQUERY
Misformatted DNS query.
.PP
The callback argument

View File

@ -90,7 +90,9 @@ build_triplet = @build@
host_triplet = @host@
subdir = include
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \
$(top_srcdir)/m4/ares_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_ac_print_to_file.m4 \
$(top_srcdir)/m4/ax_add_am_macro_static.m4 \
$(top_srcdir)/m4/ax_am_macros_static.m4 \
@ -100,8 +102,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
$(top_srcdir)/m4/ax_check_link_flag.m4 \
$(top_srcdir)/m4/ax_check_user_namespace.m4 \
$(top_srcdir)/m4/ax_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_code_coverage.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \

View File

@ -74,7 +74,7 @@
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
defined(__QNXNTO__) || defined(__MVS__) || defined(__HAIKU__)
defined(__QNX__) || defined(__MVS__) || defined(__HAIKU__)
# include <sys/select.h>
#endif

View File

@ -32,8 +32,8 @@
#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 34
#define ARES_VERSION_PATCH 3
#define ARES_VERSION_STR "1.34.3"
#define ARES_VERSION_PATCH 4
#define ARES_VERSION_STR "1.34.4"
/* 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

@ -2,7 +2,7 @@
# SYNOPSIS
#
# AX_CHECK_USER_NAMESPACE
# ARES_CHECK_USER_NAMESPACE
#
# DESCRIPTION
#
@ -12,9 +12,9 @@
# Copyright (C) The c-ares team
# SPDX-License-Identifier: MIT
AC_DEFUN([AX_CHECK_USER_NAMESPACE],[dnl
AC_DEFUN([ARES_CHECK_USER_NAMESPACE],[dnl
AC_CACHE_CHECK([whether user namespaces are supported],
ax_cv_user_namespace,[
ares_cv_user_namespace,[
AC_LANG_PUSH([C])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#define _GNU_SOURCE
@ -48,10 +48,10 @@ int main() {
if (!WIFEXITED(status)) return 1;
return WEXITSTATUS(status);
}
]])],[ax_cv_user_namespace=yes],[ax_cv_user_namespace=no],[ax_cv_user_namespace=no])
]])],[ares_cv_user_namespace=yes],[ares_cv_user_namespace=no],[ares_cv_user_namespace=no])
AC_LANG_POP([C])
])
if test "$ax_cv_user_namespace" = yes; then
if test "$ares_cv_user_namespace" = yes; then
AC_DEFINE([HAVE_USER_NAMESPACE],[1],[Whether user namespaces are available])
fi
]) # AX_CHECK_USER_NAMESPACE
]) # ARES_CHECK_USER_NAMESPACE

View File

@ -2,7 +2,7 @@
# SYNOPSIS
#
# AX_CHECK_UTS_NAMESPACE
# ARES_CHECK_UTS_NAMESPACE
#
# DESCRIPTION
#
@ -14,9 +14,9 @@
# Copyright (C) The c-ares team
# SPDX-License-Identifier: MIT
AC_DEFUN([AX_CHECK_UTS_NAMESPACE],[dnl
AC_DEFUN([ARES_CHECK_UTS_NAMESPACE],[dnl
AC_CACHE_CHECK([whether UTS namespaces are supported],
ax_cv_uts_namespace,[
ares_cv_uts_namespace,[
AC_LANG_PUSH([C])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#define _GNU_SOURCE
@ -70,10 +70,10 @@ int main() {
return WEXITSTATUS(status);
}
]])
],[ax_cv_uts_namespace=yes],[ax_cv_uts_namespace=no],[ax_cv_uts_namespace=no])
],[ares_cv_uts_namespace=yes],[ares_cv_uts_namespace=no],[ares_cv_uts_namespace=no])
AC_LANG_POP([C])
])
if test "$ax_cv_uts_namespace" = yes; then
if test "$ares_cv_uts_namespace" = yes; then
AC_DEFINE([HAVE_UTS_NAMESPACE],[1],[Whether UTS namespaces are available])
fi
]) # AX_CHECK_UTS_NAMESPACE
]) # ARES_CHECK_UTS_NAMESPACE

View File

@ -1,10 +1,10 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
# ===========================================================================
# ============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
# ============================================================================
#
# SYNOPSIS
#
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
@ -20,6 +20,8 @@
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: This macro depends on the AX_APPEND_FLAG and
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
# AX_APPEND_LINK_FLAGS.
@ -28,38 +30,17 @@
#
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
# 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 3
#serial 7
AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
[AC_REQUIRE([AX_CHECK_COMPILE_FLAG])
AC_REQUIRE([AX_APPEND_FLAG])
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
for flag in $1; do
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3])
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
done
])dnl AX_APPEND_COMPILE_FLAGS

View File

@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# ===========================================================================
#
# SYNOPSIS
@ -23,47 +23,28 @@
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
# 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 2
#serial 8
AC_DEFUN([AX_APPEND_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl
AS_VAR_SET_IF(FLAGS,
[case " AS_VAR_GET(FLAGS) " in
*" $1 "*)
AC_RUN_LOG([: FLAGS already contains $1])
;;
*)
AC_RUN_LOG([: FLAGS="$FLAGS $1"])
AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"])
;;
esac],
[AS_VAR_SET(FLAGS,["$1"])])
[dnl
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
AS_VAR_SET_IF(FLAGS,[
AS_CASE([" AS_VAR_GET(FLAGS) "],
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
[
AS_VAR_APPEND(FLAGS,[" $1"])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
],
[
AS_VAR_SET(FLAGS,[$1])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_APPEND_FLAG

View File

@ -1,10 +1,10 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
#
# DESCRIPTION
#
@ -19,6 +19,8 @@
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
# force the compiler to issue an error when a bad flag is given.
#
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
#
@ -27,45 +29,34 @@
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
# 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 2
#serial 11
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
AC_CACHE_CHECK([whether the _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
if test x"m4_case(_AC_LANG,
[C], [$GCC],
[C++], [$GXX],
[Fortran], [$GFC],
[Fortran 77], [$G77],
[Objective C], [$GOBJC],
[Objective C++], [$GOBJCXX],
[no])" = xyes ; then
add_gnu_werror="-Werror"
fi
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1 $add_gnu_werror"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
AS_VAR_IF(CACHEVAR,yes,
[m4_default([$2], :)],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl

View File

@ -74,7 +74,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#serial 34
#serial 37
m4_define(_AX_CODE_COVERAGE_RULES,[
AX_ADD_AM_MACRO_STATIC([
@ -144,7 +144,7 @@ code_coverage_v_lcov_cap_ = \$(code_coverage_v_lcov_cap_\$(AM_DEFAULT_VERBOSITY)
code_coverage_v_lcov_cap_0 = @echo \" LCOV --capture\" \$(CODE_COVERAGE_OUTPUT_FILE);
code_coverage_v_lcov_ign = \$(code_coverage_v_lcov_ign_\$(V))
code_coverage_v_lcov_ign_ = \$(code_coverage_v_lcov_ign_\$(AM_DEFAULT_VERBOSITY))
code_coverage_v_lcov_ign_0 = @echo \" LCOV --remove /tmp/*\" \$(CODE_COVERAGE_IGNORE_PATTERN);
code_coverage_v_lcov_ign_0 = @echo \" LCOV --remove\" \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \$(CODE_COVERAGE_IGNORE_PATTERN);
code_coverage_v_genhtml = \$(code_coverage_v_genhtml_\$(V))
code_coverage_v_genhtml_ = \$(code_coverage_v_genhtml_\$(AM_DEFAULT_VERBOSITY))
code_coverage_v_genhtml_0 = @echo \" GEN \" \"\$(CODE_COVERAGE_OUTPUT_DIRECTORY)\";
@ -163,7 +163,7 @@ check-code-coverage:
# Capture code coverage data
code-coverage-capture: code-coverage-capture-hook
\$(code_coverage_v_lcov_cap)\$(LCOV) \$(code_coverage_quiet) \$(addprefix --directory ,\$(CODE_COVERAGE_DIRECTORY)) --capture --output-file \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" --test-name \"\$(call code_coverage_sanitize,\$(PACKAGE_NAME)-\$(PACKAGE_VERSION))\" --no-checksum --compat-libtool \$(CODE_COVERAGE_LCOV_SHOPTS) \$(CODE_COVERAGE_LCOV_OPTIONS)
\$(code_coverage_v_lcov_ign)\$(LCOV) \$(code_coverage_quiet) \$(addprefix --directory ,\$(CODE_COVERAGE_DIRECTORY)) --remove \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \"/tmp/*\" \$(CODE_COVERAGE_IGNORE_PATTERN) --output-file \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \$(CODE_COVERAGE_LCOV_SHOPTS) \$(CODE_COVERAGE_LCOV_RMOPTS)
\$(code_coverage_v_lcov_ign)\$(LCOV) \$(code_coverage_quiet) \$(addprefix --directory ,\$(CODE_COVERAGE_DIRECTORY)) --remove \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\" \$(CODE_COVERAGE_IGNORE_PATTERN) --output-file \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \$(CODE_COVERAGE_LCOV_SHOPTS) \$(CODE_COVERAGE_LCOV_RMOPTS)
-@rm -f \"\$(CODE_COVERAGE_OUTPUT_FILE).tmp\"
\$(code_coverage_v_genhtml)LANG=C \$(GENHTML) \$(code_coverage_quiet) \$(addprefix --prefix ,\$(CODE_COVERAGE_DIRECTORY)) --output-directory \"\$(CODE_COVERAGE_OUTPUT_DIRECTORY)\" --title \"\$(PACKAGE_NAME)-\$(PACKAGE_VERSION) Code Coverage\" --legend --show-details \"\$(CODE_COVERAGE_OUTPUT_FILE)\" \$(CODE_COVERAGE_GENHTML_OPTIONS)
@echo \"file://\$(abs_builddir)/\$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html\"
@ -206,14 +206,14 @@ code-coverage-capture-hook:
])
AC_DEFUN([_AX_CODE_COVERAGE_ENABLED],[
AX_CHECK_GNU_MAKE([],AC_MSG_ERROR([not using GNU make that is needed for coverage]))
AX_CHECK_GNU_MAKE([],[AC_MSG_ERROR([not using GNU make that is needed for coverage])])
AC_REQUIRE([AX_ADD_AM_MACRO_STATIC])
# check for gcov
AC_CHECK_TOOL([GCOV],
[$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
[:])
AS_IF([test "X$GCOV" = "X:"],
AC_MSG_ERROR([gcov is needed to do coverage]))
[AC_MSG_ERROR([gcov is needed to do coverage])])
AC_SUBST([GCOV])
dnl Check if gcc is being used
@ -232,12 +232,13 @@ AC_DEFUN([_AX_CODE_COVERAGE_ENABLED],[
AC_MSG_ERROR([Could not find genhtml from the lcov package])
])
AC_CHECK_LIB([gcov], [_gcov_init], [CODE_COVERAGE_LIBS="-lgcov"], [CODE_COVERAGE_LIBS=""])
dnl Build the code coverage flags
dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
CODE_COVERAGE_LIBS="-lgcov"
AC_SUBST([CODE_COVERAGE_CPPFLAGS])
AC_SUBST([CODE_COVERAGE_CFLAGS])

View File

@ -10,8 +10,8 @@
#
# Check for baseline language coverage in the compiler for the specified
# version of the C++ standard. If necessary, add switches to CXX and
# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for
# the respective C++ standard version.
# CXXCPP to enable support. VERSION may be '11', '14', '17', '20', or
# '23' for the respective C++ standard version.
#
# The second argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
@ -36,14 +36,15 @@
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
# Copyright (c) 2019 Enji Cooper <yaneurabeya@gmail.com>
# Copyright (c) 2020 Jason Merrill <jason@redhat.com>
# Copyright (c) 2021 Jörn Heusipp <osmanx@problemloesungsmaschine.de>
# Copyright (c) 2021, 2024 Jörn Heusipp <osmanx@problemloesungsmaschine.de>
# Copyright (c) 2015, 2022, 2023, 2024 Olly Betts
#
# 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 18
#serial 25
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
@ -53,6 +54,7 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
[$1], [20], [ax_cxx_compile_alternatives="20"],
[$1], [23], [ax_cxx_compile_alternatives="23"],
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$2], [], [],
[$2], [ext], [],
@ -159,31 +161,41 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
dnl Test body for checking C++11 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
[_AX_CXX_COMPILE_STDCXX_testbody_new_in_11]
)
dnl Test body for checking C++14 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
[_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14]
)
dnl Test body for checking C++17 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
[_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17]
)
dnl Test body for checking C++20 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
_AX_CXX_COMPILE_STDCXX_testbody_new_in_20
[_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
_AX_CXX_COMPILE_STDCXX_testbody_new_in_20]
)
dnl Test body for checking C++23 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_23],
[_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
_AX_CXX_COMPILE_STDCXX_testbody_new_in_20
_AX_CXX_COMPILE_STDCXX_testbody_new_in_23]
)
@ -201,7 +213,17 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
// 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"
@ -617,7 +639,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
#error "This is not a C++ compiler"
#elif __cplusplus < 201703L && !defined _MSC_VER
#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 201703L
#error "This is not a C++17 compiler"
@ -983,7 +1005,7 @@ namespace cxx17
} // namespace cxx17
#endif // __cplusplus < 201703L && !defined _MSC_VER
#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 201703L
]])
@ -996,7 +1018,7 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[
#error "This is not a C++ compiler"
#elif __cplusplus < 202002L && !defined _MSC_VER
#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202002L
#error "This is not a C++20 compiler"
@ -1013,6 +1035,36 @@ namespace cxx20
} // namespace cxx20
#endif // __cplusplus < 202002L && !defined _MSC_VER
#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202002L
]])
dnl Tests for new features in C++23
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_23], [[
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202302L
#error "This is not a C++23 compiler"
#else
#include <version>
namespace cxx23
{
// As C++23 supports feature test macros in the standard, there is no
// immediate need to actually test for feature availability on the
// Autoconf side.
} // namespace cxx23
#endif // (defined _MSVC_LANG ? _MSVC_LANG : __cplusplus) < 202302L
]])

View File

@ -89,7 +89,9 @@ build_triplet = @build@
host_triplet = @host@
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \
$(top_srcdir)/m4/ares_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_ac_print_to_file.m4 \
$(top_srcdir)/m4/ax_add_am_macro_static.m4 \
$(top_srcdir)/m4/ax_am_macros_static.m4 \
@ -99,8 +101,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
$(top_srcdir)/m4/ax_check_link_flag.m4 \
$(top_srcdir)/m4/ax_check_user_namespace.m4 \
$(top_srcdir)/m4/ax_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_code_coverage.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \

View File

@ -92,11 +92,23 @@ IF (CARES_STATIC)
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES
EXPORT_NAME cares${STATIC_SUFFIX}
OUTPUT_NAME cares${STATIC_SUFFIX}
COMPILE_PDB_NAME cares${STATIC_SUFFIX}
C_STANDARD 90
)
# On Windows, the output name should have a static suffix since otherwise
# we would have conflicting output names (libcares.lib) for the link
# library.
# However on Unix-like systems, we typically have something like
# libcares.so for shared libraries and libcares.a for static
# libraries, so these don't conflict.
# This behavior better emulates what happens with autotools builds
IF (WIN32)
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES OUTPUT_NAME cares${STATIC_SUFFIX})
ELSE ()
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES OUTPUT_NAME cares)
ENDIF()
IF (ANDROID)
SET_TARGET_PROPERTIES (${LIBNAME} PROPERTIES C_STANDARD 99)
ENDIF ()

View File

@ -15,7 +15,7 @@
@SET_MAKE@
# aminclude_static.am generated automatically by Autoconf
# from AX_AM_MACROS_STATIC on Sat Nov 9 17:40:37 UTC 2024
# from AX_AM_MACROS_STATIC on Sat Dec 14 15:15:44 UTC 2024
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
@ -100,7 +100,9 @@ host_triplet = @host@
subdir = src/lib
SUBDIRS =
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \
$(top_srcdir)/m4/ares_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_ac_print_to_file.m4 \
$(top_srcdir)/m4/ax_add_am_macro_static.m4 \
$(top_srcdir)/m4/ax_am_macros_static.m4 \
@ -110,8 +112,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
$(top_srcdir)/m4/ax_check_link_flag.m4 \
$(top_srcdir)/m4/ax_check_user_namespace.m4 \
$(top_srcdir)/m4/ax_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_code_coverage.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
@ -629,7 +629,7 @@ libcares_la_CPPFLAGS_EXTRA = -DCARES_BUILDING_LIBRARY $(am__append_3) \
@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_cap_0 = @echo " LCOV --capture" $(CODE_COVERAGE_OUTPUT_FILE);
@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN);
@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_lcov_ign_0 = @echo " LCOV --remove" "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN);
@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
@CODE_COVERAGE_ENABLED_TRUE@code_coverage_v_genhtml_0 = @echo " GEN " "$(CODE_COVERAGE_OUTPUT_DIRECTORY)";
@ -2328,7 +2328,7 @@ uninstall-am: uninstall-libLTLIBRARIES
# Capture code coverage data
@CODE_COVERAGE_ENABLED_TRUE@code-coverage-capture: code-coverage-capture-hook
@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
@CODE_COVERAGE_ENABLED_TRUE@ -@rm -f "$(CODE_COVERAGE_OUTPUT_FILE).tmp"
@CODE_COVERAGE_ENABLED_TRUE@ $(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
@CODE_COVERAGE_ENABLED_TRUE@ @echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"

View File

@ -257,6 +257,9 @@
/* Define to 1 if you have the <signal.h> header file. */
#cmakedefine HAVE_SIGNAL_H 1
/* Define to 1 if you have the strnlen function. */
#cmakedefine HAVE_STRNLEN 1
/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */
#cmakedefine HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID 1

View File

@ -309,6 +309,9 @@
/* Define to 1 if you have `strnicmp` */
#undef HAVE_STRNICMP
/* Define to 1 if you have `strnlen` */
#undef HAVE_STRNLEN
/* Define to 1 if the system has the type `struct addrinfo'. */
#undef HAVE_STRUCT_ADDRINFO

View File

@ -388,8 +388,23 @@ ares_status_t ares_sysconfig_set_options(ares_sysconfig_t *sysconfig,
ares_status_t ares_init_by_environment(ares_sysconfig_t *sysconfig);
typedef ares_status_t (*ares_sysconfig_line_cb_t)(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig,
ares_buf_t *line);
ares_status_t ares_sysconfig_parse_resolv_line(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig,
ares_buf_t *line);
ares_status_t ares_sysconfig_process_buf(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig,
ares_buf_t *buf,
ares_sysconfig_line_cb_t cb);
ares_status_t ares_init_sysconfig_files(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig);
ares_sysconfig_t *sysconfig,
ares_bool_t process_resolvconf);
#ifdef __APPLE__
ares_status_t ares_init_sysconfig_macos(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig);

View File

@ -288,7 +288,9 @@ static int default_asetsockopt(ares_socket_t sock, ares_socket_opt_t opt,
return setsockopt(sock, SOL_SOCKET, SO_RCVBUF, val, val_size);
case ARES_SOCKET_OPT_BIND_DEVICE:
if (!ares_str_isprint(val, (size_t)val_size)) {
/* Count the number of characters before NULL terminator then
* validate those are all printable */
if (!ares_str_isprint(val, ares_strnlen(val, (size_t)val_size))) {
SET_SOCKERRNO(EINVAL);
return -1;
}

View File

@ -263,7 +263,8 @@ ares_status_t ares_socket_configure(ares_channel_t *channel, int family,
* compatibility */
(void)channel->sock_funcs.asetsockopt(
fd, ARES_SOCKET_OPT_BIND_DEVICE, channel->local_dev_name,
sizeof(channel->local_dev_name), channel->sock_func_cb_data);
(ares_socklen_t)ares_strlen(channel->local_dev_name),
channel->sock_func_cb_data);
}
/* Bind to ip address if configured */

View File

@ -260,6 +260,94 @@ static ares_status_t ares_init_sysconfig_android(const ares_channel_t *channel,
}
#endif
#if defined(__QNX__)
static ares_status_t
ares_init_sysconfig_qnx(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig)
{
/* QNX:
* 1. use confstr(_CS_RESOLVE, ...) as primary resolv.conf data, replacing
* "_" with " ". If that is empty, then do normal /etc/resolv.conf
* processing.
* 2. We want to process /etc/nsswitch.conf as normal.
* 3. if confstr(_CS_DOMAIN, ...) this is the domain name. Use this as
* preference over anything else found.
*/
ares_buf_t *buf = ares_buf_create();
unsigned char *data = NULL;
size_t data_size = 0;
ares_bool_t process_resolvconf = ARES_TRUE;
ares_status_t status = ARES_SUCCESS;
/* Prefer confstr(_CS_RESOLVE, ...) */
buf = ares_buf_create();
if (buf == NULL) {
status = ARES_ENOMEM;
goto done;
}
data_size = 1024;
data = ares_buf_append_start(buf, &data_size);
if (data == NULL) {
status = ARES_ENOMEM;
goto done;
}
data_size = confstr(_CS_RESOLVE, (char *)data, data_size);
if (data_size > 1) {
/* confstr returns byte for NULL terminator, strip */
data_size--;
ares_buf_append_finish(buf, data_size);
/* Its odd, this uses _ instead of " " between keywords, otherwise the
* format is the same as resolv.conf, replace. */
ares_buf_replace(buf, (const unsigned char *)"_", 1,
(const unsigned char *)" ", 1);
status = ares_sysconfig_process_buf(channel, sysconfig, buf,
ares_sysconfig_parse_resolv_line);
if (status != ARES_SUCCESS) {
/* ENOMEM is really the only error we'll get here */
goto done;
}
/* don't read resolv.conf if we processed *any* nameservers */
if (ares_llist_len(sysconfig->sconfig) != 0) {
process_resolvconf = ARES_FALSE;
}
}
/* Process files */
status = ares_init_sysconfig_files(channel, sysconfig, process_resolvconf);
if (status != ARES_SUCCESS) {
goto done;
}
/* Read confstr(_CS_DOMAIN, ...), but if we had a search path specified with
* more than one domain, lets prefer that instead. Its not exactly clear
* the best way to handle this. */
if (sysconfig->ndomains <= 1) {
char domain[256];
size_t domain_len;
domain_len = confstr(_CS_DOMAIN, domain, sizeof(domain_len));
if (domain_len != 0) {
ares_strsplit_free(sysconfig->domains, sysconfig->ndomains);
sysconfig->domains = ares_strsplit(domain, ", ", &sysconfig->ndomains);
if (sysconfig->domains == NULL) {
status = ARES_ENOMEM;
goto done;
}
}
}
done:
ares_buf_destroy(buf);
return status;
}
#endif
#if defined(CARES_USE_LIBRESOLV)
static ares_status_t
ares_init_sysconfig_libresolv(const ares_channel_t *channel,
@ -516,8 +604,10 @@ ares_status_t ares_init_by_sysconfig(ares_channel_t *channel)
status = ares_init_sysconfig_macos(channel, &sysconfig);
#elif defined(CARES_USE_LIBRESOLV)
status = ares_init_sysconfig_libresolv(channel, &sysconfig);
#elif defined(__QNX__)
status = ares_init_sysconfig_qnx(channel, &sysconfig);
#else
status = ares_init_sysconfig_files(channel, &sysconfig);
status = ares_init_sysconfig_files(channel, &sysconfig, ARES_TRUE);
#endif
if (status != ARES_SUCCESS) {

View File

@ -549,9 +549,9 @@ ares_status_t ares_init_by_environment(ares_sysconfig_t *sysconfig)
/* This function will only return ARES_SUCCESS or ARES_ENOMEM. Any other
* conditions are ignored. Users may mess up config files, but we want to
* process anything we can. */
static ares_status_t parse_resolvconf_line(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig,
ares_buf_t *line)
ares_status_t ares_sysconfig_parse_resolv_line(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig,
ares_buf_t *line)
{
char option[32];
char value[512];
@ -726,38 +726,16 @@ done:
return status;
}
typedef ares_status_t (*line_callback_t)(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig,
ares_buf_t *line);
/* Should only return:
* ARES_ENOTFOUND - file not found
* ARES_EFILE - error reading file (perms)
* ARES_ENOMEM - out of memory
* ARES_SUCCESS - file processed, doesn't necessarily mean it was a good
* file, but we're not erroring out if we can't parse
* something (or anything at all) */
static ares_status_t process_config_lines(const ares_channel_t *channel,
const char *filename,
ares_sysconfig_t *sysconfig,
line_callback_t cb)
ares_status_t ares_sysconfig_process_buf(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig,
ares_buf_t *buf,
ares_sysconfig_line_cb_t cb)
{
ares_status_t status = ARES_SUCCESS;
ares_array_t *lines = NULL;
ares_buf_t *buf = NULL;
size_t num;
size_t i;
buf = ares_buf_create();
if (buf == NULL) {
status = ARES_ENOMEM;
goto done;
}
status = ares_buf_load_file(filename, buf);
if (status != ARES_SUCCESS) {
goto done;
}
ares_status_t status;
status = ares_buf_split(buf, (const unsigned char *)"\n", 1,
ARES_BUF_SPLIT_TRIM, 0, &lines);
@ -777,25 +755,60 @@ static ares_status_t process_config_lines(const ares_channel_t *channel,
}
done:
ares_buf_destroy(buf);
ares_array_destroy(lines);
return status;
}
/* Should only return:
* ARES_ENOTFOUND - file not found
* ARES_EFILE - error reading file (perms)
* ARES_ENOMEM - out of memory
* ARES_SUCCESS - file processed, doesn't necessarily mean it was a good
* file, but we're not erroring out if we can't parse
* something (or anything at all) */
static ares_status_t process_config_lines(const ares_channel_t *channel,
const char *filename,
ares_sysconfig_t *sysconfig,
ares_sysconfig_line_cb_t cb)
{
ares_status_t status = ARES_SUCCESS;
ares_buf_t *buf = NULL;
buf = ares_buf_create();
if (buf == NULL) {
status = ARES_ENOMEM;
goto done;
}
status = ares_buf_load_file(filename, buf);
if (status != ARES_SUCCESS) {
goto done;
}
status = ares_sysconfig_process_buf(channel, sysconfig, buf, cb);
done:
ares_buf_destroy(buf);
return status;
}
ares_status_t ares_init_sysconfig_files(const ares_channel_t *channel,
ares_sysconfig_t *sysconfig)
ares_sysconfig_t *sysconfig,
ares_bool_t process_resolvconf)
{
ares_status_t status = ARES_SUCCESS;
/* Resolv.conf */
status = process_config_lines(channel,
(channel->resolvconf_path != NULL)
? channel->resolvconf_path
: PATH_RESOLV_CONF,
sysconfig, parse_resolvconf_line);
if (status != ARES_SUCCESS && status != ARES_ENOTFOUND) {
goto done;
if (process_resolvconf) {
status = process_config_lines(channel,
(channel->resolvconf_path != NULL)
? channel->resolvconf_path
: PATH_RESOLV_CONF,
sysconfig, ares_sysconfig_parse_resolv_line);
if (status != ARES_SUCCESS && status != ARES_ENOTFOUND) {
goto done;
}
}
/* Nsswitch.conf */

View File

@ -558,14 +558,24 @@ static ares_status_t config_change_check(ares_htable_strvp_t *filestat,
const char *resolvconf_path)
{
size_t i;
const char *configfiles[5];
const char *configfiles[16];
ares_bool_t changed = ARES_FALSE;
size_t cnt = 0;
configfiles[0] = resolvconf_path;
configfiles[1] = "/etc/nsswitch.conf";
configfiles[2] = "/etc/netsvc.conf";
configfiles[3] = "/etc/svc.conf";
configfiles[4] = NULL;
memset(configfiles, 0, sizeof(configfiles));
configfiles[cnt++] = resolvconf_path;
configfiles[cnt++] = "/etc/nsswitch.conf";
#ifdef _AIX
configfiles[cnt++] = "/etc/netsvc.conf";
#endif
#ifdef __osf /* Tru64 */
configfiles[cnt++] = "/etc/svc.conf";
#endif
#ifdef __QNX__
configfiles[cnt++] = "/etc/net.cfg";
#endif
configfiles[cnt++] = NULL;
for (i = 0; configfiles[i] != NULL; i++) {
fileinfo_t *fi = ares_htable_strvp_get_direct(filestat, configfiles[i]);

View File

@ -219,6 +219,26 @@ CARES_EXTERN unsigned char *ares_buf_finish_bin(ares_buf_t *buf, size_t *len);
*/
CARES_EXTERN char *ares_buf_finish_str(ares_buf_t *buf, size_t *len);
/*! Replace the given search byte sequence with the replacement byte sequence.
* This is only valid for allocated buffers, not const buffers. Will replace
* all byte sequences starting at the current offset to the end of the buffer.
*
* \param[in] buf Initialized buffer object. Can not be a "const" buffer.
* \param[in] srch Search byte sequence, must not be NULL.
* \param[in] srch_size Size of byte sequence, must not be zero.
* \param[in] rplc Byte sequence to use as replacement. May be NULL if
* rplc_size is zero.
* \param[in] rplc_size Size of replacement byte sequence, may be 0.
* \return ARES_SUCCESS on success, otherwise on may return failure only on
* memory allocation failure or misuse. Will not return indication
* if any replacements occurred
*/
CARES_EXTERN ares_status_t ares_buf_replace(ares_buf_t *buf,
const unsigned char *srch,
size_t srch_size,
const unsigned char *rplc,
size_t rplc_size);
/*! Tag a position to save in the buffer in case parsing needs to rollback,
* such as if insufficient data is available, but more data may be added in
* the future. Only a single tag can be set per buffer object. Setting a

View File

@ -29,6 +29,20 @@
CARES_EXTERN char *ares_strdup(const char *s1);
/*! Scan up to maxlen bytes for the first NULL character and return
* its index, or maxlen if not found. The function only returns
* maxlen if the first maxlen bytes were not NULL characters; it
* makes no guarantee for what \c str[maxlen] (if defined) is, and
* does not access it. It is behaving like the POSIX \c strnlen()
* function, except that it returns 0 if the \p str pointer is \c
* NULL.
*
* \param[in] str The string to scan for the NULL character
* \param[in] maxlen The maximum number of bytes to scan
* \return Index of first NULL byte. Between 0 and maxlen (inclusive).
*/
CARES_EXTERN size_t ares_strnlen(const char *str, size_t maxlen);
CARES_EXTERN size_t ares_strlen(const char *str);
/*! Copy string from source to destination with destination buffer size

View File

@ -146,6 +146,18 @@ ares_status_t ares_dns_multistring_add_own(ares_dns_multistring_t *strs,
return status;
}
/* Issue #921, ares_dns_multistring_get() doesn't have a way to indicate
* success or fail on a zero-length string which is actually valid. So we
* are going to allocate a 1-byte buffer to use as a placeholder in this
* case */
if (str == NULL) {
str = ares_malloc_zero(1);
if (str == NULL) {
ares_array_remove_last(strs->strs);
return ARES_ENOMEM;
}
}
data->data = str;
data->len = len;
@ -252,36 +264,38 @@ ares_status_t ares_dns_multistring_parse_buf(ares_buf_t *buf,
break; /* LCOV_EXCL_LINE: DefensiveCoding */
}
if (len) {
/* When used by the _str() parser, it really needs to be validated to
* be a valid printable ascii string. Do that here */
if (validate_printable && ares_buf_len(buf) >= len) {
size_t mylen;
const char *data = (const char *)ares_buf_peek(buf, &mylen);
if (!ares_str_isprint(data, len)) {
status = ARES_EBADSTR;
break;
}
}
if (strs != NULL) {
unsigned char *data = NULL;
/* When used by the _str() parser, it really needs to be validated to
* be a valid printable ascii string. Do that here */
if (len && validate_printable && ares_buf_len(buf) >= len) {
size_t mylen;
const char *data = (const char *)ares_buf_peek(buf, &mylen);
if (!ares_str_isprint(data, len)) {
status = ARES_EBADSTR;
break;
}
}
if (strs != NULL) {
unsigned char *data = NULL;
if (len) {
status = ares_buf_fetch_bytes_dup(buf, len, ARES_TRUE, &data);
if (status != ARES_SUCCESS) {
break;
}
status = ares_dns_multistring_add_own(*strs, data, len);
if (status != ARES_SUCCESS) {
ares_free(data);
break;
}
} else {
status = ares_buf_consume(buf, len);
if (status != ARES_SUCCESS) {
break;
}
}
status = ares_dns_multistring_add_own(*strs, data, len);
if (status != ARES_SUCCESS) {
ares_free(data);
break;
}
} else {
status = ares_buf_consume(buf, len);
if (status != ARES_SUCCESS) {
break;
}
}
}
if (status != ARES_SUCCESS && strs != NULL) {

View File

@ -1104,6 +1104,72 @@ const unsigned char *ares_buf_peek(const ares_buf_t *buf, size_t *len)
return ares_buf_fetch(buf, len);
}
ares_status_t ares_buf_replace(ares_buf_t *buf, const unsigned char *srch,
size_t srch_size, const unsigned char *rplc,
size_t rplc_size)
{
size_t processed_len = 0;
ares_status_t status;
if (buf->alloc_buf == NULL || srch == NULL || srch_size == 0 ||
(rplc == NULL && rplc_size != 0)) {
return ARES_EFORMERR;
}
while (1) {
unsigned char *ptr = buf->alloc_buf + buf->offset + processed_len;
size_t remaining_len = buf->data_len - buf->offset - processed_len;
size_t found_offset = 0;
size_t move_data_len;
/* Find pattern */
ptr = ares_memmem(ptr, remaining_len, srch, srch_size);
if (ptr == NULL) {
break;
}
/* Store the offset this was found because our actual pointer might be
* switched out from under us by the call to ensure_space() if the
* replacement pattern is larger than the search pattern */
found_offset = (size_t)(ptr - (size_t)(buf->alloc_buf + buf->offset));
if (rplc_size > srch_size) {
status = ares_buf_ensure_space(buf, rplc_size - srch_size);
if (status != ARES_SUCCESS) {
return status;
}
}
/* Impossible, but silence clang */
if (buf->alloc_buf == NULL) {
return ARES_ENOMEM;
}
/* Recalculate actual pointer */
ptr = buf->alloc_buf + buf->offset + found_offset;
/* Move the data */
move_data_len = buf->data_len - buf->offset - found_offset - srch_size;
memmove(ptr + rplc_size,
ptr + srch_size,
move_data_len);
/* Copy in the replacement data */
if (rplc != NULL && rplc_size > 0) {
memcpy(ptr, rplc, rplc_size);
}
if (rplc_size > srch_size) {
buf->data_len += rplc_size - srch_size;
} else {
buf->data_len -= srch_size - rplc_size;
}
processed_len = found_offset + rplc_size;
}
return ARES_SUCCESS;
}
ares_status_t ares_buf_peek_byte(const ares_buf_t *buf, unsigned char *b)
{
size_t remaining_len = 0;

View File

@ -32,6 +32,23 @@
# include <stdint.h>
#endif
size_t ares_strnlen(const char *str, size_t maxlen) {
const char *p = NULL;
if (str == NULL) {
return 0;
}
#ifdef HAVE_STRNLEN
(void)p;
return strnlen(str, maxlen);
#else
if ((p = memchr(str, 0, maxlen)) == NULL) {
return maxlen;
} else {
return (size_t)(p - str);
}
#endif /* HAVE_STRNLEN */
}
size_t ares_strlen(const char *str)
{
if (str == NULL) {

View File

@ -91,7 +91,9 @@ host_triplet = @host@
noinst_PROGRAMS = $(am__EXEEXT_1)
subdir = src/tools
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
am__aclocal_m4_deps = $(top_srcdir)/m4/ares_check_user_namespace.m4 \
$(top_srcdir)/m4/ares_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_ac_print_to_file.m4 \
$(top_srcdir)/m4/ax_add_am_macro_static.m4 \
$(top_srcdir)/m4/ax_am_macros_static.m4 \
@ -101,8 +103,6 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
$(top_srcdir)/m4/ax_check_link_flag.m4 \
$(top_srcdir)/m4/ax_check_user_namespace.m4 \
$(top_srcdir)/m4/ax_check_uts_namespace.m4 \
$(top_srcdir)/m4/ax_code_coverage.m4 \
$(top_srcdir)/m4/ax_compiler_vendor.m4 \
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \