mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
deps: update c-ares to 1.19.1
PR-URL: https://github.com/nodejs/node/pull/48115 Backport-PR-URL: https://github.com/nodejs-private/node-private/pull/437 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
392dfedc77
commit
35d4efb57b
37 files changed
+2807
-1001
No files matched your search
Vendored
+227
-73
@@ -1,5 +1,232 @@
|
||||
Changelog for the c-ares project. Generated with git2changes.pl
|
||||
|
||||
Version 1.19.1 (22 May 2023)
|
||||
|
||||
bradh352 (22 May 2023)
|
||||
- Makefile.inc Windows requires tabs not spaces for nmake
|
||||
|
||||
GitHub (22 May 2023)
|
||||
- [Daniel Stenberg brought this change]
|
||||
|
||||
ares_expand_name: fix compiler warnings (#522)
|
||||
|
||||
Fix some compiler warnings (not introduced in this release)
|
||||
|
||||
Fix By: Daniel Stenberg (@bagder)
|
||||
|
||||
bradh352 (22 May 2023)
|
||||
- windows MSVC compiler fix on 32bit
|
||||
|
||||
- update security advisory links
|
||||
|
||||
- minor CI issues fixes for imported inet_net_pton
|
||||
|
||||
- ares_rand static analysis fixes from CI
|
||||
|
||||
- windows build fix
|
||||
|
||||
- security release notes
|
||||
|
||||
GitHub (22 May 2023)
|
||||
- [Brad House brought this change]
|
||||
|
||||
Merge pull request from GHSA-9g78-jv2r-p7vc
|
||||
|
||||
- [Brad House brought this change]
|
||||
|
||||
Merge pull request from GHSA-x6mf-cxr9-8q6v
|
||||
|
||||
* Merged latest OpenBSD changes for inet_net_pton_ipv6() into c-ares.
|
||||
* Always use our own IP conversion functions now, do not delegate to OS
|
||||
so we can have consistency in testing and fuzzing.
|
||||
* Removed bogus test cases that never should have passed.
|
||||
* Add new test case for crash bug found.
|
||||
|
||||
Fix By: Brad House (@bradh352)
|
||||
|
||||
- [Brad House brought this change]
|
||||
|
||||
Merge pull request from GHSA-8r8p-23f3-64c2
|
||||
|
||||
* segment random number generation into own file
|
||||
|
||||
* abstract random code to make it more modular so we can have multiple backends
|
||||
|
||||
* rand: add support for arc4random_buf() and also direct CARES_RANDOM_FILE reading
|
||||
|
||||
* autotools: fix detection of arc4random_buf
|
||||
|
||||
* rework initial rc4 seed for PRNG as last fallback
|
||||
|
||||
* rc4: more proper implementation, simplified for clarity
|
||||
|
||||
* clarifications
|
||||
|
||||
bradh352 (20 May 2023)
|
||||
- add public release note information
|
||||
|
||||
- bump version to 1.19.1
|
||||
|
||||
GitHub (6 May 2023)
|
||||
- [Gregor Jasny brought this change]
|
||||
|
||||
test: fix warning about uninitialized memory (#515)
|
||||
|
||||
fix warning in tests
|
||||
|
||||
Fix By: Gregor Jasny (@gjasny)
|
||||
|
||||
- [lifenjoiner brought this change]
|
||||
|
||||
Turn off IPV6_V6ONLY on Windows if it is supported (#520)
|
||||
|
||||
Turn off IPV6_V6ONLY on Windows if it is supported, support for IPv4-mapped IPv6 addresses.
|
||||
|
||||
IPV6_V6ONLY refs:
|
||||
https://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses
|
||||
https://github.com/golang/go/blob/master/src/net/ipsock_posix.go
|
||||
https://en.wikipedia.org/wiki/Unix-like
|
||||
off:
|
||||
https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables
|
||||
https://man.netbsd.org/inet6.4
|
||||
https://man.freebsd.org/cgi/man.cgi?query=inet6
|
||||
https://github.com/apple-oss-distributions/xnu/blob/main/bsd/man/man4/inet6.4
|
||||
on:
|
||||
https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
|
||||
acts like off, but returns 1 and dummy setting:
|
||||
https://man.dragonflybsd.org/?command=inet6
|
||||
https://man.dragonflybsd.org/?command=ip6
|
||||
unsupported and read-only returns 1:
|
||||
https://man.openbsd.org/inet6.4
|
||||
|
||||
default value refs:
|
||||
https://datatracker.ietf.org/doc/html/rfc3493#section-5.3
|
||||
https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html#proc-sys-net-ipv6-variables
|
||||
|
||||
- [Brad House brought this change]
|
||||
|
||||
Merge pull request from GHSA-54xr-f67r-4pc4
|
||||
|
||||
* CARES_RANDOM_FILE should always default to /dev/urandom
|
||||
|
||||
During cross-compilation, CARES_RANDOM_FILE may not be able to be appropriately
|
||||
detected, therefore we should always set it to /dev/urandom and allow the
|
||||
entity requesting compilation override the value. The code does appropriately
|
||||
fall back if CARES_RANDOM_FILE cannot be opened.
|
||||
|
||||
* use set not option
|
||||
|
||||
bradh352 (18 Mar 2023)
|
||||
- ares_getaddrinfo using service of "0" should be allowed
|
||||
|
||||
As per #517 glibc allows a service/servname of "0" to be treated the
|
||||
same as if NULL was provided. Also, add a sanity check to ensure
|
||||
the port number is in range instead of a blind cast.
|
||||
|
||||
Fixes: #517
|
||||
Fix By: Brad House (@bradh352)
|
||||
|
||||
GitHub (10 Feb 2023)
|
||||
- [Nikolaos Chatzikonstantinou brought this change]
|
||||
|
||||
fix memory leak in ares_send (#511)
|
||||
|
||||
When the condition channel->nservers < 1 holds, the function returns
|
||||
prematurely, without deallocating query->tcpbuf. We rearrange the
|
||||
check to be done prior to the allocations, avoiding the memory
|
||||
leak. In this way, we also avoid unnecessary allocations if
|
||||
channel->nservers < 1 holds.
|
||||
|
||||
Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
|
||||
|
||||
- [Nikolaos Chatzikonstantinou brought this change]
|
||||
|
||||
change comment style to old-style (#513)
|
||||
|
||||
Following the README.md guidelines,
|
||||
|
||||
"Comments must be written in the old-style"
|
||||
|
||||
the comment is changed to the old style.
|
||||
|
||||
Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
|
||||
|
||||
- [Nikolaos Chatzikonstantinou brought this change]
|
||||
|
||||
use strncasecmp in ares__strsplit (#512)
|
||||
|
||||
strncasecmp on platforms that don't already have it is already #define'd to a private implementation. There is no need to have OS-specific logic. Also removes ares__strsplit.h as a header as ares_private.h already includes it.
|
||||
|
||||
Fix By: Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
|
||||
|
||||
- [Yijie Ma brought this change]
|
||||
|
||||
Fix a typo in ares_init_options.3 (#510)
|
||||
|
||||
that -> than
|
||||
|
||||
Fix By: Yijie Ma (@yijiem)
|
||||
|
||||
- [Douglas R. Reno brought this change]
|
||||
|
||||
Watcom Portability Improvements (#509)
|
||||
|
||||
- Modify the Watcom Makefile for the source code reorganization (#352)
|
||||
- Add *.map files into .gitignore
|
||||
- Fix build errors with Watcom's builtin Windows SDK (which is rather
|
||||
outdated). It's smart enough to understand Windows Vista, but doesn't
|
||||
have PMIB_UNICASTIPADDRESS_TABLE or MIB_IPFORWARD_ROW2.
|
||||
|
||||
It may be possible to use a different Windows SDK with the Watcom
|
||||
compiler, such as the most recent Windows 10 SDK. Alternatively the SDK
|
||||
in OpenWatcom 2.0 (which is in development) should fix this.
|
||||
|
||||
I have no problems testing this Makefile prior to releases, just give me
|
||||
a ping.
|
||||
|
||||
Tested with Windows Vista, Windows 7, and Windows 10 using 'adig',
|
||||
'acountry', and 'ahost'. This also seems to work on Windows XP, though
|
||||
this is likely due to the compiler in use.
|
||||
|
||||
Fix By: Douglas R. Reno (@renodr)
|
||||
Fixes Bug: #352
|
||||
|
||||
- [Jay Freeman (saurik) brought this change]
|
||||
|
||||
ignore aminclude_static.am, as generated by AX_AM_MACROS_STATIC (#508)
|
||||
|
||||
Fix By: Jay Freeman (@saurik)
|
||||
|
||||
- [Jay Freeman (saurik) brought this change]
|
||||
|
||||
sync ax_pthread.m4 with upstream (#507)
|
||||
|
||||
The version in the repository is many years old so this PR simply pulls in the latest
|
||||
available revision from:
|
||||
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4
|
||||
|
||||
Fix By: Jay Freeman (@saurik)
|
||||
|
||||
- [Chilledheart brought this change]
|
||||
|
||||
Windows: Invalid stack variable out of scope for HOSTS file path (#502)
|
||||
|
||||
In some conditions Windows might try to use a stack address that has gone out of scope when determining where to read the hosts data from for file lookups.
|
||||
|
||||
Fix By: @Chilledheart
|
||||
|
||||
- [Brad House brought this change]
|
||||
|
||||
sync ax_cxx_compile_stdcxx_11.m4 with upstream (#505)
|
||||
|
||||
It was reported that ax_cxx_compile_stdcxx_11.m4 was not compatible with uclibc.
|
||||
The version in the repository is many years old so this PR simply pulls in the latest
|
||||
available revision from:
|
||||
http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=tree;f=m4
|
||||
|
||||
Fixes Bug: #504
|
||||
Fix By: Brad House (@bradh352)
|
||||
|
||||
Version 1.19.0 (18 Jan 2023)
|
||||
|
||||
bradh352 (18 Jan 2023)
|
||||
@@ -5325,76 +5552,3 @@ Daniel Stenberg (23 Mar 2010)
|
||||
- git now, not CVS
|
||||
|
||||
- ignore lots of generated files
|
||||
|
||||
- [Daniel Johnson brought this change]
|
||||
|
||||
Fix warnings for clang
|
||||
|
||||
Yang Tse (17 Mar 2010)
|
||||
- replaced intel compiler option -no-ansi-alias with -fno-strict-aliasing
|
||||
|
||||
- update outdated serial number
|
||||
|
||||
- fix compiler warning
|
||||
|
||||
- watt32 compilation fix
|
||||
|
||||
- Added another VS10 version string
|
||||
|
||||
- fix line break
|
||||
|
||||
- removed usage of 's6_addr', fixing compilation issue triggered with no
|
||||
longer using 'in6_addr' but only our 'ares_in6_addr' struct
|
||||
|
||||
Daniel Stenberg (5 Mar 2010)
|
||||
- Daniel Johnson provided fixes for building with the clang compiler
|
||||
|
||||
Yang Tse (5 Mar 2010)
|
||||
- Added IPv6 name servers support
|
||||
|
||||
Gisle Vanem (5 Mar 2010)
|
||||
- Ops!. Readded ares_nowarn.h.
|
||||
|
||||
- Added ares_nowarn.c.
|
||||
|
||||
Yang Tse (28 Feb 2010)
|
||||
- Added SIZEOF_INT and SIZEOF_SHORT definitions for non-configure systems
|
||||
|
||||
- Added ares_nowarn.* to VC6 project file
|
||||
|
||||
- Added SIZEOF_INT definition
|
||||
|
||||
- fix compiler warning
|
||||
|
||||
- fix compiler warning
|
||||
|
||||
- fix compiler warning
|
||||
|
||||
Daniel Stenberg (17 Feb 2010)
|
||||
- ares_reinit()
|
||||
|
||||
- To allow an app to force a re-read of /etc/resolv.conf etc, pretty much
|
||||
like the res_init() resolver function offers
|
||||
|
||||
- - Tommie Gannert pointed out a silly bug in ares_process_fd() since it didn't
|
||||
check for broken connections like ares_process() did. Based on that, I
|
||||
merged the two functions into a single generic one with two front-ends.
|
||||
|
||||
Yang Tse (30 Dec 2009)
|
||||
- VMS specific preprocessor symbol checking adjustments
|
||||
|
||||
- Mention last changes
|
||||
|
||||
- - Fix configure_socket() to use ares_socket_t instead of int data type.
|
||||
|
||||
- - Where run-time error checks enabling compiler option /GZ was used it is now
|
||||
replaced with equivalent /RTCsu for Visual Studio 2003 and newer versions.
|
||||
|
||||
- Compiler option /GX is now replaced with equivalent /EHsc for all versions.
|
||||
|
||||
- - Ingmar Runge noticed that Windows config-win32.h configuration file
|
||||
did not include a definition for HAVE_CLOSESOCKET which resulted in
|
||||
function close() being inappropriately used to close sockets.
|
||||
|
||||
Daniel Stenberg (30 Nov 2009)
|
||||
- start working on 1.7.1
|
||||
Vendored
+7
-7
@@ -8,10 +8,10 @@ INCLUDE (CheckCSourceCompiles)
|
||||
INCLUDE (CheckStructHasMember)
|
||||
INCLUDE (CheckLibraryExists)
|
||||
|
||||
PROJECT (c-ares LANGUAGES C VERSION "1.19.0" )
|
||||
PROJECT (c-ares LANGUAGES C VERSION "1.19.1" )
|
||||
|
||||
# Set this version before release
|
||||
SET (CARES_VERSION "1.19.0")
|
||||
SET (CARES_VERSION "1.19.1")
|
||||
|
||||
INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are wrong.
|
||||
|
||||
@@ -26,7 +26,7 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w
|
||||
# For example, a version of 4:0:2 would generate output such as:
|
||||
# libname.so -> libname.so.2
|
||||
# libname.so.2 -> libname.so.2.2.0
|
||||
SET (CARES_LIB_VERSIONINFO "8:0:6")
|
||||
SET (CARES_LIB_VERSIONINFO "8:1:6")
|
||||
|
||||
|
||||
OPTION (CARES_STATIC "Build as a static library" OFF)
|
||||
@@ -36,6 +36,8 @@ OPTION (CARES_STATIC_PIC "Build the static library as PIC (position independent)
|
||||
OPTION (CARES_BUILD_TESTS "Build and run tests" OFF)
|
||||
OPTION (CARES_BUILD_CONTAINER_TESTS "Build and run container tests (implies CARES_BUILD_TESTS, Linux only)" OFF)
|
||||
OPTION (CARES_BUILD_TOOLS "Build tools" ON)
|
||||
SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom")
|
||||
|
||||
|
||||
# Tests require static to be enabled on Windows to be able to access otherwise hidden symbols
|
||||
IF (CARES_BUILD_TESTS AND (NOT CARES_STATIC) AND WIN32)
|
||||
@@ -391,6 +393,8 @@ CHECK_SYMBOL_EXISTS (strncasecmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCAS
|
||||
CHECK_SYMBOL_EXISTS (strncmpi "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCMPI)
|
||||
CHECK_SYMBOL_EXISTS (strnicmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNICMP)
|
||||
CHECK_SYMBOL_EXISTS (writev "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_WRITEV)
|
||||
CHECK_SYMBOL_EXISTS (arc4random_buf "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_ARC4RANDOM_BUF)
|
||||
|
||||
|
||||
# On Android, the system headers may define __system_property_get(), but excluded
|
||||
# from libc. We need to perform a link test instead of a header/symbol test.
|
||||
@@ -402,10 +406,6 @@ SET (CMAKE_REQUIRED_DEFINITIONS)
|
||||
SET (CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
|
||||
find_file(CARES_RANDOM_FILE urandom /dev)
|
||||
mark_as_advanced(CARES_RANDOM_FILE)
|
||||
|
||||
|
||||
################################################################################
|
||||
# recv, recvfrom, send, getnameinfo, gethostname
|
||||
# ARGUMENTS AND RETURN VALUES
|
||||
|
||||
Vendored
+29
-21
@@ -1,6 +1,7 @@
|
||||
#
|
||||
# Watcom / OpenWatcom / Win32 makefile for cares.
|
||||
# Quick hack by Guenter; comments to: /dev/nul
|
||||
# Updated by Douglas R. Reno, comments to: renodr2002@gmail.com. 2023
|
||||
#
|
||||
|
||||
!ifndef %watcom
|
||||
@@ -38,9 +39,9 @@ MD = mkdir
|
||||
RD = rmdir /q /s 2>NUL
|
||||
CP = copy
|
||||
|
||||
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
|
||||
-wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY &
|
||||
-dNTDDI_VERSION=0x05010000 -I. $(SYS_INCL)
|
||||
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm -aa &
|
||||
-wcd=201 -bt=nt -d+ -dWIN32 -dCARES_BUILDING_LIBRARY &
|
||||
-dNTDDI_VERSION=0x06000000 -I. -I.\include -I.\src\lib $(SYS_INCL)
|
||||
|
||||
LFLAGS = option quiet, map, caseexact, eliminate
|
||||
|
||||
@@ -69,7 +70,7 @@ LIB_ARG = $(OBJ_BASE)\stat\wlib.arg
|
||||
!ifneq __MAKEOPTS__ -u
|
||||
!error You MUST call wmake with the -u switch!
|
||||
!else
|
||||
!include Makefile.inc
|
||||
!include src\lib\Makefile.inc
|
||||
!endif
|
||||
|
||||
OBJS = $(CSOURCES:.c=.obj)
|
||||
@@ -82,10 +83,11 @@ OBJ_DIR = $(OBJ_BASE)\stat
|
||||
OBJS_STAT = $+ $(OBJS) $-
|
||||
|
||||
OBJ_DIR = $(OBJ_BASE)\dyn
|
||||
OBJS_DYN = $+ $(OBJS) $-
|
||||
OBJS_DYN += $(OBJS) $-
|
||||
|
||||
ARESBUILDH = ares_build.h
|
||||
RESOURCE = $(OBJ_BASE)\dyn\cares.res
|
||||
ARESBUILDH = include\ares_build.h
|
||||
|
||||
all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) $(DEMOS) .SYMBOLIC
|
||||
@echo Welcome to cares
|
||||
@@ -94,10 +96,10 @@ $(OBJ_BASE):
|
||||
-$(MD) $^@
|
||||
-$(MD) $^@\stat
|
||||
-$(MD) $^@\dyn
|
||||
-$(MD) $^@\demos
|
||||
-$(MD) $^@\tools
|
||||
|
||||
$(ARESBUILDH): .EXISTSONLY
|
||||
$(CP) $^@.dist $^@
|
||||
@echo Make sure to run buildconf.bat!
|
||||
|
||||
$(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(LINK_ARG)
|
||||
$(LD) name $^@ @$]@
|
||||
@@ -105,14 +107,20 @@ $(LIBNAME).dll: $(OBJS_DYN) $(RESOURCE) $(LINK_ARG)
|
||||
$(LIBNAME).lib: $(OBJS_STAT) $(LIB_ARG)
|
||||
$(AR) -q -b -c $^@ @$]@
|
||||
|
||||
adig.exe: $(OBJ_BASE)\demos\adig.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
|
||||
$(OBJ_BASE)\tools\ares_getopt.obj:
|
||||
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\tools\ares_getopt.c -fo=$^@
|
||||
|
||||
ahost.exe: $(OBJ_BASE)\demos\ahost.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
|
||||
adig.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib
|
||||
$(CC) $(CFLAGS) src\tools\adig.c -fo=$(OBJ_BASE)\tools\adig.obj
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\adig.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib
|
||||
|
||||
acountry.exe: $(OBJ_BASE)\demos\acountry.obj $(OBJ_BASE)\demos\ares_getopt.obj $(LIBNAME).lib
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\demos\ares_getopt.obj $[@ } library $]@, ws2_32.lib
|
||||
ahost.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib
|
||||
$(CC) $(CFLAGS) src\tools\ahost.c -fo=$(OBJ_BASE)\tools\ahost.obj
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\ahost.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib
|
||||
|
||||
acountry.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib
|
||||
$(CC) $(CFLAGS) src\tools\acountry.c -fo=$(OBJ_BASE)\tools\acountry.obj
|
||||
$(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\acountry.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib
|
||||
|
||||
clean: .SYMBOLIC
|
||||
-$(RM) $(OBJS_STAT)
|
||||
@@ -124,24 +132,23 @@ vclean realclean: clean .SYMBOLIC
|
||||
-$(RM) $(DEMOS) $(DEMOS:.exe=.map)
|
||||
-$(RD) $(OBJ_BASE)\stat
|
||||
-$(RD) $(OBJ_BASE)\dyn
|
||||
-$(RD) $(OBJ_BASE)\demos
|
||||
-$(RD) $(OBJ_BASE)\tools
|
||||
-$(RD) $(OBJ_BASE)
|
||||
|
||||
.ERASE
|
||||
$(RESOURCE): cares.rc .AUTODEPEND
|
||||
.c: .\src\lib
|
||||
|
||||
.ERASE
|
||||
$(RESOURCE): src\lib\cares.rc .AUTODEPEND
|
||||
$(RC) $(DEBUG) -q -r -zm -I..\include $(SYS_INCL) $[@ -fo=$^@
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_BASE)\dyn}.obj:
|
||||
$(CC) $(CFLAGS) -bd $[@ -fo=$^@
|
||||
$(CC) $(CFLAGS) -bd .\src\lib\$^& -fo=$^@
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_BASE)\stat}.obj:
|
||||
$(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_BASE)\demos}.obj:
|
||||
$(CC) $(CFLAGS) -DCARES_STATICLIB $[@ -fo=$^@
|
||||
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\$^& -fo=$^@
|
||||
|
||||
$(LINK_ARG): $(__MAKEFILES__)
|
||||
%create $^@
|
||||
@@ -155,6 +162,7 @@ $(LINK_ARG): $(__MAKEFILES__)
|
||||
@%append $^@ library $(%watt_root)\lib\wattcpw_imp.lib
|
||||
!else
|
||||
@%append $^@ library ws2_32.lib
|
||||
@%append $^@ library iphlpapi.lib
|
||||
!endif
|
||||
|
||||
$(LIB_ARG): $(__MAKEFILES__)
|
||||
|
||||
Vendored
+1
@@ -96,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
|
||||
$(top_srcdir)/m4/ax_am_macros_static.m4 \
|
||||
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
|
||||
$(top_srcdir)/m4/ax_code_coverage.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
|
||||
$(top_srcdir)/m4/ax_file_escapes.m4 \
|
||||
$(top_srcdir)/m4/ax_require_defined.m4 \
|
||||
|
||||
Vendored
+44
-78
@@ -1,91 +1,57 @@
|
||||
c-ares version 1.19.0
|
||||
c-ares version 1.19.1
|
||||
|
||||
This is a feature and bugfix release. It addresses a couple of new feature
|
||||
requests as well as a couple of bug fixes.
|
||||
This is a security and bugfix release.
|
||||
|
||||
A special thanks goes out to the Open Source Technology Improvement Fund
|
||||
(https://ostif.org) for sponsoring a security audit of c-ares performed by X41
|
||||
(https://x41-dsec.de).
|
||||
|
||||
Security:
|
||||
o Low. Stack overflow in ares_set_sortlist() which is used during c-ares
|
||||
initialization and typically provided by an administrator and not an
|
||||
end user. [24]
|
||||
|
||||
Changes:
|
||||
o Windows: Drop support for XP and derivatives which greatly cleans up
|
||||
initialization code. [3]
|
||||
o Add ARES_OPT_HOSTS_FILE similar to ARES_OPT_RESOLVCONF for specifying a
|
||||
custom hosts file location. [10]
|
||||
o Add vcpkg installation instructions [13]
|
||||
o CVE-2023-32067. High. 0-byte UDP payload causes Denial of Service [12]
|
||||
o CVE-2023-31147. Moderate. Insufficient randomness in generation of DNS
|
||||
query IDs [13]
|
||||
o CVE-2023-31130. Moderate. Buffer Underwrite in ares_inet_net_pton() [14]
|
||||
o CVE-2023-31124. Low. AutoTools does not set CARES_RANDOM_FILE during cross
|
||||
compilation [15]
|
||||
|
||||
Bug fixes:
|
||||
o Fix cross-compilation from Windows to Linux due to CPACK logic. [1]
|
||||
o Fix memory leak in reading /etc/hosts when using localhost fallback. [2]
|
||||
o Fix chain building c-ares when libresolv is already included by another
|
||||
project [4]
|
||||
o File lookup should not immediately abort as there may be other tries due to
|
||||
search criteria.
|
||||
o Asterisks should be allowed in host validation as CNAMEs may reference
|
||||
wildcard domains [5]
|
||||
o AutoTools build system referenced bad STDC_HEADERS macro [6]
|
||||
o Even if one address class returns a failure for ares_getaddrinfo() we should
|
||||
still return the results we have
|
||||
o CMake Windows: DLLs did not include resource file to include versions [7] [8]
|
||||
o CMake: Guard target creation in exported config [9]
|
||||
o Fix ares_getaddrinfo() numerical address resolution with AF_UNSPEC [11]
|
||||
o Apple: fix libresolv configured query times. [12]
|
||||
o Fix tools and help information [14] [15]
|
||||
o Various documentation fixes and cleanups [16] [22] [25]
|
||||
o Add include guards to ares_data.h [17]
|
||||
o c-ares could try to exceed maximum number of iovec entries supported by
|
||||
system [18]
|
||||
o CMake package config generation allow for absolute install paths [19]
|
||||
o Intel compiler fixes [20]
|
||||
o ares_strsplit bugs [21] [23]
|
||||
o The RFC6761 6.3 states localhost subdomains must be offline too. [26]
|
||||
o Fix uninitialized memory warning in test [1]
|
||||
o Turn off IPV6_V6ONLY on Windows to allow IPv4-mapped IPv6 addresses [2]
|
||||
o ares_getaddrinfo() should allow a port of 0 [3]
|
||||
o Fix memory leak in ares_send() on error [4]
|
||||
o Fix comment style in ares_data.h [5]
|
||||
o Remove unneeded ifdef for Windows [6]
|
||||
o Fix typo in ares_init_options.3 [7]
|
||||
o Re-add support for Watcom compiler [8]
|
||||
o Sync ax_pthread.m4 with upstream [9]
|
||||
o Windows: Invalid stack variable used out of scope for HOSTS path [10]
|
||||
o Sync ax_cxx_compile_stdcxx_11.m4 with upstream to fix uclibc support [11]
|
||||
|
||||
Thanks go to these friendly people for their efforts and contributions:
|
||||
Boby Reynolds (@reynoldsbd)
|
||||
Brad House (@bradh352)
|
||||
Brad Spencer (@b-spencer)
|
||||
@bsergean
|
||||
@Chilledheart
|
||||
Daniel Stenberg (@bagder)
|
||||
Dmitry Karpov
|
||||
@FrankXie05
|
||||
@hopper-vul
|
||||
Jonathan Ringer (@jonringer)
|
||||
Kai Pastor (@dg0yt)
|
||||
Douglas R. Reno (@renodr)
|
||||
Gregor Jasny (@gjasny)
|
||||
Jay Freeman (@saurik)
|
||||
@lifenjoiner
|
||||
Manish Mehra (@mmehra)
|
||||
@marc-groundctl
|
||||
Nikolaos Chatzikonstantinou (@createyourpersonalaccount)
|
||||
Ridge Kennedy (@ridgek)
|
||||
Sam James (@thesamesam)
|
||||
Stephen Sachs (@stephenmsachs)
|
||||
Thomas Dreibholz (@dreibh)
|
||||
(18 contributors)
|
||||
Yijie Ma (@yijiem)
|
||||
(9 contributors)
|
||||
|
||||
References to bug reports and discussions on issues:
|
||||
[1] = https://github.com/c-ares/c-ares/pull/436
|
||||
[2] = https://github.com/c-ares/c-ares/issues/439
|
||||
[3] = https://github.com/c-ares/c-ares/pull/445
|
||||
[4] = https://github.com/c-ares/c-ares/pull/451
|
||||
[5] = https://github.com/c-ares/c-ares/issues/457
|
||||
[6] = https://github.com/c-ares/c-ares/pull/459
|
||||
[7] = https://github.com/c-ares/c-ares/issues/460
|
||||
[8] = https://github.com/c-ares/c-ares/pull/468
|
||||
[9] = https://github.com/c-ares/c-ares/pull/464
|
||||
[10] = https://github.com/c-ares/c-ares/pull/465
|
||||
[11] = https://github.com/c-ares/c-ares/pull/469
|
||||
[12] = https://github.com/c-ares/c-ares/pull/467
|
||||
[13] = https://github.com/c-ares/c-ares/pull/478
|
||||
[14] = https://github.com/c-ares/c-ares/pull/479
|
||||
[15] = https://github.com/c-ares/c-ares/pull/481
|
||||
[16] = https://github.com/c-ares/c-ares/pull/490
|
||||
[17] = https://github.com/c-ares/c-ares/pull/491
|
||||
[18] = https://github.com/c-ares/c-ares/pull/489
|
||||
[19] = https://github.com/c-ares/c-ares/pull/486
|
||||
[20] = https://github.com/c-ares/c-ares/pull/485
|
||||
[21] = https://github.com/c-ares/c-ares/pull/492
|
||||
[22] = https://github.com/c-ares/c-ares/pull/494
|
||||
[23] = https://github.com/c-ares/c-ares/pull/495
|
||||
[24] = https://github.com/c-ares/c-ares/pull/497
|
||||
[25] = https://github.com/c-ares/c-ares/issues/487
|
||||
[26] = https://github.com/c-ares/c-ares/issues/477
|
||||
[1] = https://github.com/c-ares/c-ares/pull/515
|
||||
[2] = https://github.com/c-ares/c-ares/pull/520
|
||||
[3] = https://github.com/c-ares/c-ares/issues/517
|
||||
[4] = https://github.com/c-ares/c-ares/pull/511
|
||||
[5] = https://github.com/c-ares/c-ares/pull/513
|
||||
[6] = https://github.com/c-ares/c-ares/pull/512
|
||||
[7] = https://github.com/c-ares/c-ares/pull/510
|
||||
[8] = https://github.com/c-ares/c-ares/pull/509
|
||||
[9] = https://github.com/c-ares/c-ares/pull/507
|
||||
[10] = https://github.com/c-ares/c-ares/pull/502
|
||||
[11] = https://github.com/c-ares/c-ares/pull/505
|
||||
[12] = https://github.com/c-ares/c-ares/security/advisories/GHSA-9g78-jv2r-p7vc
|
||||
[13] = https://github.com/c-ares/c-ares/security/advisories/GHSA-8r8p-23f3-64c2
|
||||
[14] = https://github.com/c-ares/c-ares/security/advisories/GHSA-x6mf-cxr9-8q6v
|
||||
[15] = https://github.com/c-ares/c-ares/security/advisories/GHSA-54xr-f67r-4pc4
|
||||
Vendored
+1
@@ -1190,6 +1190,7 @@ m4_include([m4/ax_add_am_macro_static.m4])
|
||||
m4_include([m4/ax_am_macros_static.m4])
|
||||
m4_include([m4/ax_check_gnu_make.m4])
|
||||
m4_include([m4/ax_code_coverage.m4])
|
||||
m4_include([m4/ax_cxx_compile_stdcxx.m4])
|
||||
m4_include([m4/ax_cxx_compile_stdcxx_11.m4])
|
||||
m4_include([m4/ax_file_escapes.m4])
|
||||
m4_include([m4/ax_require_defined.m4])
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
|
||||
# aminclude_static.am generated automatically by Autoconf
|
||||
# from AX_AM_MACROS_STATIC on Sat Jan 28 22:07:59 CET 2023
|
||||
# from AX_AM_MACROS_STATIC on Mon May 22 14:23:05 CEST 2023
|
||||
|
||||
|
||||
# Code coverage
|
||||
|
||||
Vendored
+92
-83
@@ -1,4 +1,94 @@
|
||||
{
|
||||
'variables': {
|
||||
'cares_sources_common': [
|
||||
'include/ares.h',
|
||||
'include/ares_dns.h',
|
||||
'include/ares_nameser.h',
|
||||
'include/ares_rules.h',
|
||||
'include/ares_version.h',
|
||||
'src/lib/ares__addrinfo2hostent.c',
|
||||
'src/lib/ares__addrinfo_localhost.c',
|
||||
'src/lib/ares_android.c',
|
||||
'src/lib/ares_cancel.c',
|
||||
'src/lib/ares__close_sockets.c',
|
||||
'src/lib/ares_create_query.c',
|
||||
'src/lib/ares_data.c',
|
||||
'src/lib/ares_data.h',
|
||||
'src/lib/ares_destroy.c',
|
||||
'src/lib/ares_expand_name.c',
|
||||
'src/lib/ares_expand_string.c',
|
||||
'src/lib/ares_fds.c',
|
||||
'src/lib/ares_free_hostent.c',
|
||||
'src/lib/ares_free_string.c',
|
||||
'src/lib/ares_freeaddrinfo.c',
|
||||
'src/lib/ares_getenv.h',
|
||||
'src/lib/ares_getaddrinfo.c',
|
||||
'src/lib/ares_gethostbyaddr.c',
|
||||
'src/lib/ares_gethostbyname.c',
|
||||
'src/lib/ares__get_hostent.c',
|
||||
'src/lib/ares_getnameinfo.c',
|
||||
'src/lib/ares_getsock.c',
|
||||
'src/lib/ares_init.c',
|
||||
'src/lib/ares_ipv6.h',
|
||||
'src/lib/ares_library_init.c',
|
||||
'src/lib/ares_llist.c',
|
||||
'src/lib/ares_llist.h',
|
||||
'src/lib/ares_mkquery.c',
|
||||
'src/lib/ares_nowarn.c',
|
||||
'src/lib/ares_nowarn.h',
|
||||
'src/lib/ares_options.c',
|
||||
'src/lib/ares__parse_into_addrinfo.c',
|
||||
'src/lib/ares_parse_aaaa_reply.c',
|
||||
'src/lib/ares_parse_a_reply.c',
|
||||
'src/lib/ares_parse_caa_reply.c',
|
||||
'src/lib/ares_parse_mx_reply.c',
|
||||
'src/lib/ares_parse_naptr_reply.c',
|
||||
'src/lib/ares_parse_ns_reply.c',
|
||||
'src/lib/ares_parse_ptr_reply.c',
|
||||
'src/lib/ares_parse_soa_reply.c',
|
||||
'src/lib/ares_parse_srv_reply.c',
|
||||
'src/lib/ares_parse_txt_reply.c',
|
||||
'src/lib/ares_parse_uri_reply.c',
|
||||
'src/lib/ares_platform.h',
|
||||
'src/lib/ares_private.h',
|
||||
'src/lib/ares_process.c',
|
||||
'src/lib/ares_query.c',
|
||||
'src/lib/ares_rand.c',
|
||||
'src/lib/ares__read_line.c',
|
||||
'src/lib/ares__readaddrinfo.c',
|
||||
'src/lib/ares_search.c',
|
||||
'src/lib/ares_send.c',
|
||||
'src/lib/ares_setup.h',
|
||||
'src/lib/ares__sortaddrinfo.c',
|
||||
'src/lib/ares_strcasecmp.c',
|
||||
'src/lib/ares_strcasecmp.h',
|
||||
'src/lib/ares_strdup.c',
|
||||
'src/lib/ares_strdup.h',
|
||||
'src/lib/ares_strerror.c',
|
||||
'src/lib/ares_strsplit.c',
|
||||
'src/lib/ares_timeout.c',
|
||||
'src/lib/ares__timeval.c',
|
||||
'src/lib/ares_version.c',
|
||||
'src/lib/ares_writev.c',
|
||||
'src/lib/ares_writev.h',
|
||||
'src/lib/bitncmp.c',
|
||||
'src/lib/bitncmp.h',
|
||||
'src/lib/inet_net_pton.c',
|
||||
'src/lib/inet_ntop.c',
|
||||
'src/lib/ares_inet_net_pton.h',
|
||||
'src/lib/setup_once.h',
|
||||
'src/tools/ares_getopt.c',
|
||||
'src/tools/ares_getopt.h',
|
||||
],
|
||||
'cares_sources_win': [
|
||||
'src/lib/config-win32.h',
|
||||
'src/lib/windows_port.c',
|
||||
'src/lib/ares_getenv.c',
|
||||
'src/lib/ares_iphlpapi.h',
|
||||
'src/lib/ares_platform.c',
|
||||
],
|
||||
},
|
||||
|
||||
'target_defaults': {
|
||||
'conditions': [
|
||||
['OS!="win"', {
|
||||
@@ -35,84 +125,7 @@
|
||||
'include_dirs': [ 'include' ]
|
||||
},
|
||||
'sources': [
|
||||
'include/ares.h',
|
||||
'include/ares_dns.h',
|
||||
'include/ares_nameser.h',
|
||||
'include/ares_rules.h',
|
||||
'include/ares_version.h',
|
||||
'src/lib/ares__addrinfo2hostent.c',
|
||||
'src/lib/ares__addrinfo_localhost.c',
|
||||
'src/lib/ares_android.c',
|
||||
'src/lib/ares_cancel.c',
|
||||
'src/lib/ares__close_sockets.c',
|
||||
'src/lib/ares_create_query.c',
|
||||
'src/lib/ares_data.c',
|
||||
'src/lib/ares_data.h',
|
||||
'src/lib/ares_destroy.c',
|
||||
'src/lib/ares_expand_name.c',
|
||||
'src/lib/ares_expand_string.c',
|
||||
'src/lib/ares_fds.c',
|
||||
'src/lib/ares_free_hostent.c',
|
||||
'src/lib/ares_free_string.c',
|
||||
'src/lib/ares_freeaddrinfo.c',
|
||||
'src/lib/ares_getenv.h',
|
||||
'src/lib/ares_getaddrinfo.c',
|
||||
'src/lib/ares_gethostbyaddr.c',
|
||||
'src/lib/ares_gethostbyname.c',
|
||||
'src/lib/ares__get_hostent.c',
|
||||
'src/lib/ares_getnameinfo.c',
|
||||
'src/lib/ares_getsock.c',
|
||||
'src/lib/ares_init.c',
|
||||
'src/lib/ares_ipv6.h',
|
||||
'src/lib/ares_library_init.c',
|
||||
'src/lib/ares_library_init.h',
|
||||
'src/lib/ares_llist.c',
|
||||
'src/lib/ares_llist.h',
|
||||
'src/lib/ares_mkquery.c',
|
||||
'src/lib/ares_nowarn.c',
|
||||
'src/lib/ares_nowarn.h',
|
||||
'src/lib/ares_options.c',
|
||||
'src/lib/ares__parse_into_addrinfo.c',
|
||||
'src/lib/ares_parse_aaaa_reply.c',
|
||||
'src/lib/ares_parse_a_reply.c',
|
||||
'src/lib/ares_parse_caa_reply.c',
|
||||
'src/lib/ares_parse_mx_reply.c',
|
||||
'src/lib/ares_parse_naptr_reply.c',
|
||||
'src/lib/ares_parse_ns_reply.c',
|
||||
'src/lib/ares_parse_ptr_reply.c',
|
||||
'src/lib/ares_parse_soa_reply.c',
|
||||
'src/lib/ares_parse_srv_reply.c',
|
||||
'src/lib/ares_parse_txt_reply.c',
|
||||
'src/lib/ares_parse_uri_reply.c',
|
||||
'src/lib/ares_platform.h',
|
||||
'src/lib/ares_private.h',
|
||||
'src/lib/ares_process.c',
|
||||
'src/lib/ares_query.c',
|
||||
'src/lib/ares__read_line.c',
|
||||
'src/lib/ares__readaddrinfo.c',
|
||||
'src/lib/ares_search.c',
|
||||
'src/lib/ares_send.c',
|
||||
'src/lib/ares_setup.h',
|
||||
'src/lib/ares__sortaddrinfo.c',
|
||||
'src/lib/ares_strcasecmp.c',
|
||||
'src/lib/ares_strcasecmp.h',
|
||||
'src/lib/ares_strdup.c',
|
||||
'src/lib/ares_strdup.h',
|
||||
'src/lib/ares_strerror.c',
|
||||
'src/lib/ares_strsplit.c',
|
||||
'src/lib/ares_timeout.c',
|
||||
'src/lib/ares__timeval.c',
|
||||
'src/lib/ares_version.c',
|
||||
'src/lib/ares_writev.c',
|
||||
'src/lib/ares_writev.h',
|
||||
'src/lib/bitncmp.c',
|
||||
'src/lib/bitncmp.h',
|
||||
'src/lib/inet_net_pton.c',
|
||||
'src/lib/inet_ntop.c',
|
||||
'src/lib/ares_inet_net_pton.h',
|
||||
'src/lib/setup_once.h',
|
||||
'src/tools/ares_getopt.c',
|
||||
'src/tools/ares_getopt.h',
|
||||
'<@(cares_sources_common)',
|
||||
],
|
||||
'conditions': [
|
||||
[ 'library=="static_library"', {
|
||||
@@ -127,11 +140,7 @@
|
||||
],
|
||||
'include_dirs': [ 'config/win32' ],
|
||||
'sources': [
|
||||
'src/lib/config-win32.h',
|
||||
'src/lib/windows_port.c',
|
||||
'src/lib/ares_getenv.c',
|
||||
'src/lib/ares_iphlpapi.h',
|
||||
'src/lib/ares_platform.c'
|
||||
'<@(cares_sources_win)',
|
||||
],
|
||||
'libraries': [
|
||||
'-lws2_32.lib',
|
||||
|
||||
Vendored
+472
-158
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.71 for c-ares 1.19.0.
|
||||
# Generated by GNU Autoconf 2.71 for c-ares 1.19.1.
|
||||
#
|
||||
# Report bugs to <c-ares mailing list: http://lists.haxx.se/listinfo/c-ares>.
|
||||
#
|
||||
@@ -855,8 +855,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='c-ares'
|
||||
PACKAGE_TARNAME='c-ares'
|
||||
PACKAGE_VERSION='1.19.0'
|
||||
PACKAGE_STRING='c-ares 1.19.0'
|
||||
PACKAGE_VERSION='1.19.1'
|
||||
PACKAGE_STRING='c-ares 1.19.1'
|
||||
PACKAGE_BUGREPORT='c-ares mailing list: http://lists.haxx.se/listinfo/c-ares'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -1650,7 +1650,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures c-ares 1.19.0 to adapt to many kinds of systems.
|
||||
\`configure' configures c-ares 1.19.1 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1721,7 +1721,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of c-ares 1.19.0:";;
|
||||
short | recursive ) echo "Configuration of c-ares 1.19.1:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1861,7 +1861,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
c-ares configure 1.19.0
|
||||
c-ares configure 1.19.1
|
||||
generated by GNU Autoconf 2.71
|
||||
|
||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
@@ -2453,7 +2453,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by c-ares $as_me 1.19.0, which was
|
||||
It was created by c-ares $as_me 1.19.1, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
@@ -3426,7 +3426,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
CARES_VERSION_INFO="8:0:6"
|
||||
CARES_VERSION_INFO="8:1:6"
|
||||
|
||||
|
||||
|
||||
@@ -6301,145 +6301,324 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
|
||||
ax_cxx_compile_cxx11_required=false
|
||||
ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=false
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
ac_success=no
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features by default" >&5
|
||||
printf %s "checking whether $CXX supports C++11 features by default... " >&6; }
|
||||
if test ${ax_cv_cxx_compile_cxx11+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
struct Base {
|
||||
virtual void f() {}
|
||||
};
|
||||
struct Child : public Base {
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
|
||||
typedef check<int> check_type;
|
||||
check_type c;
|
||||
check_type&& cr = static_cast<check_type&&>(c);
|
||||
|
||||
auto d = a;
|
||||
auto l = [](){};
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
|
||||
namespace test_template_alias_sfinae {
|
||||
struct foo {};
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() {
|
||||
func<foo>(0);
|
||||
}
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"
|
||||
then :
|
||||
ax_cv_cxx_compile_cxx11=yes
|
||||
else $as_nop
|
||||
ax_cv_cxx_compile_cxx11=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_cxx_compile_cxx11" >&5
|
||||
printf "%s\n" "$ax_cv_cxx_compile_cxx11" >&6; }
|
||||
if test x$ax_cv_cxx_compile_cxx11 = xyes; then
|
||||
ac_success=yes
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test x$ac_success = xno; then
|
||||
for switch in -std=c++11 -std=c++0x; do
|
||||
cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
|
||||
for alternative in ${ax_cxx_compile_alternatives}; do
|
||||
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
|
||||
cachevar=`printf "%s\n" "ax_cv_cxx_compile_cxx11_$switch" | $as_tr_sh`
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports C++11 features with $switch" >&5
|
||||
printf %s "checking whether $CXX supports C++11 features with $switch... " >&6; }
|
||||
if eval test \${$cachevar+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
ac_save_CXX="$CXX"
|
||||
CXX="$CXX $switch"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
template <typename T>
|
||||
|
||||
// If the compiler admits that it is not ready for C++11, why torture it?
|
||||
// Hopefully, this will speed up the test.
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
// MSVC always sets __cplusplus to 199711L in older versions; newer versions
|
||||
// only set it correctly if /Zc:__cplusplus is specified as well as a
|
||||
// /std:c++NN switch:
|
||||
// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
|
||||
#elif __cplusplus < 201103L && !defined _MSC_VER
|
||||
|
||||
#error "This is not a C++11 compiler"
|
||||
|
||||
#else
|
||||
|
||||
namespace cxx11
|
||||
{
|
||||
|
||||
namespace test_static_assert
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
struct Base {
|
||||
virtual void f() {}
|
||||
};
|
||||
struct Child : public Base {
|
||||
virtual void f() override {}
|
||||
}
|
||||
|
||||
namespace test_final_override
|
||||
{
|
||||
|
||||
struct Base
|
||||
{
|
||||
virtual ~Base() {}
|
||||
virtual void f() {}
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
struct Derived : public Base
|
||||
{
|
||||
virtual ~Derived() override {}
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
}
|
||||
|
||||
typedef check<int> check_type;
|
||||
check_type c;
|
||||
check_type&& cr = static_cast<check_type&&>(c);
|
||||
namespace test_double_right_angle_brackets
|
||||
{
|
||||
|
||||
auto d = a;
|
||||
auto l = [](){};
|
||||
template < typename T >
|
||||
struct check {};
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
|
||||
namespace test_template_alias_sfinae {
|
||||
struct foo {};
|
||||
typedef check<void> single_type;
|
||||
typedef check<check<void>> double_type;
|
||||
typedef check<check<check<void>>> triple_type;
|
||||
typedef check<check<check<check<void>>>> quadruple_type;
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
namespace test_decltype
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() {
|
||||
func<foo>(0);
|
||||
}
|
||||
int
|
||||
f()
|
||||
{
|
||||
int a = 1;
|
||||
decltype(a) b = 2;
|
||||
return a + b;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_type_deduction
|
||||
{
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
struct is_same
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct is_same<T, T>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
auto
|
||||
add(T1 a1, T2 a2) -> decltype(a1 + a2)
|
||||
{
|
||||
return a1 + a2;
|
||||
}
|
||||
|
||||
int
|
||||
test(const int c, volatile int v)
|
||||
{
|
||||
static_assert(is_same<int, decltype(0)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(c)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(v)>::value == false, "");
|
||||
auto ac = c;
|
||||
auto av = v;
|
||||
auto sumi = ac + av + 'x';
|
||||
auto sumf = ac + av + 1.0;
|
||||
static_assert(is_same<int, decltype(ac)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(av)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumi)>::value == true, "");
|
||||
static_assert(is_same<int, decltype(sumf)>::value == false, "");
|
||||
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
|
||||
return (sumf > 0.0) ? sumi : add(c, v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_noexcept
|
||||
{
|
||||
|
||||
int f() { return 0; }
|
||||
int g() noexcept { return 0; }
|
||||
|
||||
static_assert(noexcept(f()) == false, "");
|
||||
static_assert(noexcept(g()) == true, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_constexpr
|
||||
{
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
|
||||
{
|
||||
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
|
||||
}
|
||||
|
||||
template < typename CharT >
|
||||
unsigned long constexpr
|
||||
strlen_c(const CharT *const s) noexcept
|
||||
{
|
||||
return strlen_c_r(s, 0UL);
|
||||
}
|
||||
|
||||
static_assert(strlen_c("") == 0UL, "");
|
||||
static_assert(strlen_c("1") == 1UL, "");
|
||||
static_assert(strlen_c("example") == 7UL, "");
|
||||
static_assert(strlen_c("another\0example") == 7UL, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_rvalue_references
|
||||
{
|
||||
|
||||
template < int N >
|
||||
struct answer
|
||||
{
|
||||
static constexpr int value = N;
|
||||
};
|
||||
|
||||
answer<1> f(int&) { return answer<1>(); }
|
||||
answer<2> f(const int&) { return answer<2>(); }
|
||||
answer<3> f(int&&) { return answer<3>(); }
|
||||
|
||||
void
|
||||
test()
|
||||
{
|
||||
int i = 0;
|
||||
const int c = 0;
|
||||
static_assert(decltype(f(i))::value == 1, "");
|
||||
static_assert(decltype(f(c))::value == 2, "");
|
||||
static_assert(decltype(f(0))::value == 3, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_uniform_initialization
|
||||
{
|
||||
|
||||
struct test
|
||||
{
|
||||
static const int zero {};
|
||||
static const int one {1};
|
||||
};
|
||||
|
||||
static_assert(test::zero == 0, "");
|
||||
static_assert(test::one == 1, "");
|
||||
|
||||
}
|
||||
|
||||
namespace test_lambdas
|
||||
{
|
||||
|
||||
void
|
||||
test1()
|
||||
{
|
||||
auto lambda1 = [](){};
|
||||
auto lambda2 = lambda1;
|
||||
lambda1();
|
||||
lambda2();
|
||||
}
|
||||
|
||||
int
|
||||
test2()
|
||||
{
|
||||
auto a = [](int i, int j){ return i + j; }(1, 2);
|
||||
auto b = []() -> int { return '0'; }();
|
||||
auto c = [=](){ return a + b; }();
|
||||
auto d = [&](){ return c; }();
|
||||
auto e = [a, &b](int x) mutable {
|
||||
const auto identity = [](int y){ return y; };
|
||||
for (auto i = 0; i < a; ++i)
|
||||
a += b--;
|
||||
return x + identity(a + b);
|
||||
}(0);
|
||||
return a + b + c + d + e;
|
||||
}
|
||||
|
||||
int
|
||||
test3()
|
||||
{
|
||||
const auto nullary = [](){ return 0; };
|
||||
const auto unary = [](int x){ return x; };
|
||||
using nullary_t = decltype(nullary);
|
||||
using unary_t = decltype(unary);
|
||||
const auto higher1st = [](nullary_t f){ return f(); };
|
||||
const auto higher2nd = [unary](nullary_t f1){
|
||||
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
|
||||
};
|
||||
return higher1st(nullary) + higher2nd(nullary)(unary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace test_variadic_templates
|
||||
{
|
||||
|
||||
template <int...>
|
||||
struct sum;
|
||||
|
||||
template <int N0, int... N1toN>
|
||||
struct sum<N0, N1toN...>
|
||||
{
|
||||
static constexpr auto value = N0 + sum<N1toN...>::value;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct sum<>
|
||||
{
|
||||
static constexpr auto value = 0;
|
||||
};
|
||||
|
||||
static_assert(sum<>::value == 0, "");
|
||||
static_assert(sum<1>::value == 1, "");
|
||||
static_assert(sum<23>::value == 23, "");
|
||||
static_assert(sum<1, 2>::value == 3, "");
|
||||
static_assert(sum<5, 5, 11>::value == 21, "");
|
||||
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
|
||||
|
||||
}
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
|
||||
// because of this.
|
||||
namespace test_template_alias_sfinae
|
||||
{
|
||||
|
||||
struct foo {};
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() { func<foo>(0); }
|
||||
|
||||
}
|
||||
|
||||
} // namespace cxx11
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
|
||||
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"
|
||||
then :
|
||||
@@ -6448,14 +6627,21 @@ else $as_nop
|
||||
eval $cachevar=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
CXX="$ac_save_CXX"
|
||||
fi
|
||||
eval ac_res=\$$cachevar
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
printf "%s\n" "$ac_res" >&6; }
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
ac_success=yes
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXX="$CXX $switch"
|
||||
if test -n "$CXXCPP" ; then
|
||||
CXXCPP="$CXXCPP $switch"
|
||||
fi
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test x$ac_success = xyes; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -6470,22 +6656,20 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
if test x$ac_success = xno; then
|
||||
as_fn_error $? "*** A compiler with support for C++11 language features is required." "$LINENO" 5
|
||||
fi
|
||||
else
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX11=0
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5
|
||||
fi
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX11=0
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: No compiler with C++11 support was found" >&5
|
||||
printf "%s\n" "$as_me: No compiler with C++11 support was found" >&6;}
|
||||
else
|
||||
HAVE_CXX11=1
|
||||
else
|
||||
HAVE_CXX11=1
|
||||
|
||||
printf "%s\n" "#define HAVE_CXX11 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
am__api_version='1.16'
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
|
||||
@@ -6876,7 +7060,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='c-ares'
|
||||
VERSION='1.19.0'
|
||||
VERSION='1.19.1'
|
||||
|
||||
|
||||
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
|
||||
@@ -33012,6 +33196,166 @@ printf "%s\n" "no" >&6; }
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
tst_links_arc4random_buf="unknown"
|
||||
tst_proto_arc4random_buf="unknown"
|
||||
tst_compi_arc4random_buf="unknown"
|
||||
tst_allow_arc4random_buf="unknown"
|
||||
#
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf can be linked" >&5
|
||||
printf %s "checking if arc4random_buf can be linked... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Define arc4random_buf to an innocuous variant, in case <limits.h> declares arc4random_buf.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define arc4random_buf innocuous_arc4random_buf
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char arc4random_buf (); below. */
|
||||
|
||||
#include <limits.h>
|
||||
#undef arc4random_buf
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char arc4random_buf ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined __stub_arc4random_buf || defined __stub___arc4random_buf
|
||||
choke me
|
||||
#endif
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
return arc4random_buf ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"
|
||||
then :
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
tst_links_arc4random_buf="yes"
|
||||
|
||||
else $as_nop
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
tst_links_arc4random_buf="no"
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
#
|
||||
if test "$tst_links_arc4random_buf" = "yes"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf is prototyped" >&5
|
||||
printf %s "checking if arc4random_buf is prototyped... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
$cares_includes_stdlib
|
||||
|
||||
_ACEOF
|
||||
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||
$EGREP "arc4random_buf" >/dev/null 2>&1
|
||||
then :
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
tst_proto_arc4random_buf="yes"
|
||||
|
||||
else $as_nop
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
tst_proto_arc4random_buf="no"
|
||||
|
||||
fi
|
||||
rm -rf conftest*
|
||||
|
||||
fi
|
||||
#
|
||||
if test "$tst_proto_arc4random_buf" = "yes"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf is compilable" >&5
|
||||
printf %s "checking if arc4random_buf is compilable... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
$cares_includes_stdlib
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
arc4random_buf(NULL, 0);
|
||||
return 1;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"
|
||||
then :
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
tst_compi_arc4random_buf="yes"
|
||||
|
||||
else $as_nop
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
tst_compi_arc4random_buf="no"
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
#
|
||||
if test "$tst_compi_arc4random_buf" = "yes"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf usage allowed" >&5
|
||||
printf %s "checking if arc4random_buf usage allowed... " >&6; }
|
||||
if test "x$cares_disallow_arc4random_buf" != "xyes"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
tst_allow_arc4random_buf="yes"
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
tst_allow_arc4random_buf="no"
|
||||
fi
|
||||
fi
|
||||
#
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if arc4random_buf might be used" >&5
|
||||
printf %s "checking if arc4random_buf might be used... " >&6; }
|
||||
if test "$tst_links_arc4random_buf" = "yes" &&
|
||||
test "$tst_proto_arc4random_buf" = "yes" &&
|
||||
test "$tst_compi_arc4random_buf" = "yes" &&
|
||||
test "$tst_allow_arc4random_buf" = "yes"; then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
printf "%s\n" "yes" >&6; }
|
||||
|
||||
printf "%s\n" "#define HAVE_ARC4RANDOM_BUF 1" >>confdefs.h
|
||||
|
||||
ac_cv_func_arc4random_buf="yes"
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
printf "%s\n" "no" >&6; }
|
||||
ac_cv_func_arc4random_buf="no"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PF_INET6" >&5
|
||||
@@ -33950,37 +34294,7 @@ if test ${with_random+y}
|
||||
then :
|
||||
withval=$with_random; CARES_RANDOM_FILE="$withval"
|
||||
else $as_nop
|
||||
|
||||
if test "$cross_compiling" = "no"; then
|
||||
as_ac_File=`printf "%s\n" "ac_cv_file_"/dev/urandom"" | $as_tr_sh`
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for \"/dev/urandom\"" >&5
|
||||
printf %s "checking for \"/dev/urandom\"... " >&6; }
|
||||
if eval test \${$as_ac_File+y}
|
||||
then :
|
||||
printf %s "(cached) " >&6
|
||||
else $as_nop
|
||||
test "$cross_compiling" = yes &&
|
||||
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
|
||||
if test -r ""/dev/urandom""; then
|
||||
eval "$as_ac_File=yes"
|
||||
else
|
||||
eval "$as_ac_File=no"
|
||||
fi
|
||||
fi
|
||||
eval ac_res=\$$as_ac_File
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
printf "%s\n" "$ac_res" >&6; }
|
||||
if eval test \"x\$"$as_ac_File"\" = x"yes"
|
||||
then :
|
||||
CARES_RANDOM_FILE="/dev/urandom"
|
||||
fi
|
||||
|
||||
else
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cannot check for /dev/urandom while cross compiling; assuming none" >&5
|
||||
printf "%s\n" "$as_me: WARNING: cannot check for /dev/urandom while cross compiling; assuming none" >&2;}
|
||||
fi
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
@@ -34864,7 +35178,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by c-ares $as_me 1.19.0, which was
|
||||
This file was extended by c-ares $as_me 1.19.1, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -34932,7 +35246,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
c-ares config.status 1.19.0
|
||||
c-ares config.status 1.19.1
|
||||
configured by $0, generated by GNU Autoconf 2.71,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
Vendored
+4
-13
@@ -1,9 +1,9 @@
|
||||
AC_PREREQ([2.60])
|
||||
|
||||
AC_INIT([c-ares], [1.19.0],
|
||||
AC_INIT([c-ares], [1.19.1],
|
||||
[c-ares mailing list: http://lists.haxx.se/listinfo/c-ares])
|
||||
|
||||
CARES_VERSION_INFO="8:0:6"
|
||||
CARES_VERSION_INFO="8:1:6"
|
||||
dnl This flag accepts an argument of the form current[:revision[:age]]. So,
|
||||
dnl passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
|
||||
dnl 1.
|
||||
@@ -683,6 +683,7 @@ CARES_CHECK_FUNC_STRNCASECMP
|
||||
CARES_CHECK_FUNC_STRNCMPI
|
||||
CARES_CHECK_FUNC_STRNICMP
|
||||
CARES_CHECK_FUNC_WRITEV
|
||||
CARES_CHECK_FUNC_ARC4RANDOM_BUF
|
||||
|
||||
|
||||
dnl check for AF_INET6
|
||||
@@ -896,17 +897,7 @@ AC_ARG_WITH(random,
|
||||
AS_HELP_STRING([--with-random=FILE],
|
||||
[read randomness from FILE (default=/dev/urandom)]),
|
||||
[ CARES_RANDOM_FILE="$withval" ],
|
||||
[
|
||||
dnl Check for random device. If we're cross compiling, we can't
|
||||
dnl check, and it's better to assume it doesn't exist than it is
|
||||
dnl to fail on AC_CHECK_FILE or later.
|
||||
if test "$cross_compiling" = "no"; then
|
||||
AC_CHECK_FILE("/dev/urandom", [ CARES_RANDOM_FILE="/dev/urandom"] )
|
||||
else
|
||||
AC_MSG_WARN([cannot check for /dev/urandom while cross compiling; assuming none])
|
||||
fi
|
||||
|
||||
]
|
||||
[ CARES_RANDOM_FILE="/dev/urandom" ]
|
||||
)
|
||||
if test -n "$CARES_RANDOM_FILE" && test X"$CARES_RANDOM_FILE" != Xno ; then
|
||||
AC_SUBST(CARES_RANDOM_FILE)
|
||||
|
||||
Vendored
+1
@@ -99,6 +99,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
|
||||
$(top_srcdir)/m4/ax_am_macros_static.m4 \
|
||||
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
|
||||
$(top_srcdir)/m4/ax_code_coverage.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
|
||||
$(top_srcdir)/m4/ax_file_escapes.m4 \
|
||||
$(top_srcdir)/m4/ax_require_defined.m4 \
|
||||
|
||||
Vendored
+1
-1
@@ -283,7 +283,7 @@ When initializing from
|
||||
path location)
|
||||
\fBares_init_options(3)\fP reads the \fIdomain\fP and \fIsearch\fP directives
|
||||
to allow lookups of short names relative to the domains specified. The
|
||||
\fIdomain\fP and \fIsearch\fP directives override one another. If more that
|
||||
\fIdomain\fP and \fIsearch\fP directives override one another. If more than
|
||||
one instance of either \fIdomain\fP or \fIsearch\fP directives is specified,
|
||||
the last occurrence wins. For more information, please see the
|
||||
.BR resolv.conf (5)
|
||||
|
||||
Vendored
+1
@@ -96,6 +96,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
|
||||
$(top_srcdir)/m4/ax_am_macros_static.m4 \
|
||||
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
|
||||
$(top_srcdir)/m4/ax_code_coverage.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
|
||||
$(top_srcdir)/m4/ax_file_escapes.m4 \
|
||||
$(top_srcdir)/m4/ax_require_defined.m4 \
|
||||
|
||||
Vendored
+2
-2
@@ -7,11 +7,11 @@
|
||||
|
||||
#define ARES_VERSION_MAJOR 1
|
||||
#define ARES_VERSION_MINOR 19
|
||||
#define ARES_VERSION_PATCH 0
|
||||
#define ARES_VERSION_PATCH 1
|
||||
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
|
||||
(ARES_VERSION_MINOR<<8)|\
|
||||
(ARES_VERSION_PATCH))
|
||||
#define ARES_VERSION_STR "1.19.0"
|
||||
#define ARES_VERSION_STR "1.19.1"
|
||||
|
||||
#if (ARES_VERSION >= 0x010700)
|
||||
# define CARES_HAVE_ARES_LIBRARY_INIT 1
|
||||
|
||||
+1009
File diff suppressed because it is too large.
Load diff
+17
-141
@@ -1,26 +1,23 @@
|
||||
# ============================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
|
||||
# ============================================================================
|
||||
# =============================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
|
||||
# =============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CXX_COMPILE_STDCXX_11([ext|noext],[mandatory|optional])
|
||||
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for baseline language coverage in the compiler for the C++11
|
||||
# standard; if necessary, add switches to CXXFLAGS to enable support.
|
||||
# standard; if necessary, add switches to CXX and CXXCPP to enable
|
||||
# support.
|
||||
#
|
||||
# The first argument, if specified, indicates whether you insist on an
|
||||
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
|
||||
# -std=c++11). If neither is specified, you get whatever works, with
|
||||
# preference for an extended mode.
|
||||
#
|
||||
# The second argument, if specified 'mandatory' or if left unspecified,
|
||||
# indicates that baseline C++11 support is required and that the macro
|
||||
# should error out if no mode with that support is found. If specified
|
||||
# 'optional', then configuration proceeds regardless, after defining
|
||||
# HAVE_CXX11 if and only if a supporting mode is found.
|
||||
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
|
||||
# macro with the version set to C++11. 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
|
||||
#
|
||||
@@ -28,136 +25,15 @@
|
||||
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
|
||||
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# 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 9
|
||||
#serial 18
|
||||
|
||||
m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [[
|
||||
template <typename T>
|
||||
struct check
|
||||
{
|
||||
static_assert(sizeof(int) <= sizeof(T), "not big enough");
|
||||
};
|
||||
|
||||
struct Base {
|
||||
virtual void f() {}
|
||||
};
|
||||
struct Child : public Base {
|
||||
virtual void f() override {}
|
||||
};
|
||||
|
||||
typedef check<check<bool>> right_angle_brackets;
|
||||
|
||||
int a;
|
||||
decltype(a) b;
|
||||
|
||||
typedef check<int> check_type;
|
||||
check_type c;
|
||||
check_type&& cr = static_cast<check_type&&>(c);
|
||||
|
||||
auto d = a;
|
||||
auto l = [](){};
|
||||
|
||||
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
|
||||
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function because of this
|
||||
namespace test_template_alias_sfinae {
|
||||
struct foo {};
|
||||
|
||||
template<typename T>
|
||||
using member = typename T::member_type;
|
||||
|
||||
template<typename T>
|
||||
void func(...) {}
|
||||
|
||||
template<typename T>
|
||||
void func(member<T>*) {}
|
||||
|
||||
void test();
|
||||
|
||||
void test() {
|
||||
func<foo>(0);
|
||||
}
|
||||
}
|
||||
]])
|
||||
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl
|
||||
m4_if([$1], [], [],
|
||||
[$1], [ext], [],
|
||||
[$1], [noext], [],
|
||||
[m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl
|
||||
m4_if([$2], [], [ax_cxx_compile_cxx11_required=true],
|
||||
[$2], [mandatory], [ax_cxx_compile_cxx11_required=true],
|
||||
[$2], [optional], [ax_cxx_compile_cxx11_required=false],
|
||||
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX_11])])
|
||||
AC_LANG_PUSH([C++])dnl
|
||||
ac_success=no
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features by default,
|
||||
ax_cv_cxx_compile_cxx11,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[ax_cv_cxx_compile_cxx11=yes],
|
||||
[ax_cv_cxx_compile_cxx11=no])])
|
||||
if test x$ax_cv_cxx_compile_cxx11 = xyes; then
|
||||
ac_success=yes
|
||||
fi
|
||||
|
||||
m4_if([$1], [noext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for switch in -std=gnu++11 -std=gnu++0x; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
|
||||
m4_if([$1], [ext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
for switch in -std=c++11 -std=c++0x; do
|
||||
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch])
|
||||
AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch,
|
||||
$cachevar,
|
||||
[ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])],
|
||||
[eval $cachevar=yes],
|
||||
[eval $cachevar=no])
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"])
|
||||
if eval test x\$$cachevar = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS $switch"
|
||||
ac_success=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi])
|
||||
AC_LANG_POP([C++])
|
||||
if test x$ax_cxx_compile_cxx11_required = xtrue; then
|
||||
if test x$ac_success = xno; then
|
||||
AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.])
|
||||
fi
|
||||
else
|
||||
if test x$ac_success = xno; then
|
||||
HAVE_CXX11=0
|
||||
AC_MSG_NOTICE([No compiler with C++11 support was found])
|
||||
else
|
||||
HAVE_CXX11=1
|
||||
AC_DEFINE(HAVE_CXX11,1,
|
||||
[define if the compiler supports basic C++11 syntax])
|
||||
fi
|
||||
|
||||
AC_SUBST(HAVE_CXX11)
|
||||
fi
|
||||
])
|
||||
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])
|
||||
Vendored
+317
-127
@@ -1,5 +1,5 @@
|
||||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
@@ -14,24 +14,28 @@
|
||||
# flags that are needed. (The user can also force certain compiler
|
||||
# flags/libs to be tested by setting these environment variables.)
|
||||
#
|
||||
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||
# multi-threaded programs (defaults to the value of CC otherwise). (This
|
||||
# is necessary on AIX to use the special cc_r compiler alias.)
|
||||
# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
|
||||
# needed for multi-threaded programs (defaults to the value of CC
|
||||
# respectively CXX otherwise). (This is necessary on e.g. AIX to use the
|
||||
# special cc_r/CC_r compiler alias.)
|
||||
#
|
||||
# NOTE: You are assumed to not only compile your program with these flags,
|
||||
# but also link it with them as well. e.g. you should link with
|
||||
# but also to link with them as well. For example, you might link with
|
||||
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||
# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||
#
|
||||
# If you are only building threads programs, you may wish to use these
|
||||
# If you are only building threaded programs, you may wish to use these
|
||||
# variables in your default LIBS, CFLAGS, and CC:
|
||||
#
|
||||
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
|
||||
# CC="$PTHREAD_CC"
|
||||
# CXX="$PTHREAD_CXX"
|
||||
#
|
||||
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
|
||||
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
|
||||
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
|
||||
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||
#
|
||||
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
|
||||
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
|
||||
@@ -55,6 +59,7 @@
|
||||
#
|
||||
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||
# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
|
||||
#
|
||||
# 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
|
||||
@@ -67,7 +72,7 @@
|
||||
# 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/>.
|
||||
# with this program. If not, see <https://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
|
||||
@@ -82,35 +87,41 @@
|
||||
# modified version of the Autoconf Macro, you may extend this special
|
||||
# exception to the GPL to apply to your modified version as well.
|
||||
|
||||
#serial 21
|
||||
#serial 31
|
||||
|
||||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||
AC_DEFUN([AX_PTHREAD], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
AC_LANG_PUSH([C])
|
||||
ax_pthread_ok=no
|
||||
|
||||
# We used to check for pthread.h first, but this fails if pthread.h
|
||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
||||
# requires special compiler flags (e.g. on Tru64 or Sequent).
|
||||
# It gets checked for in the link test anyway.
|
||||
|
||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||
# etcetera environment variables, and if threads linking works using
|
||||
# them:
|
||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
||||
save_CFLAGS="$CFLAGS"
|
||||
if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
|
||||
ax_pthread_save_CC="$CC"
|
||||
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_save_LIBS="$LIBS"
|
||||
AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
|
||||
AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
||||
AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
|
||||
AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
|
||||
AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
|
||||
AC_MSG_RESULT([$ax_pthread_ok])
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
if test "x$ax_pthread_ok" = "xno"; then
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
fi
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CC="$ax_pthread_save_CC"
|
||||
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||
LIBS="$ax_pthread_save_LIBS"
|
||||
fi
|
||||
|
||||
# We must check for the threads library under a number of different
|
||||
@@ -118,12 +129,14 @@ fi
|
||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||
# libraries is broken (non-POSIX).
|
||||
|
||||
# Create a list of thread flags to try. Items starting with a "-" are
|
||||
# C compiler flags, and other items are library names, except for "none"
|
||||
# which indicates that we try without any flags at all, and "pthread-config"
|
||||
# which is a program returning the flags for the Pth emulation library.
|
||||
# Create a list of thread flags to try. Items with a "," contain both
|
||||
# C compiler flags (before ",") and linker flags (after ","). Other items
|
||||
# starting with a "-" are C compiler flags, and remaining items are
|
||||
# library names, except for "none" which indicates that we try without
|
||||
# any flags at all, and "pthread-config" which is a program returning
|
||||
# the flags for the Pth emulation library.
|
||||
|
||||
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||
|
||||
# The ordering *is* (sometimes) important. Some notes on the
|
||||
# individual items follow:
|
||||
@@ -132,82 +145,163 @@ ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mt
|
||||
# none: in case threads are in libc; should be tried before -Kthread and
|
||||
# other compiler flags to prevent continual compiler warnings
|
||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
||||
# -pthreads: Solaris/gcc
|
||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
|
||||
# (Note: HP C rejects this with "bad form for `-t' option")
|
||||
# -pthreads: Solaris/gcc (Note: HP C also rejects)
|
||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
||||
# also defines -D_REENTRANT)
|
||||
# ... -mt is also the pthreads flag for HP/aCC
|
||||
# doesn't hurt to check since this sometimes defines pthreads and
|
||||
# -D_REENTRANT too), HP C (must be checked before -lpthread, which
|
||||
# is present but should not be used directly; and before -mthreads,
|
||||
# because the compiler interprets this as "-mt" + "-hreads")
|
||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||
# pthread: Linux, etcetera
|
||||
# --thread-safe: KAI C++
|
||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||
|
||||
case ${host_os} in
|
||||
case $host_os in
|
||||
|
||||
freebsd*)
|
||||
|
||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||
|
||||
ax_pthread_flags="-kthread lthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
hpux*)
|
||||
|
||||
# From the cc(1) man page: "[-mt] Sets various -D flags to enable
|
||||
# multi-threading and also sets -lpthread."
|
||||
|
||||
ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
openedition*)
|
||||
|
||||
# IBM z/OS requires a feature-test macro to be defined in order to
|
||||
# enable POSIX threads at all, so give the user a hint if this is
|
||||
# not set. (We don't define these ourselves, as they can affect
|
||||
# other portions of the system API in unpredictable ways.)
|
||||
|
||||
AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
|
||||
[
|
||||
# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
|
||||
AX_PTHREAD_ZOS_MISSING
|
||||
# endif
|
||||
],
|
||||
[AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
|
||||
;;
|
||||
|
||||
solaris*)
|
||||
|
||||
# On Solaris (at least, for some versions), libc contains stubbed
|
||||
# (non-functional) versions of the pthreads routines, so link-based
|
||||
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
|
||||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
||||
# a function called by this macro, so we could check for that, but
|
||||
# who knows whether they'll stub that too in a future libc.) So,
|
||||
# we'll just look for -pthreads and -lpthread first:
|
||||
# tests will erroneously succeed. (N.B.: The stubs are missing
|
||||
# pthread_cleanup_push, or rather a function called by this macro,
|
||||
# so we could check for that, but who knows whether they'll stub
|
||||
# that too in a future libc.) So we'll check first for the
|
||||
# standard Solaris way of linking pthreads (-mt -lpthread).
|
||||
|
||||
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
|
||||
;;
|
||||
|
||||
darwin*)
|
||||
ax_pthread_flags="-pthread $ax_pthread_flags"
|
||||
ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Clang doesn't consider unrecognized options an error unless we specify
|
||||
# -Werror. We throw in some extra Clang-specific options to ensure that
|
||||
# this doesn't happen for GCC, which also accepts -Werror.
|
||||
# Are we compiling with Clang?
|
||||
|
||||
AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
|
||||
save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_extra_flags="-Werror"
|
||||
CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
|
||||
[AC_MSG_RESULT([yes])],
|
||||
[ax_pthread_extra_flags=
|
||||
AC_MSG_RESULT([no])])
|
||||
CFLAGS="$save_CFLAGS"
|
||||
AC_CACHE_CHECK([whether $CC is Clang],
|
||||
[ax_cv_PTHREAD_CLANG],
|
||||
[ax_cv_PTHREAD_CLANG=no
|
||||
# Note that Autoconf sets GCC=yes for Clang as well as GCC
|
||||
if test "x$GCC" = "xyes"; then
|
||||
AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
|
||||
[/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
|
||||
# if defined(__clang__) && defined(__llvm__)
|
||||
AX_PTHREAD_CC_IS_CLANG
|
||||
# endif
|
||||
],
|
||||
[ax_cv_PTHREAD_CLANG=yes])
|
||||
fi
|
||||
])
|
||||
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
|
||||
|
||||
if test x"$ax_pthread_ok" = xno; then
|
||||
for flag in $ax_pthread_flags; do
|
||||
|
||||
case $flag in
|
||||
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
|
||||
|
||||
# Note that for GCC and Clang -pthread generally implies -lpthread,
|
||||
# except when -nostdlib is passed.
|
||||
# This is problematic using libtool to build C++ shared libraries with pthread:
|
||||
# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
|
||||
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
|
||||
# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
|
||||
# To solve this, first try -pthread together with -lpthread for GCC
|
||||
|
||||
AS_IF([test "x$GCC" = "xyes"],
|
||||
[ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
|
||||
|
||||
# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
|
||||
|
||||
AS_IF([test "x$ax_pthread_clang" = "xyes"],
|
||||
[ax_pthread_flags="-pthread,-lpthread -pthread"])
|
||||
|
||||
|
||||
# The presence of a feature test macro requesting re-entrant function
|
||||
# definitions is, on some systems, a strong hint that pthreads support is
|
||||
# correctly enabled
|
||||
|
||||
case $host_os in
|
||||
darwin* | hpux* | linux* | osf* | solaris*)
|
||||
ax_pthread_check_macro="_REENTRANT"
|
||||
;;
|
||||
|
||||
aix*)
|
||||
ax_pthread_check_macro="_THREAD_SAFE"
|
||||
;;
|
||||
|
||||
*)
|
||||
ax_pthread_check_macro="--"
|
||||
;;
|
||||
esac
|
||||
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
|
||||
[ax_pthread_check_cond=0],
|
||||
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
|
||||
|
||||
|
||||
if test "x$ax_pthread_ok" = "xno"; then
|
||||
for ax_pthread_try_flag in $ax_pthread_flags; do
|
||||
|
||||
case $ax_pthread_try_flag in
|
||||
none)
|
||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||
;;
|
||||
|
||||
*,*)
|
||||
PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
|
||||
PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
|
||||
AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
|
||||
;;
|
||||
|
||||
-*)
|
||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
||||
PTHREAD_CFLAGS="$flag"
|
||||
AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
|
||||
PTHREAD_CFLAGS="$ax_pthread_try_flag"
|
||||
;;
|
||||
|
||||
pthread-config)
|
||||
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
|
||||
if test x"$ax_pthread_config" = xno; then continue; fi
|
||||
AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
|
||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||
;;
|
||||
|
||||
*)
|
||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
||||
PTHREAD_LIBS="-l$flag"
|
||||
AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
|
||||
PTHREAD_LIBS="-l$ax_pthread_try_flag"
|
||||
;;
|
||||
esac
|
||||
|
||||
save_LIBS="$LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
|
||||
|
||||
# Check for various functions. We must include pthread.h,
|
||||
# since some functions may be macros. (On the Sequent, we
|
||||
@@ -218,8 +312,18 @@ for flag in $ax_pthread_flags; do
|
||||
# pthread_cleanup_push because it is one of the few pthread
|
||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||
# We try pthread_create on general principles.
|
||||
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
|
||||
static void routine(void *a) { a = 0; }
|
||||
# if $ax_pthread_check_cond
|
||||
# error "$ax_pthread_check_macro must be defined"
|
||||
# endif
|
||||
static void *some_global = NULL;
|
||||
static void routine(void *a)
|
||||
{
|
||||
/* To avoid any unused-parameter or
|
||||
unused-but-set-parameter warning. */
|
||||
some_global = a;
|
||||
}
|
||||
static void *start_routine(void *a) { return a; }],
|
||||
[pthread_t th; pthread_attr_t attr;
|
||||
pthread_create(&th, 0, start_routine, 0);
|
||||
@@ -227,101 +331,187 @@ for flag in $ax_pthread_flags; do
|
||||
pthread_attr_init(&attr);
|
||||
pthread_cleanup_push(routine, 0);
|
||||
pthread_cleanup_pop(0) /* ; */])],
|
||||
[ax_pthread_ok=yes],
|
||||
[])
|
||||
[ax_pthread_ok=yes],
|
||||
[])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||
LIBS="$ax_pthread_save_LIBS"
|
||||
|
||||
AC_MSG_RESULT([$ax_pthread_ok])
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
break;
|
||||
fi
|
||||
AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
|
||||
|
||||
PTHREAD_LIBS=""
|
||||
PTHREAD_CFLAGS=""
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Clang needs special handling, because older versions handle the -pthread
|
||||
# option in a rather... idiosyncratic way
|
||||
|
||||
if test "x$ax_pthread_clang" = "xyes"; then
|
||||
|
||||
# Clang takes -pthread; it has never supported any other flag
|
||||
|
||||
# (Note 1: This will need to be revisited if a system that Clang
|
||||
# supports has POSIX threads in a separate library. This tends not
|
||||
# to be the way of modern systems, but it's conceivable.)
|
||||
|
||||
# (Note 2: On some systems, notably Darwin, -pthread is not needed
|
||||
# to get POSIX threads support; the API is always present and
|
||||
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
|
||||
# -pthread does define _REENTRANT, and while the Darwin headers
|
||||
# ignore this macro, third-party headers might not.)
|
||||
|
||||
# However, older versions of Clang make a point of warning the user
|
||||
# that, in an invocation where only linking and no compilation is
|
||||
# taking place, the -pthread option has no effect ("argument unused
|
||||
# during compilation"). They expect -pthread to be passed in only
|
||||
# when source code is being compiled.
|
||||
#
|
||||
# Problem is, this is at odds with the way Automake and most other
|
||||
# C build frameworks function, which is that the same flags used in
|
||||
# compilation (CFLAGS) are also used in linking. Many systems
|
||||
# supported by AX_PTHREAD require exactly this for POSIX threads
|
||||
# support, and in fact it is often not straightforward to specify a
|
||||
# flag that is used only in the compilation phase and not in
|
||||
# linking. Such a scenario is extremely rare in practice.
|
||||
#
|
||||
# Even though use of the -pthread flag in linking would only print
|
||||
# a warning, this can be a nuisance for well-run software projects
|
||||
# that build with -Werror. So if the active version of Clang has
|
||||
# this misfeature, we search for an option to squash it.
|
||||
|
||||
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
|
||||
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
|
||||
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
|
||||
# Create an alternate version of $ac_link that compiles and
|
||||
# links in two steps (.c -> .o, .o -> exe) instead of one
|
||||
# (.c -> exe), because the warning occurs only in the second
|
||||
# step
|
||||
ax_pthread_save_ac_link="$ac_link"
|
||||
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
|
||||
ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
|
||||
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
|
||||
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
|
||||
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
|
||||
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
|
||||
ac_link="$ax_pthread_save_ac_link"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
|
||||
[ac_link="$ax_pthread_2step_ac_link"
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
|
||||
[break])
|
||||
])
|
||||
done
|
||||
ac_link="$ax_pthread_save_ac_link"
|
||||
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
|
||||
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
|
||||
])
|
||||
|
||||
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
|
||||
no | unknown) ;;
|
||||
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
|
||||
esac
|
||||
|
||||
fi # $ax_pthread_clang = yes
|
||||
|
||||
|
||||
|
||||
# Various other checks:
|
||||
if test "x$ax_pthread_ok" = xyes; then
|
||||
save_LIBS="$LIBS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
save_CFLAGS="$CFLAGS"
|
||||
if test "x$ax_pthread_ok" = "xyes"; then
|
||||
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||
ax_pthread_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||
LIBS="$PTHREAD_LIBS $LIBS"
|
||||
|
||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
||||
attr_name=unknown
|
||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||
[int attr = $attr; return attr /* ; */])],
|
||||
[attr_name=$attr; break],
|
||||
[])
|
||||
done
|
||||
AC_MSG_RESULT([$attr_name])
|
||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
||||
AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
fi
|
||||
AC_CACHE_CHECK([for joinable pthread attribute],
|
||||
[ax_cv_PTHREAD_JOINABLE_ATTR],
|
||||
[ax_cv_PTHREAD_JOINABLE_ATTR=unknown
|
||||
for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||
[int attr = $ax_pthread_attr; return attr /* ; */])],
|
||||
[ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
|
||||
[])
|
||||
done
|
||||
])
|
||||
AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
|
||||
test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
|
||||
test "x$ax_pthread_joinable_attr_defined" != "xyes"],
|
||||
[AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
|
||||
[$ax_cv_PTHREAD_JOINABLE_ATTR],
|
||||
[Define to necessary symbol if this constant
|
||||
uses a non-standard name on your system.])
|
||||
ax_pthread_joinable_attr_defined=yes
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
||||
flag=no
|
||||
case ${host_os} in
|
||||
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
|
||||
osf* | hpux*) flag="-D_REENTRANT";;
|
||||
solaris*)
|
||||
if test "$GCC" = "yes"; then
|
||||
flag="-D_REENTRANT"
|
||||
else
|
||||
# TODO: What about Clang on Solaris?
|
||||
flag="-mt -D_REENTRANT"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT([$flag])
|
||||
if test "x$flag" != xno; then
|
||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
||||
fi
|
||||
AC_CACHE_CHECK([whether more special flags are required for pthreads],
|
||||
[ax_cv_PTHREAD_SPECIAL_FLAGS],
|
||||
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
|
||||
case $host_os in
|
||||
solaris*)
|
||||
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
|
||||
;;
|
||||
esac
|
||||
])
|
||||
AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
|
||||
test "x$ax_pthread_special_flags_added" != "xyes"],
|
||||
[PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
|
||||
ax_pthread_special_flags_added=yes])
|
||||
|
||||
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT], [
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
|
||||
[[int i = PTHREAD_PRIO_INHERIT;]])],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT],
|
||||
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
|
||||
[[int i = PTHREAD_PRIO_INHERIT;
|
||||
return i;]])],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||
])
|
||||
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
|
||||
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
|
||||
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
|
||||
test "x$ax_pthread_prio_inherit_defined" != "xyes"],
|
||||
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
|
||||
ax_pthread_prio_inherit_defined=yes
|
||||
])
|
||||
|
||||
LIBS="$save_LIBS"
|
||||
CFLAGS="$save_CFLAGS"
|
||||
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||
LIBS="$ax_pthread_save_LIBS"
|
||||
|
||||
# More AIX lossage: compile with *_r variant
|
||||
if test "x$GCC" != xyes; then
|
||||
if test "x$GCC" != "xyes"; then
|
||||
case $host_os in
|
||||
aix*)
|
||||
AS_CASE(["x/$CC"],
|
||||
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||
[#handle absolute path differently from PATH based program lookup
|
||||
AS_CASE(["x$CC"],
|
||||
[x/*],
|
||||
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
|
||||
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
|
||||
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||
[#handle absolute path differently from PATH based program lookup
|
||||
AS_CASE(["x$CC"],
|
||||
[x/*],
|
||||
[
|
||||
AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
|
||||
AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
|
||||
],
|
||||
[
|
||||
AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
|
||||
AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
|
||||
]
|
||||
)
|
||||
])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||
test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
|
||||
|
||||
AC_SUBST([PTHREAD_LIBS])
|
||||
AC_SUBST([PTHREAD_CFLAGS])
|
||||
AC_SUBST([PTHREAD_CC])
|
||||
AC_SUBST([PTHREAD_CXX])
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test x"$ax_pthread_ok" = xyes; then
|
||||
if test "x$ax_pthread_ok" = "xyes"; then
|
||||
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
|
||||
:
|
||||
else
|
||||
|
||||
Vendored
+85
@@ -3753,3 +3753,88 @@ AC_DEFUN([CARES_CHECK_FUNC_WRITEV], [
|
||||
ac_cv_func_writev="no"
|
||||
fi
|
||||
])
|
||||
|
||||
dnl CARES_CHECK_FUNC_ARC4RANDOM_BUF
|
||||
dnl -------------------------------------------------
|
||||
dnl Verify if arc4random_buf is available, prototyped, and
|
||||
dnl can be compiled. If all of these are true, and
|
||||
dnl usage has not been previously disallowed with
|
||||
dnl shell variable cares_disallow_arc4random_buf, then
|
||||
dnl HAVE_ARC4RANDOM_BUF will be defined.
|
||||
|
||||
AC_DEFUN([CARES_CHECK_FUNC_ARC4RANDOM_BUF], [
|
||||
AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
|
||||
#
|
||||
tst_links_arc4random_buf="unknown"
|
||||
tst_proto_arc4random_buf="unknown"
|
||||
tst_compi_arc4random_buf="unknown"
|
||||
tst_allow_arc4random_buf="unknown"
|
||||
#
|
||||
AC_MSG_CHECKING([if arc4random_buf can be linked])
|
||||
AC_LINK_IFELSE([
|
||||
AC_LANG_FUNC_LINK_TRY([arc4random_buf])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
tst_links_arc4random_buf="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
tst_links_arc4random_buf="no"
|
||||
])
|
||||
#
|
||||
if test "$tst_links_arc4random_buf" = "yes"; then
|
||||
AC_MSG_CHECKING([if arc4random_buf is prototyped])
|
||||
AC_EGREP_CPP([arc4random_buf],[
|
||||
$cares_includes_stdlib
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
tst_proto_arc4random_buf="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
tst_proto_arc4random_buf="no"
|
||||
])
|
||||
fi
|
||||
#
|
||||
if test "$tst_proto_arc4random_buf" = "yes"; then
|
||||
AC_MSG_CHECKING([if arc4random_buf is compilable])
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
$cares_includes_stdlib
|
||||
]],[[
|
||||
arc4random_buf(NULL, 0);
|
||||
return 1;
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
tst_compi_arc4random_buf="yes"
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
tst_compi_arc4random_buf="no"
|
||||
])
|
||||
fi
|
||||
#
|
||||
if test "$tst_compi_arc4random_buf" = "yes"; then
|
||||
AC_MSG_CHECKING([if arc4random_buf usage allowed])
|
||||
if test "x$cares_disallow_arc4random_buf" != "xyes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
tst_allow_arc4random_buf="yes"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
tst_allow_arc4random_buf="no"
|
||||
fi
|
||||
fi
|
||||
#
|
||||
AC_MSG_CHECKING([if arc4random_buf might be used])
|
||||
if test "$tst_links_arc4random_buf" = "yes" &&
|
||||
test "$tst_proto_arc4random_buf" = "yes" &&
|
||||
test "$tst_compi_arc4random_buf" = "yes" &&
|
||||
test "$tst_allow_arc4random_buf" = "yes"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE_UNQUOTED(HAVE_ARC4RANDOM_BUF, 1,
|
||||
[Define to 1 if you have the arc4random_buf function.])
|
||||
ac_cv_func_arc4random_buf="yes"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
ac_cv_func_arc4random_buf="no"
|
||||
fi
|
||||
])
|
||||
|
||||
Vendored
+1
@@ -95,6 +95,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
|
||||
$(top_srcdir)/m4/ax_am_macros_static.m4 \
|
||||
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
|
||||
$(top_srcdir)/m4/ax_code_coverage.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
|
||||
$(top_srcdir)/m4/ax_file_escapes.m4 \
|
||||
$(top_srcdir)/m4/ax_require_defined.m4 \
|
||||
|
||||
Vendored
+22
-8
@@ -15,7 +15,7 @@
|
||||
@SET_MAKE@
|
||||
|
||||
# aminclude_static.am generated automatically by Autoconf
|
||||
# from AX_AM_MACROS_STATIC on Sat Jan 28 10:29:54 CET 2023
|
||||
# from AX_AM_MACROS_STATIC on Mon May 22 13:34:17 CEST 2023
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
@@ -106,6 +106,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
|
||||
$(top_srcdir)/m4/ax_am_macros_static.m4 \
|
||||
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
|
||||
$(top_srcdir)/m4/ax_code_coverage.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
|
||||
$(top_srcdir)/m4/ax_file_escapes.m4 \
|
||||
$(top_srcdir)/m4/ax_require_defined.m4 \
|
||||
@@ -194,13 +195,14 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \
|
||||
libcares_la-ares_parse_txt_reply.lo \
|
||||
libcares_la-ares_parse_uri_reply.lo \
|
||||
libcares_la-ares_platform.lo libcares_la-ares_process.lo \
|
||||
libcares_la-ares_query.lo libcares_la-ares_search.lo \
|
||||
libcares_la-ares_send.lo libcares_la-ares_strcasecmp.lo \
|
||||
libcares_la-ares_strdup.lo libcares_la-ares_strerror.lo \
|
||||
libcares_la-ares_strsplit.lo libcares_la-ares_timeout.lo \
|
||||
libcares_la-ares_version.lo libcares_la-ares_writev.lo \
|
||||
libcares_la-bitncmp.lo libcares_la-inet_net_pton.lo \
|
||||
libcares_la-inet_ntop.lo libcares_la-windows_port.lo
|
||||
libcares_la-ares_query.lo libcares_la-ares_rand.lo \
|
||||
libcares_la-ares_search.lo libcares_la-ares_send.lo \
|
||||
libcares_la-ares_strcasecmp.lo libcares_la-ares_strdup.lo \
|
||||
libcares_la-ares_strerror.lo libcares_la-ares_strsplit.lo \
|
||||
libcares_la-ares_timeout.lo libcares_la-ares_version.lo \
|
||||
libcares_la-ares_writev.lo libcares_la-bitncmp.lo \
|
||||
libcares_la-inet_net_pton.lo libcares_la-inet_ntop.lo \
|
||||
libcares_la-windows_port.lo
|
||||
am__objects_2 =
|
||||
am_libcares_la_OBJECTS = $(am__objects_1) $(am__objects_2)
|
||||
libcares_la_OBJECTS = $(am_libcares_la_OBJECTS)
|
||||
@@ -273,6 +275,7 @@ am__depfiles_remade = \
|
||||
./$(DEPDIR)/libcares_la-ares_platform.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_process.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_query.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_rand.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_search.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_send.Plo \
|
||||
./$(DEPDIR)/libcares_la-ares_strcasecmp.Plo \
|
||||
@@ -617,6 +620,7 @@ CSOURCES = ares__addrinfo2hostent.c \
|
||||
ares_platform.c \
|
||||
ares_process.c \
|
||||
ares_query.c \
|
||||
ares_rand.c \
|
||||
ares_search.c \
|
||||
ares_send.c \
|
||||
ares_strcasecmp.c \
|
||||
@@ -793,6 +797,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_platform.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_process.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_query.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_rand.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_search.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_send.Plo@am__quote@ # am--include-marker
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_strcasecmp.Plo@am__quote@ # am--include-marker
|
||||
@@ -1159,6 +1164,13 @@ libcares_la-ares_query.lo: ares_query.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_query.lo `test -f 'ares_query.c' || echo '$(srcdir)/'`ares_query.c
|
||||
|
||||
libcares_la-ares_rand.lo: ares_rand.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_rand.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_rand.Tpo -c -o libcares_la-ares_rand.lo `test -f 'ares_rand.c' || echo '$(srcdir)/'`ares_rand.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_rand.Tpo $(DEPDIR)/libcares_la-ares_rand.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_rand.c' object='libcares_la-ares_rand.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_rand.lo `test -f 'ares_rand.c' || echo '$(srcdir)/'`ares_rand.c
|
||||
|
||||
libcares_la-ares_search.lo: ares_search.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_search.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_search.Tpo -c -o libcares_la-ares_search.lo `test -f 'ares_search.c' || echo '$(srcdir)/'`ares_search.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_search.Tpo $(DEPDIR)/libcares_la-ares_search.Plo
|
||||
@@ -1503,6 +1515,7 @@ distclean: distclean-recursive
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_platform.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_process.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_query.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_rand.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_search.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_send.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_strcasecmp.Plo
|
||||
@@ -1607,6 +1620,7 @@ maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_platform.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_process.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_query.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_rand.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_search.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_send.Plo
|
||||
-rm -f ./$(DEPDIR)/libcares_la-ares_strcasecmp.Plo
|
||||
|
||||
Vendored
+2
-1
@@ -45,6 +45,7 @@ CSOURCES = ares__addrinfo2hostent.c \
|
||||
ares_platform.c \
|
||||
ares_process.c \
|
||||
ares_query.c \
|
||||
ares_rand.c \
|
||||
ares_search.c \
|
||||
ares_send.c \
|
||||
ares_strcasecmp.c \
|
||||
@@ -59,7 +60,7 @@ CSOURCES = ares__addrinfo2hostent.c \
|
||||
inet_ntop.c \
|
||||
windows_port.c
|
||||
|
||||
HHEADERS = ares_android.h \
|
||||
HHEADERS = ares_android.h \
|
||||
ares_data.h \
|
||||
ares_getenv.h \
|
||||
ares_inet_net_pton.h \
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ static int ares__system_loopback_addrs(int aftype,
|
||||
unsigned short port,
|
||||
struct ares_addrinfo_node **nodes)
|
||||
{
|
||||
#if defined(_WIN32) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600
|
||||
#if defined(_WIN32) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 && !defined(__WATCOMC__)
|
||||
PMIB_UNICASTIPADDRESS_TABLE table;
|
||||
unsigned int i;
|
||||
int status;
|
||||
|
||||
+3
@@ -346,6 +346,9 @@
|
||||
/* Define to 1 if you need the memory.h header file even with stdlib.h */
|
||||
#cmakedefine NEED_MEMORY_H
|
||||
|
||||
/* Define if have arc4random_buf() */
|
||||
#cmakedefine HAVE_ARC4RANDOM_BUF
|
||||
|
||||
/* a suitable file/device to read random data from */
|
||||
#cmakedefine CARES_RANDOM_FILE "@CARES_RANDOM_FILE@"
|
||||
|
||||
|
||||
Vendored
+3
@@ -54,6 +54,9 @@
|
||||
/* Define to 1 if you have AF_INET6. */
|
||||
#undef HAVE_AF_INET6
|
||||
|
||||
/* Define to 1 if you have the arc4random_buf function. */
|
||||
#undef HAVE_ARC4RANDOM_BUF
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#undef HAVE_ARPA_INET_H
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -78,4 +78,4 @@ struct ares_data {
|
||||
void *ares_malloc_data(ares_datatype type);
|
||||
|
||||
|
||||
#endif // __ARES_DATA_H
|
||||
#endif /* __ARES_DATA_H */
|
||||
Vendored
+3
@@ -95,6 +95,9 @@ void ares_destroy(ares_channel channel)
|
||||
if (channel->hosts_path)
|
||||
ares_free(channel->hosts_path);
|
||||
|
||||
if (channel->rand_state)
|
||||
ares__destroy_rand_state(channel->rand_state);
|
||||
|
||||
ares_free(channel);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -179,9 +179,9 @@ int ares__expand_name_validated(const unsigned char *encoded,
|
||||
if (!ares__isprint(*p) && !(name_len == 1 && *p == 0))
|
||||
{
|
||||
*q++ = '\\';
|
||||
*q++ = '0' + *p / 100;
|
||||
*q++ = '0' + (*p % 100) / 10;
|
||||
*q++ = '0' + (*p % 10);
|
||||
*q++ = (char)('0' + *p / 100);
|
||||
*q++ = (char)('0' + (*p % 100) / 10);
|
||||
*q++ = (char)('0' + (*p % 10));
|
||||
}
|
||||
else if (is_reservedch(*p))
|
||||
{
|
||||
|
||||
+21
-10
@@ -430,16 +430,20 @@ static int file_lookup(struct host_query *hquery)
|
||||
FILE *fp;
|
||||
int error;
|
||||
int status;
|
||||
const char *path_hosts = NULL;
|
||||
char *path_hosts = NULL;
|
||||
|
||||
if (hquery->hints.ai_flags & ARES_AI_ENVHOSTS)
|
||||
{
|
||||
path_hosts = getenv("CARES_HOSTS");
|
||||
path_hosts = ares_strdup(getenv("CARES_HOSTS"));
|
||||
if (!path_hosts)
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
if (hquery->channel->hosts_path)
|
||||
{
|
||||
path_hosts = hquery->channel->hosts_path;
|
||||
path_hosts = ares_strdup(hquery->channel->hosts_path);
|
||||
if (!path_hosts)
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
if (!path_hosts)
|
||||
@@ -473,15 +477,15 @@ static int file_lookup(struct host_query *hquery)
|
||||
return ARES_ENOTFOUND;
|
||||
|
||||
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
|
||||
path_hosts = PATH_HOSTS;
|
||||
|
||||
#elif defined(WATT32)
|
||||
const char *PATH_HOSTS = _w32_GetHostsFile();
|
||||
|
||||
if (!PATH_HOSTS)
|
||||
return ARES_ENOTFOUND;
|
||||
#endif
|
||||
path_hosts = PATH_HOSTS;
|
||||
path_hosts = ares_strdup(PATH_HOSTS);
|
||||
if (!path_hosts)
|
||||
return ARES_ENOMEM;
|
||||
}
|
||||
|
||||
fp = fopen(path_hosts, "r");
|
||||
@@ -507,6 +511,7 @@ static int file_lookup(struct host_query *hquery)
|
||||
status = ares__readaddrinfo(fp, hquery->name, hquery->port, &hquery->hints, hquery->ai);
|
||||
fclose(fp);
|
||||
}
|
||||
ares_free(path_hosts);
|
||||
|
||||
/* RFC6761 section 6.3 #3 states that "Name resolution APIs and libraries
|
||||
* SHOULD recognize localhost names as special and SHOULD always return the
|
||||
@@ -665,26 +670,32 @@ void ares_getaddrinfo(ares_channel channel,
|
||||
{
|
||||
if (hints->ai_flags & ARES_AI_NUMERICSERV)
|
||||
{
|
||||
port = (unsigned short)strtoul(service, NULL, 0);
|
||||
if (!port)
|
||||
unsigned long val;
|
||||
errno = 0;
|
||||
val = strtoul(service, NULL, 0);
|
||||
if ((val == 0 && errno != 0) || val > 65535)
|
||||
{
|
||||
ares_free(alias_name);
|
||||
callback(arg, ARES_ESERVICE, 0, NULL);
|
||||
return;
|
||||
}
|
||||
port = (unsigned short)val;
|
||||
}
|
||||
else
|
||||
{
|
||||
port = lookup_service(service, 0);
|
||||
if (!port)
|
||||
{
|
||||
port = (unsigned short)strtoul(service, NULL, 0);
|
||||
if (!port)
|
||||
unsigned long val;
|
||||
errno = 0;
|
||||
val = strtoul(service, NULL, 0);
|
||||
if ((val == 0 && errno != 0) || val > 65535)
|
||||
{
|
||||
ares_free(alias_name);
|
||||
callback(arg, ARES_ESERVICE, 0, NULL);
|
||||
return;
|
||||
}
|
||||
port = (unsigned short)val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+21
-80
@@ -61,17 +61,6 @@
|
||||
#undef WIN32 /* Redefined in MingW/MSVC headers */
|
||||
#endif
|
||||
|
||||
/* Define RtlGenRandom = SystemFunction036. This is in advapi32.dll. There is
|
||||
* no need to dynamically load this, other software used widely does not.
|
||||
* http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx
|
||||
* https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength);
|
||||
# ifndef RtlGenRandom
|
||||
# define RtlGenRandom(a,b) SystemFunction036(a,b)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static int init_by_options(ares_channel channel,
|
||||
const struct ares_options *options,
|
||||
@@ -87,7 +76,6 @@ static int config_nameserver(struct server_state **servers, int *nservers,
|
||||
static int set_search(ares_channel channel, const char *str);
|
||||
static int set_options(ares_channel channel, const char *str);
|
||||
static const char *try_option(const char *p, const char *q, const char *opt);
|
||||
static int init_id_key(rc4_key* key,int key_data_len);
|
||||
|
||||
static int config_sortlist(struct apattern **sortlist, int *nsort,
|
||||
const char *str);
|
||||
@@ -165,6 +153,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
||||
channel->sock_func_cb_data = NULL;
|
||||
channel->resolvconf_path = NULL;
|
||||
channel->hosts_path = NULL;
|
||||
channel->rand_state = NULL;
|
||||
|
||||
channel->last_server = 0;
|
||||
channel->last_timeout_processed = (time_t)now.tv_sec;
|
||||
@@ -218,9 +207,13 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
||||
/* Generate random key */
|
||||
|
||||
if (status == ARES_SUCCESS) {
|
||||
status = init_id_key(&channel->id_key, ARES_ID_KEY_LEN);
|
||||
channel->rand_state = ares__init_rand_state();
|
||||
if (channel->rand_state == NULL) {
|
||||
status = ARES_ENOMEM;
|
||||
}
|
||||
|
||||
if (status == ARES_SUCCESS)
|
||||
channel->next_id = ares__generate_new_id(&channel->id_key);
|
||||
channel->next_id = ares__generate_new_id(channel->rand_state);
|
||||
else
|
||||
DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n",
|
||||
ares_strerror(status)));
|
||||
@@ -242,6 +235,8 @@ done:
|
||||
ares_free(channel->resolvconf_path);
|
||||
if(channel->hosts_path)
|
||||
ares_free(channel->hosts_path);
|
||||
if (channel->rand_state)
|
||||
ares__destroy_rand_state(channel->rand_state);
|
||||
ares_free(channel);
|
||||
return status;
|
||||
}
|
||||
@@ -746,6 +741,17 @@ static ULONG getBestRouteMetric(IF_LUID * const luid, /* Can't be const :( */
|
||||
const ULONG interfaceMetric)
|
||||
{
|
||||
/* On this interface, get the best route to that destination. */
|
||||
#if defined(__WATCOMC__)
|
||||
/* OpenWatcom's builtin Windows SDK does not have a definition for
|
||||
* MIB_IPFORWARD_ROW2, and also does not allow the usage of SOCKADDR_INET
|
||||
* as a variable. Let's work around this by returning the worst possible
|
||||
* metric, but only when using the OpenWatcom compiler.
|
||||
* It may be worth investigating using a different version of the Windows
|
||||
* SDK with OpenWatcom in the future, though this may be fixed in OpenWatcom
|
||||
* 2.0.
|
||||
*/
|
||||
return (ULONG)-1;
|
||||
#else
|
||||
MIB_IPFORWARD_ROW2 row;
|
||||
SOCKADDR_INET ignored;
|
||||
if(GetBestRoute2(/* The interface to use. The index is ignored since we are
|
||||
@@ -778,6 +784,7 @@ static ULONG getBestRouteMetric(IF_LUID * const luid, /* Can't be const :( */
|
||||
* which describes the combination as a "sum".
|
||||
*/
|
||||
return row.Metric + interfaceMetric;
|
||||
#endif /* __WATCOMC__ */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2170,72 +2177,6 @@ static int sortlist_alloc(struct apattern **sortlist, int *nsort,
|
||||
}
|
||||
|
||||
|
||||
/* initialize an rc4 key. If possible a cryptographically secure random key
|
||||
is generated using a suitable function otherwise the code defaults to
|
||||
cross-platform albeit less secure mechanism using rand
|
||||
*/
|
||||
static void randomize_key(unsigned char* key,int key_data_len)
|
||||
{
|
||||
int randomized = 0;
|
||||
int counter=0;
|
||||
#ifdef WIN32
|
||||
BOOLEAN res;
|
||||
|
||||
res = RtlGenRandom(key, key_data_len);
|
||||
if (res)
|
||||
randomized = 1;
|
||||
|
||||
#else /* !WIN32 */
|
||||
# ifdef CARES_RANDOM_FILE
|
||||
FILE *f = fopen(CARES_RANDOM_FILE, "rb");
|
||||
if(f) {
|
||||
setvbuf(f, NULL, _IONBF, 0);
|
||||
counter = aresx_uztosi(fread(key, 1, key_data_len, f));
|
||||
fclose(f);
|
||||
}
|
||||
# endif
|
||||
#endif /* WIN32 */
|
||||
|
||||
if (!randomized) {
|
||||
for (;counter<key_data_len;counter++)
|
||||
key[counter]=(unsigned char)(rand() % 256); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
}
|
||||
|
||||
static int init_id_key(rc4_key* key,int key_data_len)
|
||||
{
|
||||
unsigned char index1;
|
||||
unsigned char index2;
|
||||
unsigned char* state;
|
||||
short counter;
|
||||
unsigned char *key_data_ptr = 0;
|
||||
|
||||
key_data_ptr = ares_malloc(key_data_len);
|
||||
if (!key_data_ptr)
|
||||
return ARES_ENOMEM;
|
||||
memset(key_data_ptr, 0, key_data_len);
|
||||
|
||||
state = &key->state[0];
|
||||
for(counter = 0; counter < 256; counter++)
|
||||
/* unnecessary AND but it keeps some compilers happier */
|
||||
state[counter] = (unsigned char)(counter & 0xff);
|
||||
randomize_key(key->state,key_data_len);
|
||||
key->x = 0;
|
||||
key->y = 0;
|
||||
index1 = 0;
|
||||
index2 = 0;
|
||||
for(counter = 0; counter < 256; counter++)
|
||||
{
|
||||
index2 = (unsigned char)((key_data_ptr[index1] + state[counter] +
|
||||
index2) % 256);
|
||||
ARES_SWAP_BYTE(&state[counter], &state[index2]);
|
||||
|
||||
index1 = (unsigned char)((index1 + 1) % key_data_len);
|
||||
}
|
||||
ares_free(key_data_ptr);
|
||||
return ARES_SUCCESS;
|
||||
}
|
||||
|
||||
void ares_set_local_ip4(ares_channel channel, unsigned int local_ip)
|
||||
{
|
||||
channel->local_ip4 = local_ip;
|
||||
|
||||
Vendored
+8
-11
@@ -101,8 +101,6 @@ W32_FUNC const char *_w32_GetHostsFile (void);
|
||||
|
||||
#endif
|
||||
|
||||
#define ARES_ID_KEY_LEN 31
|
||||
|
||||
#include "ares_ipv6.h"
|
||||
#include "ares_llist.h"
|
||||
|
||||
@@ -262,12 +260,8 @@ struct apattern {
|
||||
unsigned short type;
|
||||
};
|
||||
|
||||
typedef struct rc4_key
|
||||
{
|
||||
unsigned char state[256];
|
||||
unsigned char x;
|
||||
unsigned char y;
|
||||
} rc4_key;
|
||||
struct ares_rand_state;
|
||||
typedef struct ares_rand_state ares_rand_state;
|
||||
|
||||
struct ares_channeldata {
|
||||
/* Configuration data */
|
||||
@@ -302,8 +296,8 @@ struct ares_channeldata {
|
||||
|
||||
/* ID to use for next query */
|
||||
unsigned short next_id;
|
||||
/* key to use when generating new ids */
|
||||
rc4_key id_key;
|
||||
/* random state to use when generating new ids */
|
||||
ares_rand_state *rand_state;
|
||||
|
||||
/* Generation number to use for the next TCP socket open/close */
|
||||
int tcp_connection_generation;
|
||||
@@ -362,7 +356,10 @@ void ares__close_sockets(ares_channel channel, struct server_state *server);
|
||||
int ares__get_hostent(FILE *fp, int family, struct hostent **host);
|
||||
int ares__read_line(FILE *fp, char **buf, size_t *bufsize);
|
||||
void ares__free_query(struct query *query);
|
||||
unsigned short ares__generate_new_id(rc4_key* key);
|
||||
|
||||
ares_rand_state *ares__init_rand_state(void);
|
||||
void ares__destroy_rand_state(ares_rand_state *state);
|
||||
unsigned short ares__generate_new_id(ares_rand_state *state);
|
||||
struct timeval ares__tvnow(void);
|
||||
int ares__expand_name_validated(const unsigned char *encoded,
|
||||
const unsigned char *abuf,
|
||||
|
||||
Vendored
+42
-16
@@ -470,7 +470,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
|
||||
{
|
||||
struct server_state *server;
|
||||
int i;
|
||||
ares_ssize_t count;
|
||||
ares_ssize_t read_len;
|
||||
unsigned char buf[MAXENDSSZ + 1];
|
||||
#ifdef HAVE_RECVFROM
|
||||
ares_socklen_t fromlen;
|
||||
@@ -513,32 +513,41 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
|
||||
/* To reduce event loop overhead, read and process as many
|
||||
* packets as we can. */
|
||||
do {
|
||||
if (server->udp_socket == ARES_SOCKET_BAD)
|
||||
count = 0;
|
||||
|
||||
else {
|
||||
if (server->addr.family == AF_INET)
|
||||
if (server->udp_socket == ARES_SOCKET_BAD) {
|
||||
read_len = -1;
|
||||
} else {
|
||||
if (server->addr.family == AF_INET) {
|
||||
fromlen = sizeof(from.sa4);
|
||||
else
|
||||
} else {
|
||||
fromlen = sizeof(from.sa6);
|
||||
count = socket_recvfrom(channel, server->udp_socket, (void *)buf,
|
||||
sizeof(buf), 0, &from.sa, &fromlen);
|
||||
}
|
||||
read_len = socket_recvfrom(channel, server->udp_socket, (void *)buf,
|
||||
sizeof(buf), 0, &from.sa, &fromlen);
|
||||
}
|
||||
|
||||
if (count == -1 && try_again(SOCKERRNO))
|
||||
if (read_len == 0) {
|
||||
/* UDP is connectionless, so result code of 0 is a 0-length UDP
|
||||
* packet, and not an indication the connection is closed like on
|
||||
* tcp */
|
||||
continue;
|
||||
else if (count <= 0)
|
||||
} else if (read_len < 0) {
|
||||
if (try_again(SOCKERRNO))
|
||||
continue;
|
||||
|
||||
handle_error(channel, i, now);
|
||||
|
||||
#ifdef HAVE_RECVFROM
|
||||
else if (!same_address(&from.sa, &server->addr))
|
||||
} else if (!same_address(&from.sa, &server->addr)) {
|
||||
/* The address the response comes from does not match the address we
|
||||
* sent the request to. Someone may be attempting to perform a cache
|
||||
* poisoning attack. */
|
||||
break;
|
||||
continue;
|
||||
#endif
|
||||
else
|
||||
process_answer(channel, buf, (int)count, i, 0, now);
|
||||
} while (count > 0);
|
||||
|
||||
} else {
|
||||
process_answer(channel, buf, (int)read_len, i, 0, now);
|
||||
}
|
||||
} while (read_len >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -979,6 +988,22 @@ static int setsocknonblock(ares_socket_t sockfd, /* operate on this */
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(IPV6_V6ONLY) && defined(WIN32)
|
||||
/* It makes support for IPv4-mapped IPv6 addresses.
|
||||
* Linux kernel, NetBSD, FreeBSD and Darwin: default is off;
|
||||
* Windows Vista and later: default is on;
|
||||
* DragonFly BSD: acts like off, and dummy setting;
|
||||
* OpenBSD and earlier Windows: unsupported.
|
||||
* Linux: controlled by /proc/sys/net/ipv6/bindv6only.
|
||||
*/
|
||||
static void set_ipv6_v6only(ares_socket_t sockfd, int on)
|
||||
{
|
||||
(void)setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on));
|
||||
}
|
||||
#else
|
||||
#define set_ipv6_v6only(s,v)
|
||||
#endif
|
||||
|
||||
static int configure_socket(ares_socket_t s, int family, ares_channel channel)
|
||||
{
|
||||
union {
|
||||
@@ -1041,6 +1066,7 @@ static int configure_socket(ares_socket_t s, int family, ares_channel channel)
|
||||
if (bind(s, &local.sa, sizeof(local.sa6)) < 0)
|
||||
return -1;
|
||||
}
|
||||
set_ipv6_v6only(s, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Vendored
+1
-35
@@ -33,32 +33,6 @@ struct qquery {
|
||||
|
||||
static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen);
|
||||
|
||||
static void rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
|
||||
{
|
||||
unsigned char x;
|
||||
unsigned char y;
|
||||
unsigned char* state;
|
||||
unsigned char xorIndex;
|
||||
int counter;
|
||||
|
||||
x = key->x;
|
||||
y = key->y;
|
||||
|
||||
state = &key->state[0];
|
||||
for(counter = 0; counter < buffer_len; counter ++)
|
||||
{
|
||||
x = (unsigned char)((x + 1) % 256);
|
||||
y = (unsigned char)((state[x] + y) % 256);
|
||||
ARES_SWAP_BYTE(&state[x], &state[y]);
|
||||
|
||||
xorIndex = (unsigned char)((state[x] + state[y]) % 256);
|
||||
|
||||
buffer_ptr[counter] = (unsigned char)(buffer_ptr[counter]^state[xorIndex]);
|
||||
}
|
||||
key->x = x;
|
||||
key->y = y;
|
||||
}
|
||||
|
||||
static struct query* find_query_by_id(ares_channel channel, unsigned short id)
|
||||
{
|
||||
unsigned short qid;
|
||||
@@ -78,7 +52,6 @@ static struct query* find_query_by_id(ares_channel channel, unsigned short id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* a unique query id is generated using an rc4 key. Since the id may already
|
||||
be used by a running query (as infrequent as it may be), a lookup is
|
||||
performed per id generation. In practice this search should happen only
|
||||
@@ -89,19 +62,12 @@ static unsigned short generate_unique_id(ares_channel channel)
|
||||
unsigned short id;
|
||||
|
||||
do {
|
||||
id = ares__generate_new_id(&channel->id_key);
|
||||
id = ares__generate_new_id(channel->rand_state);
|
||||
} while (find_query_by_id(channel, id));
|
||||
|
||||
return (unsigned short)id;
|
||||
}
|
||||
|
||||
unsigned short ares__generate_new_id(rc4_key* key)
|
||||
{
|
||||
unsigned short r=0;
|
||||
rc4(key, (unsigned char *)&r, sizeof(r));
|
||||
return r;
|
||||
}
|
||||
|
||||
void ares_query(ares_channel channel, const char *name, int dnsclass,
|
||||
int type, ares_callback callback, void *arg)
|
||||
{
|
||||
|
||||
Vendored
+279
@@ -0,0 +1,279 @@
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
* Copyright (C) 2007-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.
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
#include "ares_nowarn.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef enum {
|
||||
ARES_RAND_OS = 1, /* OS-provided such as RtlGenRandom or arc4random */
|
||||
ARES_RAND_FILE = 2, /* OS file-backed random number generator */
|
||||
ARES_RAND_RC4 = 3 /* Internal RC4 based PRNG */
|
||||
} ares_rand_backend;
|
||||
|
||||
typedef struct ares_rand_rc4
|
||||
{
|
||||
unsigned char S[256];
|
||||
size_t i;
|
||||
size_t j;
|
||||
} ares_rand_rc4;
|
||||
|
||||
struct ares_rand_state
|
||||
{
|
||||
ares_rand_backend type;
|
||||
union {
|
||||
FILE *rand_file;
|
||||
ares_rand_rc4 rc4;
|
||||
} state;
|
||||
};
|
||||
|
||||
|
||||
/* Define RtlGenRandom = SystemFunction036. This is in advapi32.dll. There is
|
||||
* no need to dynamically load this, other software used widely does not.
|
||||
* http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx
|
||||
* https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength);
|
||||
# ifndef RtlGenRandom
|
||||
# define RtlGenRandom(a,b) SystemFunction036(a,b)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#define ARES_RC4_KEY_LEN 32 /* 256 bits */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 cares_u64;
|
||||
#else
|
||||
typedef unsigned long long cares_u64;
|
||||
#endif
|
||||
|
||||
static unsigned int ares_u32_from_ptr(void *addr)
|
||||
{
|
||||
if (sizeof(void *) == 8) {
|
||||
return (unsigned int)((((cares_u64)addr >> 32) & 0xFFFFFFFF) | ((cares_u64)addr & 0xFFFFFFFF));
|
||||
}
|
||||
return (unsigned int)((size_t)addr & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
|
||||
/* initialize an rc4 key as the last possible fallback. */
|
||||
static void ares_rc4_generate_key(ares_rand_rc4 *rc4_state, unsigned char *key, size_t key_len)
|
||||
{
|
||||
size_t i;
|
||||
size_t len = 0;
|
||||
unsigned int data;
|
||||
struct timeval tv;
|
||||
|
||||
if (key_len != ARES_RC4_KEY_LEN)
|
||||
return;
|
||||
|
||||
/* Randomness is hard to come by. Maybe the system randomizes heap and stack addresses.
|
||||
* Maybe the current timestamp give us some randomness.
|
||||
* Use rc4_state (heap), &i (stack), and ares__tvnow()
|
||||
*/
|
||||
data = ares_u32_from_ptr(rc4_state);
|
||||
memcpy(key + len, &data, sizeof(data));
|
||||
len += sizeof(data);
|
||||
|
||||
data = ares_u32_from_ptr(&i);
|
||||
memcpy(key + len, &data, sizeof(data));
|
||||
len += sizeof(data);
|
||||
|
||||
tv = ares__tvnow();
|
||||
data = (unsigned int)((tv.tv_sec | tv.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.tv_sec | tv.tv_usec) & 0xFFFFFFFF));
|
||||
|
||||
for (i=len; i<key_len; i++) {
|
||||
key[i]=(unsigned char)(rand() % 256); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ares_rc4_init(ares_rand_rc4 *rc4_state)
|
||||
{
|
||||
unsigned char key[ARES_RC4_KEY_LEN];
|
||||
size_t i;
|
||||
size_t j;
|
||||
|
||||
ares_rc4_generate_key(rc4_state, key, sizeof(key));
|
||||
|
||||
for (i = 0; i < sizeof(rc4_state->S); i++) {
|
||||
rc4_state->S[i] = i & 0xFF;
|
||||
}
|
||||
|
||||
for(i = 0, j = 0; i < 256; i++) {
|
||||
j = (j + rc4_state->S[i] + key[i % sizeof(key)]) % 256;
|
||||
ARES_SWAP_BYTE(&rc4_state->S[i], &rc4_state->S[j]);
|
||||
}
|
||||
|
||||
rc4_state->i = 0;
|
||||
rc4_state->j = 0;
|
||||
}
|
||||
|
||||
/* Just outputs the key schedule, no need to XOR with any data since we have none */
|
||||
static void ares_rc4_prng(ares_rand_rc4 *rc4_state, unsigned char *buf, size_t len)
|
||||
{
|
||||
unsigned char *S = rc4_state->S;
|
||||
size_t i = rc4_state->i;
|
||||
size_t j = rc4_state->j;
|
||||
size_t cnt;
|
||||
|
||||
for (cnt=0; cnt<len; cnt++) {
|
||||
i = (i + 1) % 256;
|
||||
j = (j + S[i]) % 256;
|
||||
|
||||
ARES_SWAP_BYTE(&S[i], &S[j]);
|
||||
buf[cnt] = S[(S[i] + S[j]) % 256];
|
||||
}
|
||||
|
||||
rc4_state->i = i;
|
||||
rc4_state->j = j;
|
||||
}
|
||||
|
||||
|
||||
static int ares__init_rand_engine(ares_rand_state *state)
|
||||
{
|
||||
memset(state, 0, sizeof(*state));
|
||||
|
||||
#if defined(HAVE_ARC4RANDOM_BUF) || defined(_WIN32)
|
||||
state->type = ARES_RAND_OS;
|
||||
return 1;
|
||||
#elif defined(CARES_RANDOM_FILE)
|
||||
state->type = ARES_RAND_FILE;
|
||||
state->state.rand_file = fopen(CARES_RANDOM_FILE, "rb");
|
||||
if (state->state.rand_file) {
|
||||
setvbuf(state->state.rand_file, NULL, _IONBF, 0);
|
||||
return 1;
|
||||
}
|
||||
/* Fall-Thru on failure to RC4 */
|
||||
#endif
|
||||
|
||||
state->type = ARES_RAND_RC4;
|
||||
ares_rc4_init(&state->state.rc4);
|
||||
|
||||
/* Currently cannot fail */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
ares_rand_state *ares__init_rand_state()
|
||||
{
|
||||
ares_rand_state *state = NULL;
|
||||
|
||||
state = ares_malloc(sizeof(*state));
|
||||
if (!state)
|
||||
return NULL;
|
||||
|
||||
if (!ares__init_rand_engine(state)) {
|
||||
ares_free(state);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
static void ares__clear_rand_state(ares_rand_state *state)
|
||||
{
|
||||
if (!state)
|
||||
return;
|
||||
|
||||
switch (state->type) {
|
||||
case ARES_RAND_OS:
|
||||
break;
|
||||
case ARES_RAND_FILE:
|
||||
fclose(state->state.rand_file);
|
||||
break;
|
||||
case ARES_RAND_RC4:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ares__reinit_rand(ares_rand_state *state)
|
||||
{
|
||||
ares__clear_rand_state(state);
|
||||
ares__init_rand_engine(state);
|
||||
}
|
||||
|
||||
|
||||
void ares__destroy_rand_state(ares_rand_state *state)
|
||||
{
|
||||
if (!state)
|
||||
return;
|
||||
|
||||
ares__clear_rand_state(state);
|
||||
ares_free(state);
|
||||
}
|
||||
|
||||
|
||||
static void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len)
|
||||
{
|
||||
|
||||
while (1) {
|
||||
size_t bytes_read = 0;
|
||||
|
||||
switch (state->type) {
|
||||
case ARES_RAND_OS:
|
||||
#ifdef _WIN32
|
||||
RtlGenRandom(buf, len);
|
||||
return;
|
||||
#elif defined(HAVE_ARC4RANDOM_BUF)
|
||||
arc4random_buf(buf, len);
|
||||
return;
|
||||
#else
|
||||
/* Shouldn't be possible to be here */
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ARES_RAND_FILE:
|
||||
while (1) {
|
||||
size_t rv = fread(buf + bytes_read, 1, len - bytes_read, state->state.rand_file);
|
||||
if (rv == 0)
|
||||
break; /* critical error, will reinit rand state */
|
||||
|
||||
bytes_read += rv;
|
||||
if (bytes_read == len)
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case ARES_RAND_RC4:
|
||||
ares_rc4_prng(&state->state.rc4, buf, len);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we didn't return before we got here, that means we had a critical rand
|
||||
* failure and need to reinitialized */
|
||||
ares__reinit_rand(state);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short ares__generate_new_id(ares_rand_state *state)
|
||||
{
|
||||
unsigned short r=0;
|
||||
|
||||
ares__rand_bytes(state, (unsigned char *)&r, sizeof(r));
|
||||
return r;
|
||||
}
|
||||
|
||||
Vendored
+5
-7
@@ -39,7 +39,11 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
|
||||
callback(arg, ARES_EBADQUERY, 0, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel->nservers < 1)
|
||||
{
|
||||
callback(arg, ARES_ESERVFAIL, 0, NULL, 0);
|
||||
return;
|
||||
}
|
||||
/* Allocate space for query and allocated fields. */
|
||||
query = ares_malloc(sizeof(struct query));
|
||||
if (!query)
|
||||
@@ -54,12 +58,6 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
|
||||
callback(arg, ARES_ENOMEM, 0, NULL, 0);
|
||||
return;
|
||||
}
|
||||
if (channel->nservers < 1)
|
||||
{
|
||||
ares_free(query);
|
||||
callback(arg, ARES_ESERVFAIL, 0, NULL, 0);
|
||||
return;
|
||||
}
|
||||
query->server_info = ares_malloc(channel->nservers *
|
||||
sizeof(query->server_info[0]));
|
||||
if (!query->server_info)
|
||||
|
||||
Vendored
+1
-7
@@ -18,7 +18,6 @@
|
||||
#endif
|
||||
|
||||
#include "ares_setup.h"
|
||||
#include "ares_strsplit.h"
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
@@ -55,7 +54,7 @@ char **ares__strsplit(const char *in, const char *delms, size_t *num_elm) {
|
||||
count++;
|
||||
p += i;
|
||||
}
|
||||
} while(*p++ != 0);
|
||||
} while (*p++ != 0);
|
||||
|
||||
if (count == 0)
|
||||
return NULL;
|
||||
@@ -69,13 +68,8 @@ char **ares__strsplit(const char *in, const char *delms, size_t *num_elm) {
|
||||
i = strcspn(p, delms);
|
||||
if (i != 0) {
|
||||
for (k = 0; k < j; k++) {
|
||||
#ifdef WIN32
|
||||
if (strnicmp(table[k], p, i) == 0 && table[k][i] == 0)
|
||||
break;
|
||||
#else
|
||||
if (strncasecmp(table[k], p, i) == 0 && table[k][i] == 0)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
if (k == j) {
|
||||
/* copy unique strings only */
|
||||
|
||||
Vendored
+78
-116
@@ -1,19 +1,20 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
|
||||
* Copyright (c) 2012 by Gilles Chehade <gilles@openbsd.org>
|
||||
* Copyright (c) 1996,1999 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ares_setup.h"
|
||||
@@ -35,9 +36,6 @@
|
||||
|
||||
const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
|
||||
|
||||
|
||||
#ifndef HAVE_INET_NET_PTON
|
||||
|
||||
/*
|
||||
* static int
|
||||
* inet_net_pton_ipv4(src, dst, size)
|
||||
@@ -60,7 +58,7 @@ const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
* Paul Vixie (ISC), June 1996
|
||||
*/
|
||||
static int
|
||||
inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
|
||||
ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
|
||||
{
|
||||
static const char xdigits[] = "0123456789abcdef";
|
||||
static const char digits[] = "0123456789";
|
||||
@@ -216,64 +214,16 @@ getbits(const char *src, int *bitsp)
|
||||
return (1);
|
||||
}
|
||||
|
||||
static int
|
||||
getv4(const char *src, unsigned char *dst, int *bitsp)
|
||||
{
|
||||
static const char digits[] = "0123456789";
|
||||
unsigned char *odst = dst;
|
||||
int n;
|
||||
unsigned int val;
|
||||
char ch;
|
||||
|
||||
val = 0;
|
||||
n = 0;
|
||||
while ((ch = *src++) != '\0') {
|
||||
const char *pch;
|
||||
|
||||
pch = strchr(digits, ch);
|
||||
if (pch != NULL) {
|
||||
if (n++ != 0 && val == 0) /* no leading zeros */
|
||||
return (0);
|
||||
val *= 10;
|
||||
val += aresx_sztoui(pch - digits);
|
||||
if (val > 255) /* range */
|
||||
return (0);
|
||||
continue;
|
||||
}
|
||||
if (ch == '.' || ch == '/') {
|
||||
if (dst - odst > 3) /* too many octets? */
|
||||
return (0);
|
||||
*dst++ = (unsigned char)val;
|
||||
if (ch == '/')
|
||||
return (getbits(src, bitsp));
|
||||
val = 0;
|
||||
n = 0;
|
||||
continue;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
if (n == 0)
|
||||
return (0);
|
||||
if (dst - odst > 3) /* too many octets? */
|
||||
return (0);
|
||||
*dst = (unsigned char)val;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
|
||||
ares_inet_pton6(const char *src, unsigned char *dst)
|
||||
{
|
||||
static const char xdigits_l[] = "0123456789abcdef",
|
||||
xdigits_u[] = "0123456789ABCDEF";
|
||||
xdigits_u[] = "0123456789ABCDEF";
|
||||
unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
|
||||
const char *xdigits, *curtok;
|
||||
int ch, saw_xdigit;
|
||||
int ch, saw_xdigit, count_xdigit;
|
||||
unsigned int val;
|
||||
int digits;
|
||||
int bits;
|
||||
size_t bytes;
|
||||
int words;
|
||||
int ipv4;
|
||||
|
||||
memset((tp = tmp), '\0', NS_IN6ADDRSZ);
|
||||
endp = tp + NS_IN6ADDRSZ;
|
||||
@@ -283,22 +233,22 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
|
||||
if (*++src != ':')
|
||||
goto enoent;
|
||||
curtok = src;
|
||||
saw_xdigit = 0;
|
||||
saw_xdigit = count_xdigit = 0;
|
||||
val = 0;
|
||||
digits = 0;
|
||||
bits = -1;
|
||||
ipv4 = 0;
|
||||
while ((ch = *src++) != '\0') {
|
||||
const char *pch;
|
||||
|
||||
if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
|
||||
pch = strchr((xdigits = xdigits_u), ch);
|
||||
if (pch != NULL) {
|
||||
if (count_xdigit >= 4)
|
||||
goto enoent;
|
||||
val <<= 4;
|
||||
val |= aresx_sztoui(pch - xdigits);
|
||||
if (++digits > 4)
|
||||
val |= (unsigned int)(pch - xdigits);
|
||||
if (val > 0xffff)
|
||||
goto enoent;
|
||||
saw_xdigit = 1;
|
||||
count_xdigit++;
|
||||
continue;
|
||||
}
|
||||
if (ch == ':') {
|
||||
@@ -308,76 +258,99 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
|
||||
goto enoent;
|
||||
colonp = tp;
|
||||
continue;
|
||||
} else if (*src == '\0')
|
||||
} else if (*src == '\0') {
|
||||
goto enoent;
|
||||
}
|
||||
if (tp + NS_INT16SZ > endp)
|
||||
return (0);
|
||||
*tp++ = (unsigned char)((val >> 8) & 0xff);
|
||||
*tp++ = (unsigned char)(val & 0xff);
|
||||
goto enoent;
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
saw_xdigit = 0;
|
||||
digits = 0;
|
||||
count_xdigit = 0;
|
||||
val = 0;
|
||||
continue;
|
||||
}
|
||||
if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
|
||||
getv4(curtok, tp, &bits) > 0) {
|
||||
ares_inet_net_pton_ipv4(curtok, tp, NS_INADDRSZ) > 0) {
|
||||
tp += NS_INADDRSZ;
|
||||
saw_xdigit = 0;
|
||||
ipv4 = 1;
|
||||
break; /* '\0' was seen by inet_pton4(). */
|
||||
}
|
||||
if (ch == '/' && getbits(src, &bits) > 0)
|
||||
break;
|
||||
goto enoent;
|
||||
}
|
||||
if (saw_xdigit) {
|
||||
if (tp + NS_INT16SZ > endp)
|
||||
goto enoent;
|
||||
*tp++ = (unsigned char)((val >> 8) & 0xff);
|
||||
*tp++ = (unsigned char)(val & 0xff);
|
||||
*tp++ = (unsigned char) (val >> 8) & 0xff;
|
||||
*tp++ = (unsigned char) val & 0xff;
|
||||
}
|
||||
if (bits == -1)
|
||||
bits = 128;
|
||||
|
||||
words = (bits + 15) / 16;
|
||||
if (words < 2)
|
||||
words = 2;
|
||||
if (ipv4)
|
||||
words = 8;
|
||||
endp = tmp + 2 * words;
|
||||
|
||||
if (colonp != NULL) {
|
||||
/*
|
||||
* Since some memmove()'s erroneously fail to handle
|
||||
* overlapping regions, we'll do the shift by hand.
|
||||
*/
|
||||
const ares_ssize_t n = tp - colonp;
|
||||
ares_ssize_t i;
|
||||
const int n = (int)(tp - colonp);
|
||||
int i;
|
||||
|
||||
if (tp == endp)
|
||||
goto enoent;
|
||||
for (i = 1; i <= n; i++) {
|
||||
*(endp - i) = *(colonp + n - i);
|
||||
*(colonp + n - i) = 0;
|
||||
endp[- i] = colonp[n - i];
|
||||
colonp[n - i] = 0;
|
||||
}
|
||||
tp = endp;
|
||||
}
|
||||
if (tp != endp)
|
||||
goto enoent;
|
||||
|
||||
bytes = (bits + 7) / 8;
|
||||
if (bytes > size)
|
||||
goto emsgsize;
|
||||
memcpy(dst, tmp, bytes);
|
||||
return (bits);
|
||||
memcpy(dst, tmp, NS_IN6ADDRSZ);
|
||||
return (1);
|
||||
|
||||
enoent:
|
||||
enoent:
|
||||
SET_ERRNO(ENOENT);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
emsgsize:
|
||||
SET_ERRNO(EMSGSIZE);
|
||||
return (-1);
|
||||
static int
|
||||
ares_inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
|
||||
{
|
||||
struct ares_in6_addr in6;
|
||||
int ret;
|
||||
int bits;
|
||||
size_t bytes;
|
||||
char buf[INET6_ADDRSTRLEN + sizeof("/128")];
|
||||
char *sep;
|
||||
|
||||
if (strlen(src) >= sizeof buf) {
|
||||
SET_ERRNO(EMSGSIZE);
|
||||
return (-1);
|
||||
}
|
||||
strncpy(buf, src, sizeof buf);
|
||||
|
||||
sep = strchr(buf, '/');
|
||||
if (sep != NULL)
|
||||
*sep++ = '\0';
|
||||
|
||||
ret = ares_inet_pton6(buf, (unsigned char *)&in6);
|
||||
if (ret != 1)
|
||||
return (-1);
|
||||
|
||||
if (sep == NULL)
|
||||
bits = 128;
|
||||
else {
|
||||
if (!getbits(sep, &bits)) {
|
||||
SET_ERRNO(ENOENT);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
bytes = (bits + 7) / 8;
|
||||
if (bytes > size) {
|
||||
SET_ERRNO(EMSGSIZE);
|
||||
return (-1);
|
||||
}
|
||||
memcpy(dst, &in6, bytes);
|
||||
return (bits);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -403,18 +376,15 @@ ares_inet_net_pton(int af, const char *src, void *dst, size_t size)
|
||||
{
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
return (inet_net_pton_ipv4(src, dst, size));
|
||||
return (ares_inet_net_pton_ipv4(src, dst, size));
|
||||
case AF_INET6:
|
||||
return (inet_net_pton_ipv6(src, dst, size));
|
||||
return (ares_inet_net_pton_ipv6(src, dst, size));
|
||||
default:
|
||||
SET_ERRNO(EAFNOSUPPORT);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_INET_NET_PTON */
|
||||
|
||||
#ifndef HAVE_INET_PTON
|
||||
int ares_inet_pton(int af, const char *src, void *dst)
|
||||
{
|
||||
int result;
|
||||
@@ -434,11 +404,3 @@ int ares_inet_pton(int af, const char *src, void *dst)
|
||||
return 0;
|
||||
return (result > -1 ? 1 : -1);
|
||||
}
|
||||
#else /* HAVE_INET_PTON */
|
||||
int ares_inet_pton(int af, const char *src, void *dst)
|
||||
{
|
||||
/* just relay this to the underlying function */
|
||||
return inet_pton(af, src, dst);
|
||||
}
|
||||
|
||||
#endif
|
||||
Vendored
+1
@@ -98,6 +98,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_ac_append_to_file.m4 \
|
||||
$(top_srcdir)/m4/ax_am_macros_static.m4 \
|
||||
$(top_srcdir)/m4/ax_check_gnu_make.m4 \
|
||||
$(top_srcdir)/m4/ax_code_coverage.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
|
||||
$(top_srcdir)/m4/ax_cxx_compile_stdcxx_11.m4 \
|
||||
$(top_srcdir)/m4/ax_file_escapes.m4 \
|
||||
$(top_srcdir)/m4/ax_require_defined.m4 \
|
||||
|
||||
Reference in new issue
Block a user