deps: update c-ares to v1.30.0

PR-URL: https://github.com/nodejs/node/pull/53416
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
This commit is contained in:
Node.js GitHub Bot 2024-06-13 10:54:33 +03:00 committed by GitHub
parent c64a00a12d
commit 1839eb203a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 2716 additions and 25192 deletions

6487
deps/cares/CHANGES vendored

File diff suppressed because it is too large Load diff

View file

@ -12,10 +12,10 @@ INCLUDE (CheckCSourceCompiles)
INCLUDE (CheckStructHasMember)
INCLUDE (CheckLibraryExists)
PROJECT (c-ares LANGUAGES C VERSION "1.29.0" )
PROJECT (c-ares LANGUAGES C VERSION "1.30.0" )
# Set this version before release
SET (CARES_VERSION "1.29.0")
SET (CARES_VERSION "${PROJECT_VERSION}")
INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are wrong.
@ -30,7 +30,7 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w
# For example, a version of 4:0:2 would generate output such as:
# libname.so -> libname.so.2
# libname.so.2 -> libname.so.2.2.0
SET (CARES_LIB_VERSIONINFO "16:0:14")
SET (CARES_LIB_VERSIONINFO "17:0:15")
OPTION (CARES_STATIC "Build as a static library" OFF)

View file

@ -4,12 +4,6 @@ Contributing to c-ares
To contribute patches to c-ares, please generate a GitHub pull request
and follow these guidelines:
- Check that the Travis builds are green for your pull request.
- Check that the CI/CD builds are green for your pull request.
- Please update the test suite to add a test case for any new functionality.
- Build the library with `./configure --enable-debug --enable-maintainer-mode` and
ensure there are no new warnings.
To improve the chances of the c-ares maintainers responding to your request:
- Also send an email to the mailing list at `c-ares@lists.haxx.se` describing your change.
- To follow any associated discussion, please subscribe to the [mailing list](http://lists.haxx.se/listinfo/c-ares).
- Build the library on your own machine and ensure there are no new warnings.

47
deps/cares/DEVELOPER-NOTES.md vendored Normal file
View file

@ -0,0 +1,47 @@
Developer Notes
===============
* The distributed `ares_build.h` in the official release tarballs is only
intended to be used on systems which can also not run the also distributed
`configure` or `CMake` scripts. It is generated as a copy of
`ares_build.h.dist` as can be seen in the code repository.
* If you check out from git on a non-`configure` or `CMake` platform, you must run
the appropriate `buildconf*` script to set up `ares_build.h` and other local
files before being able to compile the library. There are pre-made makefiles
for a subset of such systems such as Watcom, NMake, and MinGW Makefiles.
* On systems capable of running the `configure` or `CMake` scripts, the process
will overwrite the distributed `ares_build.h` file with one that is suitable
and specific to the library being configured and built, this new file is
generated from the `ares_build.h.in` and `ares_build.h.cmake` template files.
* If you intend to distribute an already compiled c-ares library you **MUST**
also distribute along with it the generated `ares_build.h` which has been
used to compile it. Otherwise, the library will be of no use for the users of
the library that you have built. It is **your** responsibility to provide this
file. No one at the c-ares project can know how you have built the library.
The generated file includes platform and configuration dependent info,
and must not be modified by anyone.
* We support both the AutoTools `configure` based build system as well as the
`CMake` build system. Any new code changes must work with both.
* The files that get compiled and are present in the distribution are referenced
in the `Makefile.inc` in the current directory. This file gets included in
every build system supported by c-ares so that the list of files doesn't need
to be maintained per build system. Don't forget to reference new header files
otherwise they won't be included in the official release tarballs.
* We cannot assume anything else but very basic C89 compiler features being
present. The lone exception is the requirement for 64bit integers which is
not a requirement for C89 compilers to support. Please do not use any extended
features released by later standards.
* Newlines must remain unix-style for older compilers' sake.
* Comments must be written in the old-style `/* unnested C-fashion */`
* Try to keep line lengths below 80 columns and formatted as the existing code.
There is a `.clang-format` in the repository that can be used to run the
automated code formatter as such: `clang-format -i */*.c */*.h */*/*.c */*/*.h`

View file

@ -2,8 +2,7 @@
MIT License
Copyright (c) 1998 Massachusetts Institute of Technology
Copyright (c) 1998 Massachusetts Institute of Technology
Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS
file.

View file

@ -30,7 +30,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES.md \
c-ares-config.cmake.in libcares.pc.cmake libcares.pc.in buildconf get_ver.awk \
maketgz TODO README.msvc $(MSVCFILES) INSTALL.md README.md LICENSE.md \
CMakeLists.txt Makefile.dj Makefile.m32 Makefile.netware Makefile.msvc \
Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO \
Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md DEVELOPER-NOTES.md TODO \
cmake/EnableWarnings.cmake
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)

View file

@ -231,10 +231,8 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libcares.pc.in \
$(top_srcdir)/config/config.sub \
$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
$(top_srcdir)/config/missing AUTHORS INSTALL.md NEWS README.md \
TODO compile config.guess config.sub config/compile \
config/config.guess config/config.sub config/install-sh \
config/ltmain.sh config/missing depcomp install-sh ltmain.sh \
missing
TODO config/compile config/config.guess config/config.sub \
config/install-sh config/ltmain.sh config/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -445,7 +443,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares $(man_MANS) RELEASE-NOTES.md \
c-ares-config.cmake.in libcares.pc.cmake libcares.pc.in buildconf get_ver.awk \
maketgz TODO README.msvc $(MSVCFILES) INSTALL.md README.md LICENSE.md \
CMakeLists.txt Makefile.dj Makefile.m32 Makefile.netware Makefile.msvc \
Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md TODO \
Makefile.Watcom AUTHORS CONTRIBUTING.md SECURITY.md DEVELOPER-NOTES.md TODO \
cmake/EnableWarnings.cmake
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)

112
deps/cares/README.md vendored
View file

@ -8,58 +8,94 @@
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=c-ares_c-ares&metric=bugs)](https://sonarcloud.io/summary/new_code?id=c-ares_c-ares)
[![Coverity Scan Status](https://scan.coverity.com/projects/c-ares/badge.svg)](https://scan.coverity.com/projects/c-ares)
This is c-ares, an asynchronous resolver library. It is intended for
## Overview
[c-ares](https://c-ares.org) is a modern DNS (stub) resolver library, written in
C. It provides interfaces for asynchronous queries while trying to abstract the
intricacies of the underlying DNS protocol. It was originally intended for
applications which need to perform DNS queries without blocking, or need to
perform multiple DNS queries in parallel. The primary examples of such
applications are servers which communicate with multiple clients and programs
with graphical user interfaces.
perform multiple DNS queries in parallel.
The full source code is available in the ['c-ares' release archives](https://c-ares.org/download/),
and in a git repository: https://github.com/c-ares/c-ares. See the
[INSTALL.md](INSTALL.md) file for build information.
One of the goals of c-ares is to be a better DNS resolver than is provided by
your system, regardless of which system you use. We recommend using
the c-ares library in all network applications even if the initial goal of
asynchronous resolution is not necessary to your application.
If you find bugs, correct flaws, have questions or have comments in general in
regard to c-ares (or by all means the original ares too), get in touch with us
on the c-ares mailing list: https://lists.haxx.se/listinfo/c-ares
c-ares will build with any C89 compiler and is [MIT licensed](LICENSE.md),
which makes it suitable for both free and commercial software. c-ares runs on
Linux, FreeBSD, OpenBSD, MacOS, Solaris, AIX, Windows, Android, iOS and many
more operating systems.
c-ares is distributed under the MIT license.
c-ares has a strong focus on security, implementing safe parsers and data
builders used throughout the code, thus avoiding many of the common pitfalls
of other C libraries. Through automated testing with our extensive testing
framework, c-ares is constantly validated with a range of static and dynamic
analyzers, as well as being constantly fuzzed by [OSS Fuzz](https://github.com/google/oss-fuzz).
You'll find all c-ares details and news here:
https://c-ares.org/
While c-ares has been around for over 20 years, it has been actively maintained
both in regards to the latest DNS RFCs as well as updated to follow the latest
best practices in regards to C coding standards.
## Code
The full source code and revision history is available in our
[GitHub repository](https://github.com/c-ares/c-ares). Our signed releases
are available in the ['c-ares' release archives](https://c-ares.org/download/).
## Notes for c-ares hackers
See the [INSTALL.md](INSTALL.md) file for build information.
* The distributed `ares_build.h` file is only intended to be used on systems
which can not run the also distributed configure script.
## Communication
* The distributed `ares_build.h` file is generated as a copy of `ares_build.h.dist`
when the c-ares source code distribution archive file is originally created.
**Issues** and **Feature Requests** should be reported to our
[GitHub Issues](https://github.com/c-ares/c-ares/issues) page.
* If you check out from git on a non-configure platform, you must run the
appropriate `buildconf*` script to set up `ares_build.h` and other local files
before being able to compile the library.
**Discussions** around c-ares and its use, are held on
[GitHub Discussions](https://github.com/c-ares/c-ares/discussions/categories/q-a)
or the [Mailing List](https://lists.haxx.se/mailman/listinfo/c-ares). Mailing
List archive [here](https://lists.haxx.se/pipermail/c-ares/).
Please, do not mail volunteers privately about c-ares.
* On systems capable of running the `configure` script, the `configure` process
will overwrite the distributed `ares_build.h` file with one that is suitable
and specific to the library being configured and built, this new file is
generated from the `ares_build.h.in` template file.
**Security vulnerabilities** are treated according to our
[Security Procedure](SECURITY.md), please email c-ares-security at
haxx.se if you suspect one.
* If you intend to distribute an already compiled c-ares library you **MUST**
also distribute along with it the generated `ares_build.h` which has been
used to compile it. Otherwise, the library will be of no use for the users of
the library that you have built. It is **your** responsibility to provide this
file. No one at the c-ares project can know how you have built the library.
* File `ares_build.h` includes platform and configuration dependent info,
and must not be modified by anyone. Configure script generates it for you.
## Release keys
* We cannot assume anything else but very basic compiler features being
present. While c-ares requires an ANSI C compiler to build, some of the
earlier ANSI compilers clearly can't deal with some preprocessor operators.
Primary GPG keys for c-ares Releasers (some Releasers sign with subkeys):
* Newlines must remain unix-style for older compilers' sake.
* **Daniel Stenberg** <<daniel@haxx.se>>
`27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2`
* **Brad House** <<brad@brad-house.com>>
`DA7D64E4C82C6294CB73A20E22E3D13B5411B7CA`
* Comments must be written in the old-style /* unnested C-fashion */
To import the full set of trusted release keys (including subkeys possibly used
to sign releases):
* Try to keep line lengths below 80 columns.
```bash
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2 # Daniel Stenberg
gpg --keyserver hkps://keys.openpgp.org --recv-keys DA7D64E4C82C6294CB73A20E22E3D13B5411B7CA # Brad House
```
### Verifying signatures
For each release `c-ares-X.Y.Z.tar.gz` there is a corresponding
`c-ares-X.Y.Z.tar.gz.asc` file which contains the detached signature for the
release.
After fetching all of the possible valid signing keys and loading into your
keychain as per the prior section, you can simply run the command below on
the downloaded package and detached signature:
```bash
% gpg -v --verify c-ares-1.29.0.tar.gz.asc c-ares-1.29.0.tar.gz
gpg: enabled compatibility flags:
gpg: Signature made Fri May 24 02:50:38 2024 EDT
gpg: using RSA key 27EDEAF22F3ABCEB50DB9A125CC908FDB71E12C2
gpg: using pgp trust model
gpg: Good signature from "Daniel Stenberg <daniel@haxx.se>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 27ED EAF2 2F3A BCEB 50DB 9A12 5CC9 08FD B71E 12C2
gpg: binary signature, digest algorithm SHA512, key algorithm rsa2048
```

View file

@ -1,42 +1,33 @@
## c-ares version 1.29.0 - May 24 2024
## c-ares version 1.30.0 - June 7 2024
This is a feature and bugfix release.
This is a maintenance and bugfix release.
Features:
* When using `ARES_OPT_EVENT_THREAD`, automatically reload system configuration
when network conditions change. [PR #759](https://github.com/c-ares/c-ares/pull/759)
* Apple: reimplement DNS configuration reading to more accurately pull DNS
settings. [PR #750](https://github.com/c-ares/c-ares/pull/750)
* Add observability into DNS server health via a server state callback, invoked
whenever a query finishes. [PR #744](https://github.com/c-ares/c-ares/pull/744)
* Add server failover retry behavior, where failed servers are retried with
small probability after a minimum delay. [PR #731](https://github.com/c-ares/c-ares/pull/731)
* Basic support for SIG RR record (RFC 2931 / RFC 2535) [PR #773](https://github.com/c-ares/c-ares/pull/773)
Changes:
* Mark `ares_channel_t *` as const in more places in the public API. [PR #758](https://github.com/c-ares/c-ares/pull/758)
* Validation that DNS strings can only consist of printable ascii characters
otherwise will trigger a parse failure.
[75de16c](https://github.com/c-ares/c-ares/commit/75de16c) and
[40fb125](https://github.com/c-ares/c-ares/commit/40fb125)
* Windows: use `GetTickCount64()` for a monotonic timer that does not wrap. [1dff8f6](https://github.com/c-ares/c-ares/commit/1dff8f6)
Bugfixes:
* Due to a logic flaw dns name compression writing was not properly implemented
which would result in the name prefix not being written for a partial match.
This could cause issues in various record types such as MX records when using
the deprecated API. Regression introduced in 1.28.0. [Issue #757](https://github.com/c-ares/c-ares/issues/757)
* Revert OpenBSD `SOCK_DNS` flag, it doesn't do what the docs say it does and
causes c-ares to become non-functional. [PR #754](https://github.com/c-ares/c-ares/pull/754)
* `ares_getnameinfo()`: loosen validation on `salen` parameter. [Issue #752](https://github.com/c-ares/c-ares/issues/752)
* cmake: Android requires C99. [PR #748](https://github.com/c-ares/c-ares/pull/748)
* `ares_queue_wait_empty()` does not honor timeout_ms >= 0. [Issue #742](https://github.com/c-ares/c-ares/pull/742)
* QueryCache: Fix issue where purging on server changes wasn't working. [a6c8fe6](https://github.com/c-ares/c-ares/commit/a6c8fe6)
* Windows: Fix Y2K38 issue by creating our own `ares_timeval_t` datatype. [PR #772](https://github.com/c-ares/c-ares/pull/772)
* Fix packaging issue affecting MacOS due to a missing header. [55afad6](https://github.com/c-ares/c-ares/commit/55afad6)
* MacOS: Fix UBSAN warnings that are likely meaningless due to alignment issues
in new MacOS config reader.
* Android: arm 32bit build failure due to missing symbol. [d1722e6](https://github.com/c-ares/c-ares/commit/d1722e6)
Thanks go to these friendly people for their efforts and contributions for this
release:
* Brad House (@bradh352)
* Daniel Stenberg (@bagder)
* David Hotham (@dimbleby)
* Jiwoo Park (@jimmy-park)
* Oliver Welsh (@oliverwelsh)
* Volker Schlecht (@VlkrS)

View file

@ -14,8 +14,8 @@
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
[m4_warning([this file was generated for autoconf 2.71.
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.72],,
[m4_warning([this file was generated for autoconf 2.72.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])

View file

@ -1,6 +1,6 @@
# aminclude_static.am generated automatically by Autoconf
# from AX_AM_MACROS_STATIC on Fri May 24 08:50:03 CEST 2024
# from AX_AM_MACROS_STATIC on Fri Jun 7 06:50:45 EDT 2024
# Code coverage

348
deps/cares/compile vendored
View file

@ -1,348 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN* | MSYS*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

1754
deps/cares/config.guess vendored

File diff suppressed because it is too large Load diff

1890
deps/cares/config.sub vendored

File diff suppressed because it is too large Load diff

0
deps/cares/config/ltmain.sh vendored Executable file → Normal file
View file

3142
deps/cares/configure vendored

File diff suppressed because it is too large Load diff

View file

@ -2,10 +2,10 @@ dnl Copyright (C) The c-ares project and its contributors
dnl SPDX-License-Identifier: MIT
AC_PREREQ([2.69])
AC_INIT([c-ares], [1.29.0],
AC_INIT([c-ares], [1.30.0],
[c-ares mailing list: http://lists.haxx.se/listinfo/c-ares])
CARES_VERSION_INFO="16:0:14"
CARES_VERSION_INFO="17:0:15"
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.

791
deps/cares/depcomp vendored
View file

@ -1,791 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by 'PROGRAMS ARGS'.
object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The second -e expression handles DOS-style file names with drive
# letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile"
;;
xlc)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
aix_post_process_depfile
;;
tcc)
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# FIXME: That version still under development at the moment of writing.
# Make that this statement remains true also for stable, released
# versions.
# It will wrap lines (doesn't matter whether long or short) with a
# trailing '\', as in:
#
# foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
## The order of this option in the case statement is important, since the
## shell code in configure will try each of these formats in the order
## listed in this file. A plain '-MD' option would be understood by many
## compilers, so we must ensure this comes after the gcc and icc options.
pgcc)
# Portland's C compiler understands '-MD'.
# Will always output deps to 'file.d' where file is the root name of the
# source file under compilation, even if file resides in a subdirectory.
# The object file name does not affect the name of the '.d' file.
# pgcc 10.2 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
# files, the pgcc approach of using the *source* file root name can cause
# problems in parallel builds. Use a locking strategy to avoid stomping on
# the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
make_dummy_depfile
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
set_dir_from "$object"
set_base_from "$object"
if test "$libtool" = yes; then
# Libtool generates 2 separate objects for the 2 libraries. These
# two compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir$base.o.d # libtool 1.5
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
# Same post-processing that is required for AIX mode.
aix_post_process_depfile
;;
msvc7)
if test "$libtool" = yes; then
showIncludes=-Wc,-showIncludes
else
showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this sed invocation
# correctly. Breaking it into two sed invocations is a workaround.
tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process the last invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove '-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E \
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
| sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View file

@ -89,6 +89,9 @@ on requests, and some may only be valid on responses:
.B ARES_REC_TYPE_TXT
- Text strings
.br
.B ARES_REC_TYPE_SIG
- RFC 2535. RFC 2931. SIG Record
.br
.B ARES_REC_TYPE_AAAA
- RFC 3596. Ip6 Address
.br
@ -161,7 +164,7 @@ DNS Header Opcodes:
- Zone change notification (RFC 1996)
.br
.B ARES_OPCODE_UPDATE
- Zone update message (RFC2136)
- Zone update message (RFC 2136)
.br
.RE

View file

@ -190,6 +190,33 @@ Keys used for handling RR record parameters:
.B ARES_RR_TXT_DATA
- TXT Record. Data. Datatype: \fIARES_DATATYPE_BINP\fP
.br
.B ARES_RR_SIG_TYPE_COVERED
- SIG Record. Type Covered. Datatype: \fIARES_DATATYPE_U16\fP
.br
.B ARES_RR_SIG_ALGORITHM
- SIG Record. Algorithm. Datatype: \fIARES_DATATYPE_U8\fP
.br
.B ARES_RR_SIG_LABELS
- SIG Record. Labels. Datatype: \fIARES_DATATYPE_U8\fP
.br
.B ARES_RR_SIG_ORIGINAL_TTL
- SIG Record. Original TTL. Datatype: \fIARES_DATATYPE_U32\fP
.br
.B ARES_RR_SIG_EXPIRATION
- SIG Record. Signature Expiration. Datatype: \fIARES_DATATYPE_U32\fP
.br
.B ARES_RR_SIG_INCEPTION
- SIG Record. Signature Inception. Datatype: \fIARES_DATATYPE_U32\fP
.br
.B ARES_RR_SIG_KEY_TAG
- SIG Record. Key Tag. Datatype: \fIARES_DATATYPE_U16\fP
.br
.B ARES_RR_SIG_SIGNERS_NAME
- SIG Record. Signer's Name. Datatype: \fIARES_DATATYPE_NAME\fP
.br
.B ARES_RR_SIG_SIGNATURE
- SIG Record. Signature. Datatype: \fIARES_DATATYPE_BIN\fP
.br
.B ARES_RR_AAAA_ADDR
- AAAA Record. Address. Datatype: \fIARES_DATATYPE_INADDR6\fP
.br

View file

@ -883,7 +883,7 @@ CARES_EXTERN CARES_DEPRECATED_FOR(ares_get_servers_csv) int ares_get_servers(
const ares_channel_t *channel, struct ares_addr_node **servers);
CARES_EXTERN
CARES_DEPRECATED_FOR(ares_get_servers_ports_csv)
CARES_DEPRECATED_FOR(ares_get_servers_csv)
int ares_get_servers_ports(const ares_channel_t *channel,
struct ares_addr_port_node **servers);

View file

@ -51,6 +51,7 @@ typedef enum {
ARES_REC_TYPE_HINFO = 13, /*!< Host information. */
ARES_REC_TYPE_MX = 15, /*!< Mail routing information. */
ARES_REC_TYPE_TXT = 16, /*!< Text strings. */
ARES_REC_TYPE_SIG = 24, /*!< RFC 2535 / RFC 2931. SIG Record */
ARES_REC_TYPE_AAAA = 28, /*!< RFC 3596. Ip6 Address. */
ARES_REC_TYPE_SRV = 33, /*!< RFC 2782. Server Selection. */
ARES_REC_TYPE_NAPTR = 35, /*!< RFC 3403. Naming Authority Pointer */
@ -208,6 +209,24 @@ typedef enum {
ARES_RR_MX_EXCHANGE = (ARES_REC_TYPE_MX * 100) + 2,
/*! TXT Record. Data. Datatype: BINP */
ARES_RR_TXT_DATA = (ARES_REC_TYPE_TXT * 100) + 1,
/*! SIG Record. Type Covered. Datatype: U16 */
ARES_RR_SIG_TYPE_COVERED = (ARES_REC_TYPE_SIG * 100) + 1,
/*! SIG Record. Algorithm. Datatype: U8 */
ARES_RR_SIG_ALGORITHM = (ARES_REC_TYPE_SIG * 100) + 2,
/*! SIG Record. Labels. Datatype: U8 */
ARES_RR_SIG_LABELS = (ARES_REC_TYPE_SIG * 100) + 3,
/*! SIG Record. Original TTL. Datatype: U32 */
ARES_RR_SIG_ORIGINAL_TTL = (ARES_REC_TYPE_SIG * 100) + 4,
/*! SIG Record. Signature Expiration. Datatype: U32 */
ARES_RR_SIG_EXPIRATION = (ARES_REC_TYPE_SIG * 100) + 5,
/*! SIG Record. Signature Inception. Datatype: U32 */
ARES_RR_SIG_INCEPTION = (ARES_REC_TYPE_SIG * 100) + 6,
/*! SIG Record. Key Tag. Datatype: U16 */
ARES_RR_SIG_KEY_TAG = (ARES_REC_TYPE_SIG * 100) + 7,
/*! SIG Record. Signers Name. Datatype: NAME */
ARES_RR_SIG_SIGNERS_NAME = (ARES_REC_TYPE_SIG * 100) + 8,
/*! SIG Record. Signature. Datatype: BIN */
ARES_RR_SIG_SIGNATURE = (ARES_REC_TYPE_SIG * 100) + 9,
/*! AAAA Record. Address. Datatype: INADDR6 */
ARES_RR_AAAA_ADDR = (ARES_REC_TYPE_AAAA * 100) + 1,
/*! SRV Record. Priority. Datatype: U16 */

View file

@ -31,12 +31,12 @@
#define ARES_COPYRIGHT "2004 - 2024 Daniel Stenberg, <daniel@haxx.se>."
#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 29
#define ARES_VERSION_MINOR 30
#define ARES_VERSION_PATCH 0
#define ARES_VERSION \
((ARES_VERSION_MAJOR << 16) | (ARES_VERSION_MINOR << 8) | \
(ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.29.0"
#define ARES_VERSION_STR "1.30.0"
#if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1

541
deps/cares/install-sh vendored
View file

@ -1,541 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2020-11-14.01; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
backupsuffix=
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-p pass -p to $cpprog.
-s $stripprog installed files.
-S SUFFIX attempt to back up existing files, with suffix SUFFIX.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
By default, rm is invoked with -f; when overridden with RMPROG,
it's up to you to specify -f if you want it.
If -S is not specified, no backups are attempted.
Email bug reports to bug-automake@gnu.org.
Automake home page: https://www.gnu.org/software/automake/
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-p) cpprog="$cpprog -p";;
-s) stripcmd=$stripprog;;
-S) backupsuffix="$2"
shift;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
# Don't chown directories that already exist.
if test $dstdir_status = 0; then
chowncmd=""
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# If $backupsuffix is set, and the file being installed
# already exists, attempt a backup. Don't worry if it fails,
# e.g., if mv doesn't support -f.
if test -n "$backupsuffix" && test -f "$dst"; then
$doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
fi
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

11436
deps/cares/ltmain.sh vendored

File diff suppressed because it is too large Load diff

View file

@ -730,6 +730,7 @@ _LT_CONFIG_SAVE_COMMANDS([
cat <<_LT_EOF >> "$cfgfile"
#! $SHELL
# Generated automatically by $as_me ($PACKAGE) $VERSION
# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
# Provide generalized library-building support services.
@ -2906,18 +2907,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
dynamic_linker='GNU/Linux ld.so'
;;
netbsdelf*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
hardcode_into_libs=yes
dynamic_linker='NetBSD ld.elf_so'
;;
netbsd*)
version_type=sunos
need_lib_prefix=no
@ -3577,7 +3566,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
lt_cv_deplibs_check_method=pass_all
;;
netbsd* | netbsdelf*-gnu)
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else
@ -4083,8 +4072,7 @@ _LT_EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
nlist=conftest.nm
$ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD
if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then
if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
@ -4456,7 +4444,7 @@ m4_if([$1], [CXX], [
;;
esac
;;
netbsd* | netbsdelf*-gnu)
netbsd*)
;;
*qnx* | *nto*)
# QNX uses GNU C++, but need to define -shared option too, otherwise
@ -4724,12 +4712,6 @@ m4_if([$1], [CXX], [
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# flang / f18. f95 an alias for gfortran or flang on Debian
flang* | f18* | f95*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
# icc used to be incompatible with GCC.
# ICC 10 doesn't accept -KPIC any more.
icc* | ifort*)
@ -4974,9 +4956,6 @@ m4_if([$1], [CXX], [
;;
esac
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
*)
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
;;
@ -5039,9 +5018,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
openbsd* | bitrig*)
with_gnu_ld=no
;;
linux* | k*bsd*-gnu | gnu*)
_LT_TAGVAR(link_all_deplibs, $1)=no
;;
esac
_LT_TAGVAR(ld_shlibs, $1)=yes
@ -5277,7 +5253,6 @@ _LT_EOF
case $cc_basename in
tcc*)
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
_LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic'
;;
xlf* | bgf* | bgxlf* | mpixlf*)
@ -5298,7 +5273,7 @@ _LT_EOF
fi
;;
netbsd* | netbsdelf*-gnu)
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
@ -5819,7 +5794,6 @@ _LT_EOF
if test yes = "$lt_cv_irix_exported_symbol"; then
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
fi
_LT_TAGVAR(link_all_deplibs, $1)=no
else
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
@ -5837,12 +5811,11 @@ _LT_EOF
# Fabrice Bellard et al's Tiny C Compiler
_LT_TAGVAR(ld_shlibs, $1)=yes
_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
;;
esac
;;
netbsd* | netbsdelf*-gnu)
netbsd*)
if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
@ -6469,7 +6442,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
else
GXX=no
@ -6845,7 +6818,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes = "$GXX"; then
@ -6910,7 +6883,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library
# dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;;
*)
if test yes = "$GXX"; then
@ -7249,7 +7222,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
else
# FIXME: insert proper C++ library support
@ -7333,7 +7306,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
else
# g++ 2.7 appears to require '-G' NOT '-shared' on this
# platform.
@ -7344,7 +7317,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when
# linking a shared library.
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'

215
deps/cares/missing vendored
View file

@ -1,215 +0,0 @@
#! /bin/sh
# Common wrapper for a few potentially missing GNU programs.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try '$0 --help' for more information"
exit 1
fi
case $1 in
--is-lightweight)
# Used by our autoconf macros to check whether the available missing
# script is modern enough.
exit 0
;;
--run)
# Back-compat with the calling convention used by older automake.
shift
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
to PROGRAM being missing or too old.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal autoconf autoheader autom4te automake makeinfo
bison yacc flex lex help2man
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try '$0 --help' for more information"
exit 1
;;
esac
# Run the given program, remember its exit status.
"$@"; st=$?
# If it succeeded, we are done.
test $st -eq 0 && exit 0
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=https://www.perl.org/
flex_URL=https://github.com/westes/flex
gnu_software_URL=https://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
give_advice "$1" | sed -e '1s/^/WARNING: /' \
-e '2,$s/^/ /' >&2
# Propagate the correct exit status (expected to be 127 for a program
# not found, 63 for a program that failed due to version mismatch).
exit $st
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

View file

@ -15,7 +15,7 @@
@SET_MAKE@
# aminclude_static.am generated automatically by Autoconf
# from AX_AM_MACROS_STATIC on Fri May 24 08:48:15 CEST 2024
# from AX_AM_MACROS_STATIC on Fri Jun 7 06:50:45 EDT 2024
# Copyright (C) The c-ares project and its contributors
# SPDX-License-Identifier: MIT
@ -728,7 +728,8 @@ HHEADERS = ares__buf.h \
ares_str.h \
ares_strsplit.h \
ares_setup.h \
setup_once.h
setup_once.h \
thirdparty/apple/dnsinfo.h
# Makefile.inc provides the CSOURCES and HHEADERS defines

View file

@ -109,5 +109,6 @@ HHEADERS = ares__buf.h \
ares_str.h \
ares_strsplit.h \
ares_setup.h \
setup_once.h
setup_once.h \
thirdparty/apple/dnsinfo.h

View file

@ -941,9 +941,9 @@ ares_status_t ares__buf_set_position(ares__buf_t *buf, size_t idx)
return ARES_SUCCESS;
}
ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len,
unsigned char **bin, size_t *bin_len,
ares_bool_t allow_multiple)
static ares_status_t ares__buf_parse_dns_binstr_int(
ares__buf_t *buf, size_t remaining_len, unsigned char **bin, size_t *bin_len,
ares_bool_t allow_multiple, ares_bool_t validate_printable)
{
unsigned char len;
ares_status_t status;
@ -970,7 +970,17 @@ ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len,
}
if (len) {
/* XXX: Maybe we should scan to make sure it is printable? */
/* When used by the _str() parser, it really needs to be validated to
* be a valid printable ascii string. Do that here */
if (validate_printable && ares__buf_len(buf) >= len) {
size_t mylen;
const char *data = (const char *)ares__buf_peek(buf, &mylen);
if (!ares__str_isprint(data, len)) {
status = ARES_EBADSTR;
break;
}
}
if (bin != NULL) {
status = ares__buf_fetch_bytes_into_buf(buf, binbuf, len);
} else {
@ -1003,12 +1013,21 @@ ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len,
return status;
}
ares_status_t ares__buf_parse_dns_binstr(ares__buf_t *buf, size_t remaining_len,
unsigned char **bin, size_t *bin_len,
ares_bool_t allow_multiple)
{
return ares__buf_parse_dns_binstr_int(buf, remaining_len, bin, bin_len,
allow_multiple, ARES_FALSE);
}
ares_status_t ares__buf_parse_dns_str(ares__buf_t *buf, size_t remaining_len,
char **str, ares_bool_t allow_multiple)
{
size_t len;
return ares__buf_parse_dns_binstr(buf, remaining_len, (unsigned char **)str,
&len, allow_multiple);
return ares__buf_parse_dns_binstr_int(
buf, remaining_len, (unsigned char **)str, &len, allow_multiple, ARES_TRUE);
}
ares_status_t ares__buf_append_num_dec(ares__buf_t *buf, size_t num, size_t len)

View file

@ -34,7 +34,7 @@
static void ares__requeue_queries(struct server_connection *conn)
{
struct query *query;
struct timeval now = ares__tvnow();
ares_timeval_t now = ares__tvnow();
while ((query = ares__llist_first_val(conn->queries_to_conn)) != NULL) {
ares__requeue_query(query, &now);

View file

@ -142,14 +142,14 @@ const void **ares__htable_all_buckets(const ares__htable_t *htable, size_t *num)
size_t i;
if (htable == NULL || num == NULL) {
return NULL;
return NULL; /* LCOV_EXCL_LINE */
}
*num = 0;
out = ares_malloc_zero(sizeof(*out) * htable->num_keys);
if (out == NULL) {
return NULL;
return NULL; /* LCOV_EXCL_LINE */
}
for (i = 0; i < htable->size; i++) {
@ -197,7 +197,7 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
/* Not a failure, just won't expand */
if (old_size == ARES__HTABLE_MAX_BUCKETS) {
return ARES_TRUE;
return ARES_TRUE; /* LCOV_EXCL_LINE */
}
htable->size <<= 1;
@ -207,7 +207,7 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
* middle, we wouldn't be able to recover. */
buckets = ares_malloc_zero(sizeof(*buckets) * htable->size);
if (buckets == NULL) {
goto done;
goto done; /* LCOV_EXCL_LINE */
}
/* The maximum number of new llists we'll need is the number of collisions
@ -217,7 +217,7 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
prealloc_llist =
ares_malloc_zero(sizeof(*prealloc_llist) * prealloc_llist_len);
if (prealloc_llist == NULL) {
goto done;
goto done; /* LCOV_EXCL_LINE */
}
}
for (i = 0; i < prealloc_llist_len; i++) {
@ -270,7 +270,7 @@ static ares_bool_t ares__htable_expand(ares__htable_t *htable)
if (buckets[idx] == NULL) {
/* Silence static analysis, this isn't possible but it doesn't know */
if (prealloc_llist == NULL || prealloc_llist_len == 0) {
goto done;
goto done; /* LCOV_EXCL_LINE */
}
buckets[idx] = prealloc_llist[prealloc_llist_len - 1];
prealloc_llist_len--;
@ -304,7 +304,7 @@ done:
/* On failure, we need to restore the htable size */
if (rv != ARES_TRUE) {
htable->size = old_size;
htable->size = old_size; /* LCOV_EXCL_LINE */
}
return rv;
@ -336,7 +336,7 @@ ares_bool_t ares__htable_insert(ares__htable_t *htable, void *bucket)
if (htable->num_keys + 1 >
(htable->size * ARES__HTABLE_EXPAND_PERCENT) / 100) {
if (!ares__htable_expand(htable)) {
return ARES_FALSE;
return ARES_FALSE; /* LCOV_EXCL_LINE */
}
/* If we expanded, need to calculate a new index */
idx = HASH_IDX(htable, key);

View file

@ -146,8 +146,8 @@ fail:
return ARES_FALSE;
}
ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable, void *key,
void **val)
ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable,
const void *key, void **val)
{
ares__htable_vpvp_bucket_t *bucket = NULL;
@ -170,14 +170,16 @@ ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable, void *key,
return ARES_TRUE;
}
void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable, void *key)
void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable,
const void *key)
{
void *val = NULL;
ares__htable_vpvp_get(htable, key, &val);
return val;
}
ares_bool_t ares__htable_vpvp_remove(ares__htable_vpvp_t *htable, void *key)
ares_bool_t ares__htable_vpvp_remove(ares__htable_vpvp_t *htable,
const void *key)
{
if (htable == NULL) {
return ARES_FALSE;

View file

@ -93,8 +93,8 @@ ares_bool_t ares__htable_vpvp_insert(ares__htable_vpvp_t *htable, void *key,
* \param[out] val Optional. Pointer to store value.
* \return ARES_TRUE on success, ARES_FALSE on failure
*/
ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable, void *key,
void **val);
ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable,
const void *key, void **val);
/*! Retrieve value from hashtable directly as return value. Caveat to this
* function over ares__htable_vpvp_get() is that if a NULL value is stored
@ -105,7 +105,7 @@ ares_bool_t ares__htable_vpvp_get(const ares__htable_vpvp_t *htable, void *key,
* \return value associated with key in hashtable or NULL
*/
void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable,
void *key);
const void *key);
/*! Remove a value from the hashtable by key
*
@ -113,7 +113,8 @@ void *ares__htable_vpvp_get_direct(const ares__htable_vpvp_t *htable,
* \param[in] key key to use to search
* \return ARES_TRUE if found, ARES_FALSE if not
*/
ares_bool_t ares__htable_vpvp_remove(ares__htable_vpvp_t *htable, void *key);
ares_bool_t ares__htable_vpvp_remove(ares__htable_vpvp_t *htable,
const void *key);
/*! Retrieve the number of keys stored in the hash table
*

View file

@ -551,7 +551,7 @@ void ares__channel_unlock(const ares_channel_t *channel)
ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms)
{
ares_status_t status = ARES_SUCCESS;
struct timeval tout;
ares_timeval_t tout;
if (!ares_threadsafety()) {
return ARES_ENOTIMP;
@ -562,9 +562,9 @@ ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms)
}
if (timeout_ms >= 0) {
tout = ares__tvnow();
tout.tv_sec += timeout_ms / 1000;
tout.tv_usec += (timeout_ms % 1000) * 1000;
tout = ares__tvnow();
tout.sec += (ares_int64_t)(timeout_ms / 1000);
tout.usec += (unsigned int)(timeout_ms % 1000) * 1000;
}
ares__thread_mutex_lock(channel->lock);
@ -572,13 +572,13 @@ ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms)
if (timeout_ms < 0) {
ares__thread_cond_wait(channel->cond_empty, channel->lock);
} else {
struct timeval tv_remaining;
struct timeval tv_now = ares__tvnow();
ares_timeval_t tv_remaining;
ares_timeval_t tv_now = ares__tvnow();
unsigned long tms;
ares__timeval_remaining(&tv_remaining, &tv_now, &tout);
tms = (unsigned long)((tv_remaining.tv_sec * 1000) +
(tv_remaining.tv_usec / 1000));
tms =
(unsigned long)((tv_remaining.sec * 1000) + (tv_remaining.usec / 1000));
if (tms == 0) {
status = ARES_ETIMEOUT;
} else {

View file

@ -30,79 +30,60 @@
#if defined(WIN32) && !defined(MSDOS)
struct timeval ares__tvnow(void)
ares_timeval_t ares__tvnow(void)
{
/*
** GetTickCount() is available on _all_ Windows versions from W95 up
** to nowadays. Returns milliseconds elapsed since last system boot,
** increases monotonically and wraps once 49.7 days have elapsed.
*/
struct timeval now;
DWORD milliseconds = GetTickCount();
now.tv_sec = (long)milliseconds / 1000;
now.tv_usec = (long)(milliseconds % 1000) * 1000;
/* GetTickCount64() is available on Windows Vista and higher */
ares_timeval_t now;
ULONGLONG milliseconds = GetTickCount64();
now.sec = (ares_int64_t)milliseconds / 1000;
now.usec = (unsigned int)(milliseconds % 1000) * 1000;
return now;
}
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
struct timeval ares__tvnow(void)
ares_timeval_t ares__tvnow(void)
{
/*
** clock_gettime() is granted to be increased monotonically when the
** monotonic clock is queried. Time starting point is unspecified, it
** could be the system start-up time, the Epoch, or something else,
** in any case the time starting point does not change once that the
** system has started up.
*/
struct timeval now;
/* clock_gettime() is guaranteed to be increased monotonically when the
* monotonic clock is queried. Time starting point is unspecified, it
* could be the system start-up time, the Epoch, or something else,
* in any case the time starting point does not change once that the
* system has started up. */
ares_timeval_t now;
struct timespec tsnow;
if (0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
now.tv_sec = tsnow.tv_sec;
now.tv_usec = (int)(tsnow.tv_nsec / 1000);
if (clock_gettime(CLOCK_MONOTONIC, &tsnow) == 0) {
now.sec = (ares_int64_t)tsnow.tv_sec;
now.usec = (unsigned int)(tsnow.tv_nsec / 1000);
} else {
struct timeval tv;
(void)gettimeofday(&tv, NULL);
now.sec = (ares_int64_t)tv.tv_sec;
now.usec = (unsigned int)tv.tv_usec;
}
/*
** Even when the configure process has truly detected monotonic clock
** availability, it might happen that it is not actually available at
** run-time. When this occurs simply fallback to other time source.
*/
# ifdef HAVE_GETTIMEOFDAY
else
(void)gettimeofday(&now, NULL); /* LCOV_EXCL_LINE */
# else
else {
now.tv_sec = (long)time(NULL);
now.tv_usec = 0;
}
# endif
return now;
}
#elif defined(HAVE_GETTIMEOFDAY)
struct timeval ares__tvnow(void)
ares_timeval_t ares__tvnow(void)
{
/*
** gettimeofday() is not granted to be increased monotonically, due to
** clock drifting and external source time synchronization it can jump
** forward or backward in time.
*/
struct timeval now;
(void)gettimeofday(&now, NULL);
/* gettimeofday() is not granted to be increased monotonically, due to
* clock drifting and external source time synchronization it can jump
* forward or backward in time. */
ares_timeval_t now;
struct timeval tv;
(void)gettimeofday(&tv, NULL);
now.sec = (ares_int64_t)tv.tv_sec;
now.usec = (unsigned int)tv.tv_usec;
return now;
}
#else
struct timeval ares__tvnow(void)
{
/*
** time() returns the value of time in seconds since the Epoch.
*/
struct timeval now;
now.tv_sec = (long)time(NULL);
now.tv_usec = 0;
return now;
}
# error missing sub-second time retrieval function
#endif

View file

@ -294,25 +294,25 @@
/* Define to 1 if you have `strnicmp` */
#undef HAVE_STRNICMP
/* Define to 1 if the system has the type `struct addrinfo'. */
/* Define to 1 if the system has the type 'struct addrinfo'. */
#undef HAVE_STRUCT_ADDRINFO
/* Define to 1 if `ai_flags' is a member of `struct addrinfo'. */
/* Define to 1 if 'ai_flags' is a member of 'struct addrinfo'. */
#undef HAVE_STRUCT_ADDRINFO_AI_FLAGS
/* Define to 1 if the system has the type `struct in6_addr'. */
/* Define to 1 if the system has the type 'struct in6_addr'. */
#undef HAVE_STRUCT_IN6_ADDR
/* Define to 1 if the system has the type `struct sockaddr_in6'. */
/* Define to 1 if the system has the type 'struct sockaddr_in6'. */
#undef HAVE_STRUCT_SOCKADDR_IN6
/* Define to 1 if `sin6_scope_id' is a member of `struct sockaddr_in6'. */
/* Define to 1 if 'sin6_scope_id' is a member of 'struct sockaddr_in6'. */
#undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
/* Define to 1 if the system has the type 'struct sockaddr_storage'. */
#undef HAVE_STRUCT_SOCKADDR_STORAGE
/* Define to 1 if the system has the type `struct timeval'. */
/* Define to 1 if the system has the type 'struct timeval'. */
#undef HAVE_STRUCT_TIMEVAL
/* Define to 1 if you have the <sys/epoll.h> header file. */
@ -469,12 +469,12 @@
/* send() return value */
#undef SEND_TYPE_RETV
/* Define to 1 if all of the C90 standard headers exist (not just the ones
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */
/* Enable extensions on AIX, Interix, z/OS. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
@ -535,11 +535,15 @@
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# undef __STDC_WANT_IEC_60559_DFP_EXT__
#endif
/* Enable extensions specified by C23 Annex F. */
#ifndef __STDC_WANT_IEC_60559_EXT__
# undef __STDC_WANT_IEC_60559_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
/* Enable extensions specified by C23 Annex H and ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
#endif
@ -568,8 +572,14 @@
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files, on AIX-style hosts. */
/* Define to 1 on platforms where this makes off_t a 64-bit type. */
#undef _LARGE_FILES
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* Number of bits in time_t, on hosts where this is settable. */
#undef _TIME_BITS
/* Define to 1 on platforms where this makes time_t a 64-bit type. */
#undef __MINGW_USE_VC2005_COMPAT
/* Define as 'unsigned int' if <stddef.h> doesn't define. */
#undef size_t

View file

@ -93,6 +93,7 @@ ares_bool_t ares_dns_rec_type_isvalid(ares_dns_rec_type_t type,
case ARES_REC_TYPE_HINFO:
case ARES_REC_TYPE_MX:
case ARES_REC_TYPE_TXT:
case ARES_REC_TYPE_SIG:
case ARES_REC_TYPE_AAAA:
case ARES_REC_TYPE_SRV:
case ARES_REC_TYPE_NAPTR:
@ -133,9 +134,18 @@ ares_bool_t ares_dns_rec_type_allow_name_compression(ares_dns_rec_type_t type)
return ARES_FALSE;
}
ares_bool_t ares_dns_class_isvalid(ares_dns_class_t qclass,
ares_bool_t is_query)
ares_bool_t ares_dns_class_isvalid(ares_dns_class_t qclass,
ares_dns_rec_type_t type,
ares_bool_t is_query)
{
/* If we don't understand the record type, we shouldn't validate the class
* as there are some instances like on RFC 2391 (SIG RR) the class is
* meaningless, but since we didn't support that record type, we didn't
* know it shouldn't be validated */
if (type == ARES_REC_TYPE_RAW_RR) {
return ARES_TRUE;
}
switch (qclass) {
case ARES_CLASS_IN:
case ARES_CLASS_CHAOS:
@ -143,7 +153,13 @@ ares_bool_t ares_dns_class_isvalid(ares_dns_class_t qclass,
case ARES_CLASS_NONE:
return ARES_TRUE;
case ARES_CLASS_ANY:
return is_query ? ARES_TRUE : ARES_FALSE;
if (type == ARES_REC_TYPE_SIG) {
return ARES_TRUE;
}
if (is_query) {
return ARES_TRUE;
}
return ARES_FALSE;
}
return ARES_FALSE;
}
@ -191,6 +207,8 @@ const char *ares_dns_rec_type_tostr(ares_dns_rec_type_t type)
return "MX";
case ARES_REC_TYPE_TXT:
return "TXT";
case ARES_REC_TYPE_SIG:
return "SIG";
case ARES_REC_TYPE_AAAA:
return "AAAA";
case ARES_REC_TYPE_SRV:
@ -305,6 +323,33 @@ const char *ares_dns_rr_key_tostr(ares_dns_rr_key_t key)
case ARES_RR_TXT_DATA:
return "DATA";
case ARES_RR_SIG_TYPE_COVERED:
return "TYPE_COVERED";
case ARES_RR_SIG_ALGORITHM:
return "ALGORITHM";
case ARES_RR_SIG_LABELS:
return "LABELS";
case ARES_RR_SIG_ORIGINAL_TTL:
return "ORIGINAL_TTL";
case ARES_RR_SIG_EXPIRATION:
return "EXPIRATION";
case ARES_RR_SIG_INCEPTION:
return "INCEPTION";
case ARES_RR_SIG_KEY_TAG:
return "KEY_TAG";
case ARES_RR_SIG_SIGNERS_NAME:
return "SIGNERS_NAME";
case ARES_RR_SIG_SIGNATURE:
return "SIGNATURE";
case ARES_RR_SRV_PRIORITY:
return "PRIORITY";
@ -420,6 +465,7 @@ ares_dns_datatype_t ares_dns_rr_key_datatype(ares_dns_rr_key_t key)
case ARES_RR_SOA_RNAME:
case ARES_RR_PTR_DNAME:
case ARES_RR_MX_EXCHANGE:
case ARES_RR_SIG_SIGNERS_NAME:
case ARES_RR_SRV_TARGET:
case ARES_RR_SVCB_TARGET:
case ARES_RR_HTTPS_TARGET:
@ -440,9 +486,14 @@ ares_dns_datatype_t ares_dns_rr_key_datatype(ares_dns_rr_key_t key)
case ARES_RR_SOA_RETRY:
case ARES_RR_SOA_EXPIRE:
case ARES_RR_SOA_MINIMUM:
case ARES_RR_SIG_ORIGINAL_TTL:
case ARES_RR_SIG_EXPIRATION:
case ARES_RR_SIG_INCEPTION:
return ARES_DATATYPE_U32;
case ARES_RR_MX_PREFERENCE:
case ARES_RR_SIG_TYPE_COVERED:
case ARES_RR_SIG_KEY_TAG:
case ARES_RR_SRV_PRIORITY:
case ARES_RR_SRV_WEIGHT:
case ARES_RR_SRV_PORT:
@ -457,6 +508,8 @@ ares_dns_datatype_t ares_dns_rr_key_datatype(ares_dns_rr_key_t key)
case ARES_RR_RAW_RR_TYPE:
return ARES_DATATYPE_U16;
case ARES_RR_SIG_ALGORITHM:
case ARES_RR_SIG_LABELS:
case ARES_RR_OPT_VERSION:
case ARES_RR_TLSA_CERT_USAGE:
case ARES_RR_TLSA_SELECTOR:
@ -468,6 +521,7 @@ ares_dns_datatype_t ares_dns_rr_key_datatype(ares_dns_rr_key_t key)
case ARES_RR_TXT_DATA:
return ARES_DATATYPE_BINP;
case ARES_RR_SIG_SIGNATURE:
case ARES_RR_TLSA_DATA:
case ARES_RR_RAW_RR_DATA:
return ARES_DATATYPE_BIN;
@ -494,6 +548,15 @@ static const ares_dns_rr_key_t rr_hinfo_keys[] = { ARES_RR_HINFO_CPU,
ARES_RR_HINFO_OS };
static const ares_dns_rr_key_t rr_mx_keys[] = { ARES_RR_MX_PREFERENCE,
ARES_RR_MX_EXCHANGE };
static const ares_dns_rr_key_t rr_sig_keys[] = { ARES_RR_SIG_TYPE_COVERED,
ARES_RR_SIG_ALGORITHM,
ARES_RR_SIG_LABELS,
ARES_RR_SIG_ORIGINAL_TTL,
ARES_RR_SIG_EXPIRATION,
ARES_RR_SIG_INCEPTION,
ARES_RR_SIG_KEY_TAG,
ARES_RR_SIG_SIGNERS_NAME,
ARES_RR_SIG_SIGNATURE };
static const ares_dns_rr_key_t rr_txt_keys[] = { ARES_RR_TXT_DATA };
static const ares_dns_rr_key_t rr_aaaa_keys[] = { ARES_RR_AAAA_ADDR };
static const ares_dns_rr_key_t rr_srv_keys[] = {
@ -560,6 +623,9 @@ const ares_dns_rr_key_t *ares_dns_rr_get_keys(ares_dns_rec_type_t type,
case ARES_REC_TYPE_TXT:
*cnt = sizeof(rr_txt_keys) / sizeof(*rr_txt_keys);
return rr_txt_keys;
case ARES_REC_TYPE_SIG:
*cnt = sizeof(rr_sig_keys) / sizeof(*rr_sig_keys);
return rr_sig_keys;
case ARES_REC_TYPE_AAAA:
*cnt = sizeof(rr_aaaa_keys) / sizeof(*rr_aaaa_keys);
return rr_aaaa_keys;
@ -644,6 +710,7 @@ ares_bool_t ares_dns_rec_type_fromstr(ares_dns_rec_type_t *qtype,
{ "HINFO", ARES_REC_TYPE_HINFO },
{ "MX", ARES_REC_TYPE_MX },
{ "TXT", ARES_REC_TYPE_TXT },
{ "SIG", ARES_REC_TYPE_SIG },
{ "AAAA", ARES_REC_TYPE_AAAA },
{ "SRV", ARES_REC_TYPE_SRV },
{ "NAPTR", ARES_REC_TYPE_NAPTR },

View file

@ -296,6 +296,74 @@ static ares_status_t ares_dns_parse_rr_txt(ares__buf_t *buf, ares_dns_rr_t *rr,
ARES_RR_TXT_DATA);
}
static ares_status_t ares_dns_parse_rr_sig(ares__buf_t *buf, ares_dns_rr_t *rr,
size_t rdlength)
{
ares_status_t status;
size_t orig_len = ares__buf_len(buf);
size_t len;
unsigned char *data;
status = ares_dns_parse_and_set_be16(buf, rr, ARES_RR_SIG_TYPE_COVERED);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_dns_parse_and_set_u8(buf, rr, ARES_RR_SIG_ALGORITHM);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_dns_parse_and_set_u8(buf, rr, ARES_RR_SIG_LABELS);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_dns_parse_and_set_be32(buf, rr, ARES_RR_SIG_ORIGINAL_TTL);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_dns_parse_and_set_be32(buf, rr, ARES_RR_SIG_EXPIRATION);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_dns_parse_and_set_be32(buf, rr, ARES_RR_SIG_INCEPTION);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_dns_parse_and_set_be16(buf, rr, ARES_RR_SIG_KEY_TAG);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_dns_parse_and_set_dns_name(buf, ARES_FALSE, rr,
ARES_RR_SIG_SIGNERS_NAME);
if (status != ARES_SUCCESS) {
return status;
}
len = ares_dns_rr_remaining_len(buf, orig_len, rdlength);
if (len == 0) {
return ARES_EBADRESP;
}
status = ares__buf_fetch_bytes_dup(buf, len, ARES_FALSE, &data);
if (status != ARES_SUCCESS) {
return status;
}
status = ares_dns_rr_set_bin_own(rr, ARES_RR_SIG_SIGNATURE, data, len);
if (status != ARES_SUCCESS) {
ares_free(data);
return status;
}
return ARES_SUCCESS;
}
static ares_status_t ares_dns_parse_rr_aaaa(ares__buf_t *buf, ares_dns_rr_t *rr,
size_t rdlength)
{
@ -632,6 +700,11 @@ static ares_status_t ares_dns_parse_rr_uri(ares__buf_t *buf, ares_dns_rr_t *rr,
return status;
}
if (!ares__str_isprint(name, remaining_len)) {
ares_free(name);
return ARES_EBADRESP;
}
status = ares_dns_rr_set_str_own(rr, ARES_RR_URI_TARGET, name);
if (status != ARES_SUCCESS) {
ares_free(name);
@ -907,6 +980,8 @@ static ares_status_t
return ares_dns_parse_rr_mx(buf, rr, rdlength);
case ARES_REC_TYPE_TXT:
return ares_dns_parse_rr_txt(buf, rr, rdlength);
case ARES_REC_TYPE_SIG:
return ares_dns_parse_rr_sig(buf, rr, rdlength);
case ARES_REC_TYPE_AAAA:
return ares_dns_parse_rr_aaaa(buf, rr, rdlength);
case ARES_REC_TYPE_SRV:

View file

@ -32,8 +32,9 @@ ares_bool_t ares_dns_rcode_isvalid(ares_dns_rcode_t rcode);
ares_bool_t ares_dns_flags_arevalid(unsigned short flags);
ares_bool_t ares_dns_rec_type_isvalid(ares_dns_rec_type_t type,
ares_bool_t is_query);
ares_bool_t ares_dns_class_isvalid(ares_dns_class_t qclass,
ares_bool_t is_query);
ares_bool_t ares_dns_class_isvalid(ares_dns_class_t qclass,
ares_dns_rec_type_t type,
ares_bool_t is_query);
ares_bool_t ares_dns_section_isvalid(ares_dns_section_t sect);
ares_status_t ares_dns_rr_set_str_own(ares_dns_rr_t *dns_rr,
ares_dns_rr_key_t key, char *val);
@ -123,6 +124,19 @@ typedef struct {
size_t data_len;
} ares__dns_txt_t;
typedef struct {
unsigned short type_covered;
unsigned char algorithm;
unsigned char labels;
unsigned int original_ttl;
unsigned int expiration;
unsigned int inception;
unsigned short key_tag;
char *signers_name;
unsigned char *signature;
size_t signature_len;
} ares__dns_sig_t;
typedef struct {
struct ares_in6_addr addr;
} ares__dns_aaaa_t;
@ -216,6 +230,7 @@ struct ares_dns_rr {
ares__dns_hinfo_t hinfo;
ares__dns_mx_t mx;
ares__dns_txt_t txt;
ares__dns_sig_t sig;
ares__dns_aaaa_t aaaa;
ares__dns_srv_t srv;
ares__dns_naptr_t naptr;

View file

@ -148,6 +148,11 @@ static void ares__dns_rr_free(ares_dns_rr_t *rr)
ares_free(rr->r.txt.data);
break;
case ARES_REC_TYPE_SIG:
ares_free(rr->r.sig.signers_name);
ares_free(rr->r.sig.signature);
break;
case ARES_REC_TYPE_SRV:
ares_free(rr->r.srv.target);
break;
@ -245,7 +250,7 @@ ares_status_t ares_dns_record_query_add(ares_dns_record_t *dnsrec,
if (dnsrec == NULL || name == NULL ||
!ares_dns_rec_type_isvalid(qtype, ARES_TRUE) ||
!ares_dns_class_isvalid(qclass, ARES_TRUE)) {
!ares_dns_class_isvalid(qclass, qtype, ARES_TRUE)) {
return ARES_EFORMERR;
}
@ -412,7 +417,7 @@ ares_status_t ares_dns_record_rr_add(ares_dns_rr_t **rr_out,
if (dnsrec == NULL || name == NULL || rr_out == NULL ||
!ares_dns_section_isvalid(sect) ||
!ares_dns_rec_type_isvalid(type, ARES_FALSE) ||
!ares_dns_class_isvalid(rclass, ARES_FALSE)) {
!ares_dns_class_isvalid(rclass, type, ARES_FALSE)) {
return ARES_EFORMERR;
}
@ -627,6 +632,37 @@ static void *ares_dns_rr_data_ptr(ares_dns_rr_t *dns_rr, ares_dns_rr_key_t key,
case ARES_RR_MX_EXCHANGE:
return &dns_rr->r.mx.exchange;
case ARES_RR_SIG_TYPE_COVERED:
return &dns_rr->r.sig.type_covered;
case ARES_RR_SIG_ALGORITHM:
return &dns_rr->r.sig.algorithm;
case ARES_RR_SIG_LABELS:
return &dns_rr->r.sig.labels;
case ARES_RR_SIG_ORIGINAL_TTL:
return &dns_rr->r.sig.original_ttl;
case ARES_RR_SIG_EXPIRATION:
return &dns_rr->r.sig.expiration;
case ARES_RR_SIG_INCEPTION:
return &dns_rr->r.sig.inception;
case ARES_RR_SIG_KEY_TAG:
return &dns_rr->r.sig.key_tag;
case ARES_RR_SIG_SIGNERS_NAME:
return &dns_rr->r.sig.signers_name;
case ARES_RR_SIG_SIGNATURE:
if (lenptr == NULL) {
return NULL;
}
*lenptr = &dns_rr->r.sig.signature_len;
return &dns_rr->r.sig.signature;
case ARES_RR_TXT_DATA:
if (lenptr == NULL) {
return NULL;

View file

@ -424,6 +424,74 @@ static ares_status_t ares_dns_write_rr_txt(ares__buf_t *buf,
return ares_dns_write_rr_binstrs(buf, rr, ARES_RR_TXT_DATA);
}
static ares_status_t ares_dns_write_rr_sig(ares__buf_t *buf,
const ares_dns_rr_t *rr,
ares__llist_t **namelist)
{
ares_status_t status;
const unsigned char *data;
size_t len = 0;
(void)namelist;
/* TYPE COVERED */
status = ares_dns_write_rr_be16(buf, rr, ARES_RR_SIG_TYPE_COVERED);
if (status != ARES_SUCCESS) {
return status;
}
/* ALGORITHM */
status = ares_dns_write_rr_u8(buf, rr, ARES_RR_SIG_ALGORITHM);
if (status != ARES_SUCCESS) {
return status;
}
/* LABELS */
status = ares_dns_write_rr_u8(buf, rr, ARES_RR_SIG_LABELS);
if (status != ARES_SUCCESS) {
return status;
}
/* ORIGINAL TTL */
status = ares_dns_write_rr_be32(buf, rr, ARES_RR_SIG_ORIGINAL_TTL);
if (status != ARES_SUCCESS) {
return status;
}
/* EXPIRATION */
status = ares_dns_write_rr_be32(buf, rr, ARES_RR_SIG_EXPIRATION);
if (status != ARES_SUCCESS) {
return status;
}
/* INCEPTION */
status = ares_dns_write_rr_be32(buf, rr, ARES_RR_SIG_INCEPTION);
if (status != ARES_SUCCESS) {
return status;
}
/* KEY TAG */
status = ares_dns_write_rr_be16(buf, rr, ARES_RR_SIG_KEY_TAG);
if (status != ARES_SUCCESS) {
return status;
}
/* SIGNERS NAME */
status = ares_dns_write_rr_name(buf, rr, namelist, ARES_FALSE,
ARES_RR_SIG_SIGNERS_NAME);
if (status != ARES_SUCCESS) {
return status;
}
/* SIGNATURE -- binary, rest of buffer, required to be non-zero length */
data = ares_dns_rr_get_bin(rr, ARES_RR_SIG_SIGNATURE, &len);
if (data == NULL || len == 0) {
return ARES_EFORMERR;
}
return ares__buf_append(buf, data, len);
}
static ares_status_t ares_dns_write_rr_aaaa(ares__buf_t *buf,
const ares_dns_rr_t *rr,
ares__llist_t **namelist)
@ -925,6 +993,9 @@ static ares_status_t ares_dns_write_rr(const ares_dns_record_t *dnsrec,
case ARES_REC_TYPE_TXT:
status = ares_dns_write_rr_txt(buf, rr, namelistptr);
break;
case ARES_REC_TYPE_SIG:
status = ares_dns_write_rr_sig(buf, rr, namelistptr);
break;
case ARES_REC_TYPE_AAAA:
status = ares_dns_write_rr_aaaa(buf, rr, namelistptr);
break;

View file

@ -28,12 +28,21 @@
#include "ares_private.h"
#include "ares_event.h"
static void ares_event_configchg_reload(ares_event_thread_t *e)
#ifdef __ANDROID__
ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
ares_event_thread_t *e)
{
ares_reinit(e->channel);
/* No ability */
return ARES_ENOTIMP;
}
#ifdef __linux__
void ares_event_configchg_destroy(ares_event_configchg_t *configchg)
{
/* No-op */
}
#elif defined(__linux__)
# include <sys/inotify.h>
@ -72,14 +81,14 @@ static void ares_event_configchg_free(void *data)
static void ares_event_configchg_cb(ares_event_thread_t *e, ares_socket_t fd,
void *data, ares_event_flags_t flags)
{
ares_event_configchg_t *configchg = data;
const ares_event_configchg_t *configchg = data;
/* Some systems cannot read integer variables if they are not
* properly aligned. On other systems, incorrect alignment may
* decrease performance. Hence, the buffer used for reading from
* the inotify file descriptor should have the same alignment as
* struct inotify_event. */
unsigned char buf[4096]
unsigned char buf[4096]
__attribute__((aligned(__alignof__(struct inotify_event))));
const struct inotify_event *event;
ssize_t len;
@ -116,7 +125,7 @@ static void ares_event_configchg_cb(ares_event_thread_t *e, ares_socket_t fd,
/* Only process after all events are read. No need to process more often as
* we don't want to reload the config back to back */
if (triggered) {
ares_event_configchg_reload(e);
ares_reinit(e->channel);
}
}
@ -158,6 +167,8 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg,
done:
if (status != ARES_SUCCESS) {
ares_event_configchg_free(c);
} else {
*configchg = c;
}
return status;
}
@ -200,7 +211,7 @@ static void ares_event_configchg_cb(PVOID CallerContext,
ares_event_configchg_t *configchg = CallerContext;
(void)Row;
(void)NotificationType;
ares_event_configchg_reload(configchg->e);
ares_reinit(configchg->e->channel);
}
# endif
@ -310,7 +321,7 @@ static void ares_event_configchg_cb(ares_event_thread_t *e, ares_socket_t fd,
/* Only process after all events are read. No need to process more often as
* we don't want to reload the config back to back */
if (triggered) {
ares_event_configchg_reload(e);
ares_reinit(e->channel);
}
}
@ -460,7 +471,7 @@ static void *ares_event_configchg_thread(void *arg)
status = config_change_check(c->filestat, c->resolvconf_path);
if (status == ARES_SUCCESS) {
ares_event_configchg_reload(c->e);
ares_reinit(c->e->channel);
}
}

View file

@ -82,17 +82,17 @@ static int ares_query_timeout_cmp_cb(const void *arg1, const void *arg2)
const struct query *q1 = arg1;
const struct query *q2 = arg2;
if (q1->timeout.tv_sec > q2->timeout.tv_sec) {
if (q1->timeout.sec > q2->timeout.sec) {
return 1;
}
if (q1->timeout.tv_sec < q2->timeout.tv_sec) {
if (q1->timeout.sec < q2->timeout.sec) {
return -1;
}
if (q1->timeout.tv_usec > q2->timeout.tv_usec) {
if (q1->timeout.usec > q2->timeout.usec) {
return 1;
}
if (q1->timeout.tv_usec < q2->timeout.tv_usec) {
if (q1->timeout.usec < q2->timeout.usec) {
return -1;
}

View file

@ -167,6 +167,22 @@ struct server_connection {
ares__llist_t *queries_to_conn;
};
#ifdef _MSC_VER
typedef __int64 ares_int64_t;
typedef unsigned __int64 ares_uint64_t;
#else
typedef long long ares_int64_t;
typedef unsigned long long ares_uint64_t;
#endif
/*! struct timeval on some systems like Windows doesn't support 64bit time so
* therefore can't be used due to Y2K38 issues. Make our own that does have
* 64bit time. */
typedef struct {
ares_int64_t sec; /*!< Seconds */
unsigned int usec; /*!< Microseconds. Can't be negative. */
} ares_timeval_t;
struct server_state {
/* Configuration */
size_t idx; /* index for server in system configuration */
@ -183,7 +199,7 @@ struct server_state {
struct server_connection *tcp_conn;
/* The next time when we will retry this server if it has hit failures */
struct timeval next_retry_time;
ares_timeval_t next_retry_time;
/* TCP buffer since multiple responses can come back in one read, or partial
* in a read */
@ -200,7 +216,7 @@ struct server_state {
struct query {
/* Query ID from qbuf, for faster lookup, and current timeout */
unsigned short qid; /* host byte order */
struct timeval timeout;
ares_timeval_t timeout;
ares_channel_t *channel;
/*
@ -358,12 +374,13 @@ void *ares_malloc_zero(size_t size);
void *ares_realloc_zero(void *ptr, size_t orig_size, size_t new_size);
/* return true if now is exactly check time or later */
ares_bool_t ares__timedout(const struct timeval *now,
const struct timeval *check);
ares_bool_t ares__timedout(const ares_timeval_t *now,
const ares_timeval_t *check);
/* Returns one of the normal ares status codes like ARES_SUCCESS */
ares_status_t ares__send_query(struct query *query, struct timeval *now);
ares_status_t ares__requeue_query(struct query *query, struct timeval *now);
ares_status_t ares__send_query(struct query *query, const ares_timeval_t *now);
ares_status_t ares__requeue_query(struct query *query,
const ares_timeval_t *now);
/*! Retrieve a list of names to use for searching. The first successful
* query in the list wins. This function also uses the HOSTSALIASES file
@ -402,10 +419,10 @@ void ares__destroy_rand_state(ares_rand_state *state);
void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len);
unsigned short ares__generate_new_id(ares_rand_state *state);
struct timeval ares__tvnow(void);
void ares__timeval_remaining(struct timeval *remaining,
const struct timeval *now,
const struct timeval *tout);
ares_timeval_t ares__tvnow(void);
void ares__timeval_remaining(ares_timeval_t *remaining,
const ares_timeval_t *now,
const ares_timeval_t *tout);
ares_status_t ares__expand_name_validated(const unsigned char *encoded,
const unsigned char *abuf,
size_t alen, char **s, size_t *enclen,
@ -640,11 +657,11 @@ ares_status_t ares__qcache_create(ares_rand_state *rand_state,
ares__qcache_t **cache_out);
void ares__qcache_flush(ares__qcache_t *cache);
ares_status_t ares_qcache_insert(ares_channel_t *channel,
const struct timeval *now,
const ares_timeval_t *now,
const struct query *query,
ares_dns_record_t *dnsrec);
ares_status_t ares_qcache_fetch(ares_channel_t *channel,
const struct timeval *now,
const ares_timeval_t *now,
const ares_dns_record_t *dnsrec,
const ares_dns_record_t **dnsrec_resp);
@ -660,14 +677,6 @@ void ares_event_thread_destroy(ares_channel_t *channel);
ares_status_t ares_event_thread_init(ares_channel_t *channel);
#ifdef _MSC_VER
typedef __int64 ares_int64_t;
typedef unsigned __int64 ares_uint64_t;
#else
typedef long long ares_int64_t;
typedef unsigned long long ares_uint64_t;
#endif
#ifdef _WIN32
# define HOSTENT_ADDRTYPE_TYPE short
# define HOSTENT_LENGTH_TYPE short

View file

@ -50,17 +50,18 @@
#include "ares_nameser.h"
#include "ares_dns.h"
static void timeadd(struct timeval *now, size_t millisecs);
static ares_bool_t try_again(int errnum);
static void write_tcp_data(ares_channel_t *channel, fd_set *write_fds,
ares_socket_t write_fd);
static void read_packets(ares_channel_t *channel, fd_set *read_fds,
ares_socket_t read_fd, struct timeval *now);
static void process_timeouts(ares_channel_t *channel, struct timeval *now);
static void timeadd(ares_timeval_t *now, size_t millisecs);
static ares_bool_t try_again(int errnum);
static void write_tcp_data(ares_channel_t *channel, fd_set *write_fds,
ares_socket_t write_fd);
static void read_packets(ares_channel_t *channel, fd_set *read_fds,
ares_socket_t read_fd, const ares_timeval_t *now);
static void process_timeouts(ares_channel_t *channel,
const ares_timeval_t *now);
static ares_status_t process_answer(ares_channel_t *channel,
const unsigned char *abuf, size_t alen,
struct server_connection *conn,
ares_bool_t tcp, struct timeval *now);
ares_bool_t tcp, const ares_timeval_t *now);
static void handle_conn_error(struct server_connection *conn,
ares_bool_t critical_failure);
@ -111,7 +112,7 @@ static void server_increment_failures(struct server_state *server,
{
ares__slist_node_t *node;
const ares_channel_t *channel = server->channel;
struct timeval next_retry_time;
ares_timeval_t next_retry_time;
node = ares__slist_node_find(channel->servers, server);
if (node == NULL) {
@ -145,8 +146,8 @@ static void server_set_good(struct server_state *server, ares_bool_t used_tcp)
ares__slist_node_reinsert(node);
}
server->next_retry_time.tv_sec = 0;
server->next_retry_time.tv_usec = 0;
server->next_retry_time.sec = 0;
server->next_retry_time.usec = 0;
invoke_server_state_cb(server, ARES_TRUE,
used_tcp == ARES_TRUE ? ARES_SERV_STATE_TCP
@ -154,10 +155,10 @@ static void server_set_good(struct server_state *server, ares_bool_t used_tcp)
}
/* return true if now is exactly check time or later */
ares_bool_t ares__timedout(const struct timeval *now,
const struct timeval *check)
ares_bool_t ares__timedout(const ares_timeval_t *now,
const ares_timeval_t *check)
{
ares_int64_t secs = ((ares_int64_t)now->tv_sec - (ares_int64_t)check->tv_sec);
ares_int64_t secs = (now->sec - check->sec);
if (secs > 0) {
return ARES_TRUE; /* yes, timed out */
@ -167,20 +168,20 @@ ares_bool_t ares__timedout(const struct timeval *now,
}
/* if the full seconds were identical, check the sub second parts */
return ((ares_int64_t)now->tv_usec - (ares_int64_t)check->tv_usec) >= 0
return ((ares_int64_t)now->usec - (ares_int64_t)check->usec) >= 0
? ARES_TRUE
: ARES_FALSE;
}
/* add the specific number of milliseconds to the time in the first argument */
static void timeadd(struct timeval *now, size_t millisecs)
static void timeadd(ares_timeval_t *now, size_t millisecs)
{
now->tv_sec += (time_t)millisecs / 1000;
now->tv_usec += (time_t)((millisecs % 1000) * 1000);
now->sec += (ares_int64_t)millisecs / 1000;
now->usec += (unsigned int)((millisecs % 1000) * 1000);
if (now->tv_usec >= 1000000) {
++(now->tv_sec);
now->tv_usec -= 1000000;
if (now->usec >= 1000000) {
now->sec += now->usec / 1000000;
now->usec %= 1000000;
}
}
@ -191,7 +192,7 @@ static void processfds(ares_channel_t *channel, fd_set *read_fds,
ares_socket_t read_fd, fd_set *write_fds,
ares_socket_t write_fd)
{
struct timeval now;
ares_timeval_t now;
if (channel == NULL) {
return;
@ -324,7 +325,8 @@ static void write_tcp_data(ares_channel_t *channel, fd_set *write_fds,
* a packet if we finish reading one.
*/
static void read_tcp_data(ares_channel_t *channel,
struct server_connection *conn, struct timeval *now)
struct server_connection *conn,
const ares_timeval_t *now)
{
ares_ssize_t count;
struct server_state *server = conn->server;
@ -463,7 +465,7 @@ fail:
/* If any UDP sockets select true for reading, process them. */
static void read_udp_packets_fd(ares_channel_t *channel,
struct server_connection *conn,
struct timeval *now)
const ares_timeval_t *now)
{
ares_ssize_t read_len;
unsigned char buf[MAXENDSSZ + 1];
@ -527,7 +529,7 @@ static void read_udp_packets_fd(ares_channel_t *channel,
}
static void read_packets(ares_channel_t *channel, fd_set *read_fds,
ares_socket_t read_fd, struct timeval *now)
ares_socket_t read_fd, const ares_timeval_t *now)
{
size_t i;
ares_socket_t *socketlist = NULL;
@ -594,7 +596,7 @@ static void read_packets(ares_channel_t *channel, fd_set *read_fds,
}
/* If any queries have timed out, note the timeout and move them on. */
static void process_timeouts(ares_channel_t *channel, struct timeval *now)
static void process_timeouts(ares_channel_t *channel, const ares_timeval_t *now)
{
ares__slist_node_t *node =
ares__slist_node_first(channel->queries_by_timeout);
@ -667,7 +669,7 @@ done:
static ares_status_t process_answer(ares_channel_t *channel,
const unsigned char *abuf, size_t alen,
struct server_connection *conn,
ares_bool_t tcp, struct timeval *now)
ares_bool_t tcp, const ares_timeval_t *now)
{
struct query *query;
/* Cache these as once ares__send_query() gets called, it may end up
@ -814,7 +816,8 @@ static void handle_conn_error(struct server_connection *conn,
ares__close_connection(conn);
}
ares_status_t ares__requeue_query(struct query *query, struct timeval *now)
ares_status_t ares__requeue_query(struct query *query,
const ares_timeval_t *now)
{
ares_channel_t *channel = query->channel;
size_t max_tries = ares__slist_len(channel->servers) * channel->tries;
@ -884,8 +887,9 @@ static struct server_state *ares__random_server(ares_channel_t *channel)
static struct server_state *ares__failover_server(ares_channel_t *channel)
{
struct server_state *first_server = ares__slist_first_val(channel->servers);
struct server_state *last_server = ares__slist_last_val(channel->servers);
unsigned short r;
const struct server_state *last_server =
ares__slist_last_val(channel->servers);
unsigned short r;
/* Defensive code against no servers being available on the channel. */
if (first_server == NULL) {
@ -912,7 +916,7 @@ static struct server_state *ares__failover_server(ares_channel_t *channel)
ares__rand_bytes(channel->rand_state, (unsigned char *)&r, sizeof(r));
if (r % channel->server_retry_chance == 0) {
/* Select a suitable failed server to retry. */
struct timeval now = ares__tvnow();
ares_timeval_t now = ares__tvnow();
ares__slist_node_t *node;
for (node = ares__slist_node_first(channel->servers); node != NULL;
node = ares__slist_node_next(node)) {
@ -989,7 +993,7 @@ static size_t ares__calc_query_timeout(const struct query *query)
return timeplus;
}
ares_status_t ares__send_query(struct query *query, struct timeval *now)
ares_status_t ares__send_query(struct query *query, const ares_timeval_t *now)
{
ares_channel_t *channel = query->channel;
struct server_state *server;

View file

@ -137,7 +137,7 @@ fail:
}
static void ares__qcache_expire(ares__qcache_t *cache,
const struct timeval *now)
const ares_timeval_t *now)
{
ares__slist_node_t *node;
@ -147,7 +147,9 @@ static void ares__qcache_expire(ares__qcache_t *cache,
while ((node = ares__slist_node_first(cache->expire)) != NULL) {
const ares__qcache_entry_t *entry = ares__slist_node_val(node);
if (entry->expire_ts > now->tv_sec) {
/* If now is NULL, we're flushing everything, so don't break */
if (now != NULL && entry->expire_ts > now->sec) {
break;
}
@ -158,9 +160,7 @@ static void ares__qcache_expire(ares__qcache_t *cache,
void ares__qcache_flush(ares__qcache_t *cache)
{
struct timeval now;
memset(&now, 0, sizeof(now));
ares__qcache_expire(cache, &now);
ares__qcache_expire(cache, NULL /* flush all */);
}
void ares__qcache_destroy(ares__qcache_t *cache)
@ -254,7 +254,10 @@ static unsigned int ares__qcache_calc_minttl(ares_dns_record_t *dnsrec)
ares_dns_record_rr_get(dnsrec, (ares_dns_section_t)sect, i);
ares_dns_rec_type_t type = ares_dns_rr_get_type(rr);
unsigned int ttl = ares_dns_rr_get_ttl(rr);
if (type == ARES_REC_TYPE_OPT || type == ARES_REC_TYPE_SOA) {
/* TTL is meaningless on these record types */
if (type == ARES_REC_TYPE_OPT || type == ARES_REC_TYPE_SOA ||
type == ARES_REC_TYPE_SIG) {
continue;
}
@ -319,7 +322,7 @@ done:
static ares_status_t ares__qcache_insert(ares__qcache_t *qcache,
ares_dns_record_t *dnsrec,
const unsigned char *qbuf, size_t qlen,
const struct timeval *now)
const ares_timeval_t *now)
{
ares__qcache_entry_t *entry;
unsigned int ttl;
@ -362,8 +365,8 @@ static ares_status_t ares__qcache_insert(ares__qcache_t *qcache,
}
entry->dnsrec = dnsrec;
entry->expire_ts = now->tv_sec + (time_t)ttl;
entry->insert_ts = now->tv_sec;
entry->expire_ts = now->sec + (time_t)ttl;
entry->insert_ts = now->sec;
/* We can't guarantee the server responded with the same flags as the
* request had, so we have to re-parse the request in order to generate the
@ -394,7 +397,7 @@ fail:
}
ares_status_t ares_qcache_fetch(ares_channel_t *channel,
const struct timeval *now,
const ares_timeval_t *now,
const ares_dns_record_t *dnsrec,
const ares_dns_record_t **dnsrec_resp)
{
@ -425,7 +428,7 @@ ares_status_t ares_qcache_fetch(ares_channel_t *channel,
}
ares_dns_record_write_ttl_decrement(
entry->dnsrec, (unsigned int)(now->tv_sec - entry->insert_ts));
entry->dnsrec, (unsigned int)(now->sec - entry->insert_ts));
*dnsrec_resp = entry->dnsrec;
@ -435,7 +438,7 @@ done:
}
ares_status_t ares_qcache_insert(ares_channel_t *channel,
const struct timeval *now,
const ares_timeval_t *now,
const struct query *query,
ares_dns_record_t *dnsrec)
{

View file

@ -70,7 +70,7 @@ static void ares_rc4_generate_key(ares_rand_rc4 *rc4_state, unsigned char *key,
size_t i;
size_t len = 0;
unsigned int data;
struct timeval tv;
ares_timeval_t tv;
if (key_len != ARES_RC4_KEY_LEN) {
return;
@ -89,12 +89,12 @@ static void ares_rc4_generate_key(ares_rand_rc4 *rc4_state, unsigned char *key,
len += sizeof(data);
tv = ares__tvnow();
data = (unsigned int)((tv.tv_sec | tv.tv_usec) & 0xFFFFFFFF);
data = (unsigned int)((tv.sec | tv.usec) & 0xFFFFFFFF);
memcpy(key + len, &data, sizeof(data));
len += sizeof(data);
srand(ares_u32_from_ptr(rc4_state) | ares_u32_from_ptr(&i) |
(unsigned int)((tv.tv_sec | tv.tv_usec) & 0xFFFFFFFF));
(unsigned int)((tv.sec | tv.usec) & 0xFFFFFFFF));
for (i = len; i < key_len; i++) {
key[i] = (unsigned char)(rand() % 256); /* LCOV_EXCL_LINE */

View file

@ -55,7 +55,7 @@ static ares_status_t ares_send_dnsrec_int(ares_channel_t *channel,
{
struct query *query;
size_t packetsz;
struct timeval now = ares__tvnow();
ares_timeval_t now = ares__tvnow();
ares_status_t status;
unsigned short id = generate_unique_qid(channel);
const ares_dns_record_t *dnsrec_resp = NULL;
@ -91,9 +91,9 @@ static ares_status_t ares_send_dnsrec_int(ares_channel_t *channel,
return status;
}
query->qid = id;
query->timeout.tv_sec = 0;
query->timeout.tv_usec = 0;
query->qid = id;
query->timeout.sec = 0;
query->timeout.usec = 0;
/* Ignore first 2 bytes, assign our own query id */
query->qbuf[0] = (unsigned char)((id >> 8) & 0xFF);

View file

@ -260,6 +260,11 @@ ares_bool_t ares__is_hostnamech(int ch)
ares_bool_t ares__is_hostname(const char *str)
{
size_t i;
if (str == NULL) {
return ARES_FALSE;
}
for (i = 0; str[i] != 0; i++) {
if (!ares__is_hostnamech(str[i])) {
return ARES_FALSE;
@ -267,3 +272,19 @@ ares_bool_t ares__is_hostname(const char *str)
}
return ARES_TRUE;
}
ares_bool_t ares__str_isprint(const char *str, size_t len)
{
size_t i;
if (str == NULL && len != 0) {
return ARES_FALSE;
}
for (i = 0; i < len; i++) {
if (!ares__isprint(str[i])) {
return ARES_FALSE;
}
}
return ARES_TRUE;
}

View file

@ -62,5 +62,18 @@ ares_bool_t ares__is_hostnamech(int ch);
ares_bool_t ares__is_hostname(const char *str);
/*! Validate the string provided is printable. The length specified must be
* at least the size of the buffer provided. If a NULL-terminator is hit
* before the length provided is hit, this will not be considered a valid
* printable string. This does not validate that the string is actually
* NULL terminated.
*
* \param[in] str Buffer containing string to evaluate.
* \param[in] len Number of characters to evaluate within provided buffer.
* If 0, will return TRUE since it did not hit an exception.
* \return ARES_TRUE if the entire string is printable, ARES_FALSE if not.
*/
ares_bool_t ares__str_isprint(const char *str, size_t len);
#endif /* __ARES_STR_H */

View file

@ -179,12 +179,15 @@ static ares_status_t read_resolver(const dns_resolver_t *resolver,
sysconfig->domains = new_domains;
for (i = 0; i < resolver->n_search; i++) {
const char *search;
/* UBSAN: copy pointer using memcpy due to misalignment */
memcpy(&search, resolver->search + i, sizeof(search));
/* Skip duplicates */
if (search_is_duplicate(sysconfig, resolver->search[i])) {
if (search_is_duplicate(sysconfig, search)) {
continue;
}
sysconfig->domains[sysconfig->ndomains] =
ares_strdup(resolver->search[i]);
sysconfig->domains[sysconfig->ndomains] = ares_strdup(search);
if (sysconfig->domains[sysconfig->ndomains] == NULL) {
return ARES_ENOMEM;
}
@ -227,21 +230,31 @@ static ares_status_t read_resolver(const dns_resolver_t *resolver,
*/
for (i = 0; i < resolver->n_nameserver; i++) {
struct ares_addr addr;
unsigned short addrport;
struct ares_addr addr;
unsigned short addrport;
const struct sockaddr *sockaddr;
/* UBSAN alignment workaround to fetch memory address */
memcpy(&sockaddr, resolver->nameserver + i, sizeof(sockaddr));
if (sockaddr->sa_family == AF_INET) {
/* NOTE: memcpy sockaddr_in due to alignment issues found by UBSAN due to
* dnsinfo packing */
struct sockaddr_in addr_in;
memcpy(&addr_in, sockaddr, sizeof(addr_in));
if (resolver->nameserver[i]->sa_family == AF_INET) {
struct sockaddr_in *addr_in =
(struct sockaddr_in *)(void *)resolver->nameserver[i];
addr.family = AF_INET;
memcpy(&addr.addr.addr4, &(addr_in->sin_addr), sizeof(addr.addr.addr4));
addrport = ntohs(addr_in->sin_port);
} else if (resolver->nameserver[i]->sa_family == AF_INET6) {
struct sockaddr_in6 *addr_in6 =
(struct sockaddr_in6 *)(void *)resolver->nameserver[i];
memcpy(&addr.addr.addr4, &(addr_in.sin_addr), sizeof(addr.addr.addr4));
addrport = ntohs(addr_in.sin_port);
} else if (sockaddr->sa_family == AF_INET6) {
/* NOTE: memcpy sockaddr_in6 due to alignment issues found by UBSAN due to
* dnsinfo packing */
struct sockaddr_in6 addr_in6;
memcpy(&addr_in6, sockaddr, sizeof(addr_in6));
addr.family = AF_INET6;
memcpy(&addr.addr.addr6, &(addr_in6->sin6_addr), sizeof(addr.addr.addr6));
addrport = ntohs(addr_in6->sin6_port);
memcpy(&addr.addr.addr6, &(addr_in6.sin6_addr), sizeof(addr.addr.addr6));
addrport = ntohs(addr_in6.sin6_port);
} else {
continue;
}
@ -266,7 +279,19 @@ static ares_status_t read_resolvers(dns_resolver_t **resolvers, int nresolvers,
int i;
for (i = 0; status == ARES_SUCCESS && i < nresolvers; i++) {
status = read_resolver(resolvers[i], sysconfig);
const dns_resolver_t *resolver_ptr;
dns_resolver_t resolver;
/* UBSAN doesn't like that this is unaligned, lets use memcpy to get the
* address. Equivalent to:
* resolver = resolvers[i]
*/
memcpy(&resolver_ptr, resolvers + i, sizeof(resolver_ptr));
/* UBSAN. If the pointer is misaligned, try to use memcpy to get the data
* into a new structure that is hopefully aligned properly */
memcpy(&resolver, resolver_ptr, sizeof(resolver));
status = read_resolver(&resolver, sysconfig);
}
return status;

View file

@ -34,62 +34,88 @@
#include "ares.h"
#include "ares_private.h"
void ares__timeval_remaining(struct timeval *remaining,
const struct timeval *now,
const struct timeval *tout)
void ares__timeval_remaining(ares_timeval_t *remaining,
const ares_timeval_t *now,
const ares_timeval_t *tout)
{
memset(remaining, 0, sizeof(*remaining));
/* Expired! */
if (tout->tv_sec < now->tv_sec ||
(tout->tv_sec == now->tv_sec && tout->tv_usec < now->tv_usec)) {
if (tout->sec < now->sec ||
(tout->sec == now->sec && tout->usec < now->usec)) {
return;
}
remaining->tv_sec = tout->tv_sec - now->tv_sec;
if (tout->tv_usec < now->tv_usec) {
remaining->tv_sec -= 1;
remaining->tv_usec = (tout->tv_usec + 1000000) - now->tv_usec;
remaining->sec = tout->sec - now->sec;
if (tout->usec < now->usec) {
remaining->sec -= 1;
remaining->usec = (tout->usec + 1000000) - now->usec;
} else {
remaining->tv_usec = tout->tv_usec - now->tv_usec;
remaining->usec = tout->usec - now->usec;
}
}
static struct timeval ares_timeval_to_struct_timeval(const ares_timeval_t *atv)
{
struct timeval tv;
tv.tv_sec = (time_t)atv->sec;
tv.tv_usec = (int)atv->usec;
return tv;
}
static ares_timeval_t struct_timeval_to_ares_timeval(const struct timeval *tv)
{
ares_timeval_t atv;
atv.sec = (ares_int64_t)tv->tv_sec;
atv.usec = (unsigned int)tv->tv_usec;
return atv;
}
struct timeval *ares_timeout(const ares_channel_t *channel,
struct timeval *maxtv, struct timeval *tvbuf)
{
const struct query *query;
ares__slist_node_t *node;
struct timeval now;
ares_timeval_t now;
ares_timeval_t atvbuf;
ares_timeval_t amaxtv;
/* The minimum timeout of all queries is always the first entry in
* channel->queries_by_timeout */
node = ares__slist_node_first(channel->queries_by_timeout);
/* no queries/timeout */
if (node == NULL) {
return maxtv; /* <-- maxtv can be null though, hrm */
return maxtv;
}
query = ares__slist_node_val(node);
now = ares__tvnow();
ares__timeval_remaining(tvbuf, &now, &query->timeout);
ares__timeval_remaining(&atvbuf, &now, &query->timeout);
*tvbuf = ares_timeval_to_struct_timeval(&atvbuf);
if (maxtv == NULL) {
return tvbuf;
}
/* Return the minimum time between maxtv and tvbuf */
amaxtv = struct_timeval_to_ares_timeval(maxtv);
if (tvbuf->tv_sec > maxtv->tv_sec) {
if (atvbuf.sec > amaxtv.sec) {
return maxtv;
}
if (tvbuf->tv_sec < maxtv->tv_sec) {
if (atvbuf.sec < amaxtv.sec) {
return tvbuf;
}
if (tvbuf->tv_usec > maxtv->tv_usec) {
if (atvbuf.usec > amaxtv.usec) {
return maxtv;
}

View file

@ -593,8 +593,8 @@ static ares_status_t ares__server_create(ares_channel_t *channel,
server->udp_port = ares__sconfig_get_port(channel, sconfig, ARES_FALSE);
server->tcp_port = ares__sconfig_get_port(channel, sconfig, ARES_TRUE);
server->addr.family = sconfig->addr.family;
server->next_retry_time.tv_sec = 0;
server->next_retry_time.tv_usec = 0;
server->next_retry_time.sec = 0;
server->next_retry_time.usec = 0;
if (sconfig->addr.family == AF_INET) {
memcpy(&server->addr.addr.addr4, &sconfig->addr.addr.addr4,
@ -671,10 +671,11 @@ static ares_bool_t ares__server_in_newconfig(const struct server_state *server,
return ARES_FALSE;
}
static void ares__servers_remove_stale(ares_channel_t *channel,
ares__llist_t *srvlist)
static ares_bool_t ares__servers_remove_stale(ares_channel_t *channel,
ares__llist_t *srvlist)
{
ares__slist_node_t *snode = ares__slist_node_first(channel->servers);
ares_bool_t stale_removed = ARES_FALSE;
ares__slist_node_t *snode = ares__slist_node_first(channel->servers);
while (snode != NULL) {
ares__slist_node_t *snext = ares__slist_node_next(snode);
@ -683,9 +684,11 @@ static void ares__servers_remove_stale(ares_channel_t *channel,
/* This will clean up all server state via the destruction callback and
* move any queries to new servers */
ares__slist_node_destroy(snode);
stale_removed = ARES_TRUE;
}
snode = snext;
}
return stale_removed;
}
static void ares__servers_trim_single(ares_channel_t *channel)
@ -702,6 +705,7 @@ ares_status_t ares__servers_update(ares_channel_t *channel,
ares__llist_node_t *node;
size_t idx = 0;
ares_status_t status;
ares_bool_t list_changed = ARES_FALSE;
if (channel == NULL) {
return ARES_EFORMERR;
@ -747,13 +751,17 @@ ares_status_t ares__servers_update(ares_channel_t *channel,
if (status != ARES_SUCCESS) {
goto done;
}
list_changed = ARES_TRUE;
}
idx++;
}
/* Remove any servers that don't exist in the current configuration */
ares__servers_remove_stale(channel, server_list);
if (ares__servers_remove_stale(channel, server_list)) {
list_changed = ARES_TRUE;
}
/* Trim to one server if ARES_FLAG_PRIMARY is set. */
if (channel->flags & ARES_FLAG_PRIMARY) {
@ -765,8 +773,10 @@ ares_status_t ares__servers_update(ares_channel_t *channel,
channel->optmask |= ARES_OPT_SERVERS;
}
/* Clear any cached query results */
ares__qcache_flush(channel->qcache);
/* Clear any cached query results only if the server list changed */
if (list_changed) {
ares__qcache_flush(channel->qcache);
}
status = ARES_SUCCESS;

View file

@ -35,72 +35,72 @@
#include <sys/socket.h>
#include <netinet/in.h>
#define DNSINFO_VERSION 20170629
#define DNSINFO_VERSION 20170629
#define DEFAULT_SEARCH_ORDER 200000 /* search order for the "default" resolver domain name */
#define DNS_PTR(type, name) \
union { \
type name; \
uint64_t _ ## name ## _p; \
}
#define DNS_PTR(type, name) \
union { \
type name; \
uint64_t _ ## name ## _p; \
}
#define DNS_VAR(type, name) \
type name
#define DNS_VAR(type, name) \
type name
#pragma pack(4)
typedef struct {
struct in_addr address;
struct in_addr mask;
struct in_addr address;
struct in_addr mask;
} dns_sortaddr_t;
#pragma pack()
#pragma pack(4)
typedef struct {
DNS_PTR(char *, domain); /* domain */
DNS_VAR(int32_t, n_nameserver); /* # nameserver */
DNS_PTR(struct sockaddr **, nameserver);
DNS_VAR(uint16_t, port); /* port (in host byte order) */
DNS_VAR(int32_t, n_search); /* # search */
DNS_PTR(char **, search);
DNS_VAR(int32_t, n_sortaddr); /* # sortaddr */
DNS_PTR(dns_sortaddr_t **, sortaddr);
DNS_PTR(char *, options); /* options */
DNS_VAR(uint32_t, timeout); /* timeout */
DNS_VAR(uint32_t, search_order); /* search_order */
DNS_VAR(uint32_t, if_index);
DNS_VAR(uint32_t, flags);
DNS_VAR(uint32_t, reach_flags); /* SCNetworkReachabilityFlags */
DNS_VAR(uint32_t, service_identifier);
DNS_PTR(char *, cid); /* configuration identifer */
DNS_PTR(char *, if_name); /* if_index interface name */
DNS_PTR(char *, domain); /* domain */
DNS_VAR(int32_t, n_nameserver); /* # nameserver */
DNS_PTR(struct sockaddr **, nameserver);
DNS_VAR(uint16_t, port); /* port (in host byte order) */
DNS_VAR(int32_t, n_search); /* # search */
DNS_PTR(char **, search);
DNS_VAR(int32_t, n_sortaddr); /* # sortaddr */
DNS_PTR(dns_sortaddr_t **, sortaddr);
DNS_PTR(char *, options); /* options */
DNS_VAR(uint32_t, timeout); /* timeout */
DNS_VAR(uint32_t, search_order); /* search_order */
DNS_VAR(uint32_t, if_index);
DNS_VAR(uint32_t, flags);
DNS_VAR(uint32_t, reach_flags); /* SCNetworkReachabilityFlags */
DNS_VAR(uint32_t, service_identifier);
DNS_PTR(char *, cid); /* configuration identifer */
DNS_PTR(char *, if_name); /* if_index interface name */
} dns_resolver_t;
#pragma pack()
#define DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS 0x0002 /* always requesting for A dns records in queries */
#define DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS 0x0004 /* always requesting for AAAA dns records in queries */
#define DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS 0x0002 /* always requesting for A dns records in queries */
#define DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS 0x0004 /* always requesting for AAAA dns records in queries */
#define DNS_RESOLVER_FLAGS_REQUEST_ALL_RECORDS \
(DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS | DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS)
#define DNS_RESOLVER_FLAGS_REQUEST_ALL_RECORDS \
(DNS_RESOLVER_FLAGS_REQUEST_A_RECORDS | DNS_RESOLVER_FLAGS_REQUEST_AAAA_RECORDS)
#define DNS_RESOLVER_FLAGS_SCOPED 0x1000 /* configuration is for scoped questions */
#define DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC 0x2000 /* configuration is service-specific */
#define DNS_RESOLVER_FLAGS_SUPPLEMENTAL 0x4000 /* supplemental match configuration */
#define DNS_RESOLVER_FLAGS_SCOPED 0x1000 /* configuration is for scoped questions */
#define DNS_RESOLVER_FLAGS_SERVICE_SPECIFIC 0x2000 /* configuration is service-specific */
#define DNS_RESOLVER_FLAGS_SUPPLEMENTAL 0x4000 /* supplemental match configuration */
#pragma pack(4)
typedef struct {
DNS_VAR(int32_t, n_resolver); /* resolver configurations */
DNS_PTR(dns_resolver_t **, resolver);
DNS_VAR(int32_t, n_scoped_resolver); /* "scoped" resolver configurations */
DNS_PTR(dns_resolver_t **, scoped_resolver);
DNS_VAR(uint64_t, generation);
DNS_VAR(int32_t, n_service_specific_resolver);
DNS_PTR(dns_resolver_t **, service_specific_resolver);
DNS_VAR(uint32_t, version);
DNS_VAR(int32_t, n_resolver); /* resolver configurations */
DNS_PTR(dns_resolver_t **, resolver);
DNS_VAR(int32_t, n_scoped_resolver); /* "scoped" resolver configurations */
DNS_PTR(dns_resolver_t **, scoped_resolver);
DNS_VAR(uint64_t, generation);
DNS_VAR(int32_t, n_service_specific_resolver);
DNS_PTR(dns_resolver_t **, service_specific_resolver);
DNS_VAR(uint32_t, version);
} dns_config_t;
#pragma pack()
@ -111,18 +111,18 @@ __BEGIN_DECLS
* DNS configuration access APIs
*/
const char *
dns_configuration_notify_key (void) API_AVAILABLE(macos(10.4), ios(2.0));
dns_configuration_notify_key (void) API_AVAILABLE(macos(10.4), ios(2.0));
dns_config_t *
dns_configuration_copy (void) API_AVAILABLE(macos(10.4), ios(2.0));
dns_configuration_copy (void) API_AVAILABLE(macos(10.4), ios(2.0));
void
dns_configuration_free (dns_config_t *config) API_AVAILABLE(macos(10.4), ios(2.0));
dns_configuration_free (dns_config_t *config) API_AVAILABLE(macos(10.4), ios(2.0));
void
_dns_configuration_ack (dns_config_t *config,
const char *bundle_id) API_AVAILABLE(macos(10.8), ios(6.0));
_dns_configuration_ack (dns_config_t *config,
const char *bundle_id) API_AVAILABLE(macos(10.8), ios(6.0));
__END_DECLS
#endif /* __DNSINFO_H__ */
#endif /* __DNSINFO_H__ */