From 27893d38df34bf77591c3b5a57892e73119d28af Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Wed, 24 Apr 2024 23:37:57 +0200 Subject: [PATCH] deps: update c-ares to 1.20.0 Co-authored-by: Richard Lau PR-URL: https://github.com/nodejs/node/pull/50082 Reviewed-By: Luigi Pinca Reviewed-By: Yagiz Nizipli --- graal-nodejs/LICENSE | 31 +- graal-nodejs/deps/cares/CHANGES | 292 +++- graal-nodejs/deps/cares/CMakeLists.txt | 14 +- graal-nodejs/deps/cares/INSTALL.md | 25 +- graal-nodejs/deps/cares/LICENSE.md | 32 +- graal-nodejs/deps/cares/Makefile.Watcom | 8 +- graal-nodejs/deps/cares/Makefile.am | 21 + graal-nodejs/deps/cares/Makefile.dj | 5 +- graal-nodejs/deps/cares/Makefile.in | 21 + graal-nodejs/deps/cares/Makefile.m32 | 14 +- graal-nodejs/deps/cares/Makefile.msvc | 45 +- graal-nodejs/deps/cares/Makefile.netware | 11 +- graal-nodejs/deps/cares/README.msvc | 2 +- graal-nodejs/deps/cares/RELEASE-NOTES | 91 +- graal-nodejs/deps/cares/acinclude.m4 | 3 +- graal-nodejs/deps/cares/aminclude_static.am | 2 +- graal-nodejs/deps/cares/buildconf | 2 + graal-nodejs/deps/cares/buildconf.bat | 3 + .../deps/cares/c-ares-config.cmake.in | 3 + graal-nodejs/deps/cares/cares.gyp | 36 +- graal-nodejs/deps/cares/configure | 198 ++- graal-nodejs/deps/cares/configure.ac | 25 +- graal-nodejs/deps/cares/docs/CMakeLists.txt | 2 + graal-nodejs/deps/cares/docs/Makefile.am | 7 +- graal-nodejs/deps/cares/docs/Makefile.in | 10 +- graal-nodejs/deps/cares/docs/Makefile.inc | 2 + graal-nodejs/deps/cares/docs/acountry.1 | 54 - graal-nodejs/deps/cares/docs/adig.1 | 18 + graal-nodejs/deps/cares/docs/ahost.1 | 18 + graal-nodejs/deps/cares/docs/ares_cancel.3 | 2 + .../deps/cares/docs/ares_create_query.3 | 2 + graal-nodejs/deps/cares/docs/ares_destroy.3 | 2 + .../deps/cares/docs/ares_destroy_options.3 | 2 + graal-nodejs/deps/cares/docs/ares_dup.3 | 2 + .../deps/cares/docs/ares_expand_name.3 | 2 + .../deps/cares/docs/ares_expand_string.3 | 2 + graal-nodejs/deps/cares/docs/ares_fds.3 | 2 + graal-nodejs/deps/cares/docs/ares_free_data.3 | 2 + .../deps/cares/docs/ares_free_hostent.3 | 2 + .../deps/cares/docs/ares_free_string.3 | 2 + .../deps/cares/docs/ares_freeaddrinfo.3 | 2 + .../deps/cares/docs/ares_get_servers.3 | 2 + .../deps/cares/docs/ares_get_servers_ports.3 | 3 + .../deps/cares/docs/ares_getaddrinfo.3 | 2 + .../deps/cares/docs/ares_gethostbyaddr.3 | 2 + .../deps/cares/docs/ares_gethostbyname.3 | 2 + .../deps/cares/docs/ares_gethostbyname_file.3 | 2 + .../deps/cares/docs/ares_getnameinfo.3 | 2 + graal-nodejs/deps/cares/docs/ares_getsock.3 | 2 + graal-nodejs/deps/cares/docs/ares_inet_ntop.3 | 2 + graal-nodejs/deps/cares/docs/ares_inet_pton.3 | 2 + graal-nodejs/deps/cares/docs/ares_init.3 | 2 + .../deps/cares/docs/ares_init_options.3 | 17 +- .../deps/cares/docs/ares_library_cleanup.3 | 2 + .../deps/cares/docs/ares_library_init.3 | 2 + .../cares/docs/ares_library_init_android.3 | 2 + .../cares/docs/ares_library_initialized.3 | 2 + graal-nodejs/deps/cares/docs/ares_mkquery.3 | 2 + .../deps/cares/docs/ares_parse_a_reply.3 | 2 + .../deps/cares/docs/ares_parse_aaaa_reply.3 | 2 + .../deps/cares/docs/ares_parse_caa_reply.3 | 2 + .../deps/cares/docs/ares_parse_mx_reply.3 | 2 + .../deps/cares/docs/ares_parse_naptr_reply.3 | 2 + .../deps/cares/docs/ares_parse_ns_reply.3 | 2 + .../deps/cares/docs/ares_parse_ptr_reply.3 | 2 + .../deps/cares/docs/ares_parse_soa_reply.3 | 2 + .../deps/cares/docs/ares_parse_srv_reply.3 | 2 + .../deps/cares/docs/ares_parse_txt_reply.3 | 2 + .../deps/cares/docs/ares_parse_uri_reply.3 | 2 + graal-nodejs/deps/cares/docs/ares_process.3 | 2 + graal-nodejs/deps/cares/docs/ares_query.3 | 2 + .../deps/cares/docs/ares_save_options.3 | 2 + graal-nodejs/deps/cares/docs/ares_search.3 | 2 + graal-nodejs/deps/cares/docs/ares_send.3 | 2 + .../deps/cares/docs/ares_set_local_dev.3 | 2 + .../deps/cares/docs/ares_set_local_ip4.3 | 2 + .../deps/cares/docs/ares_set_local_ip6.3 | 2 + .../deps/cares/docs/ares_set_servers.3 | 2 + .../deps/cares/docs/ares_set_servers_csv.3 | 2 + .../deps/cares/docs/ares_set_servers_ports.3 | 3 + .../cares/docs/ares_set_servers_ports_csv.3 | 3 + .../cares/docs/ares_set_socket_callback.3 | 3 + .../docs/ares_set_socket_configure_callback.3 | 2 + .../cares/docs/ares_set_socket_functions.3 | 7 +- .../deps/cares/docs/ares_set_sortlist.3 | 3 + graal-nodejs/deps/cares/docs/ares_strerror.3 | 2 + graal-nodejs/deps/cares/docs/ares_timeout.3 | 2 + graal-nodejs/deps/cares/docs/ares_version.3 | 2 + graal-nodejs/deps/cares/get_ver.awk | 2 + .../deps/cares/include/CMakeLists.txt | 2 + graal-nodejs/deps/cares/include/Makefile.am | 2 + graal-nodejs/deps/cares/include/Makefile.in | 3 + graal-nodejs/deps/cares/include/ares.h | 78 +- graal-nodejs/deps/cares/include/ares_build.h | 38 +- .../deps/cares/include/ares_build.h.cmake | 9 + .../deps/cares/include/ares_build.h.in | 39 +- graal-nodejs/deps/cares/include/ares_dns.h | 41 +- .../deps/cares/include/ares_nameser.h | 26 + graal-nodejs/deps/cares/include/ares_rules.h | 39 +- .../deps/cares/include/ares_version.h | 33 +- graal-nodejs/deps/cares/libcares.pc.cmake | 3 + graal-nodejs/deps/cares/libcares.pc.in | 2 + graal-nodejs/deps/cares/ltmain.sh | 4 +- .../deps/cares/m4/ax_check_user_namespace.m4 | 7 +- .../deps/cares/m4/ax_check_uts_namespace.m4 | 7 +- graal-nodejs/deps/cares/m4/cares-compilers.m4 | 3 +- graal-nodejs/deps/cares/m4/cares-confopts.m4 | 3 +- graal-nodejs/deps/cares/m4/cares-functions.m4 | 105 +- graal-nodejs/deps/cares/m4/cares-reentrant.m4 | 5 +- graal-nodejs/deps/cares/m4/xc-am-iface.m4 | 3 +- graal-nodejs/deps/cares/m4/xc-cc-check.m4 | 3 +- graal-nodejs/deps/cares/m4/xc-lt-iface.m4 | 4 +- graal-nodejs/deps/cares/m4/xc-translit.m4 | 4 +- graal-nodejs/deps/cares/m4/xc-val-flgs.m4 | 4 +- graal-nodejs/deps/cares/m4/zz40-xc-ovr.m4 | 3 +- graal-nodejs/deps/cares/maketgz | 2 + graal-nodejs/deps/cares/msvc_ver.inc | 2 + graal-nodejs/deps/cares/src/CMakeLists.txt | 2 + graal-nodejs/deps/cares/src/Makefile.am | 2 + graal-nodejs/deps/cares/src/Makefile.in | 3 + .../deps/cares/src/lib/CMakeLists.txt | 2 + graal-nodejs/deps/cares/src/lib/Makefile.am | 2 + graal-nodejs/deps/cares/src/lib/Makefile.in | 139 +- graal-nodejs/deps/cares/src/lib/Makefile.inc | 24 +- .../cares/src/lib/ares__addrinfo2hostent.c | 41 +- .../cares/src/lib/ares__addrinfo_localhost.c | 36 +- graal-nodejs/deps/cares/src/lib/ares__buf.c | 476 +++++ graal-nodejs/deps/cares/src/lib/ares__buf.h | 252 +++ .../deps/cares/src/lib/ares__close_sockets.c | 145 +- .../deps/cares/src/lib/ares__get_hostent.c | 37 +- .../deps/cares/src/lib/ares__htable.c | 374 ++++ .../deps/cares/src/lib/ares__htable.h | 164 ++ .../deps/cares/src/lib/ares__htable_asvp.c | 195 +++ .../deps/cares/src/lib/ares__htable_asvp.h | 120 ++ .../deps/cares/src/lib/ares__htable_stvp.c | 193 +++ .../deps/cares/src/lib/ares__htable_stvp.h | 115 ++ graal-nodejs/deps/cares/src/lib/ares__llist.c | 316 ++++ graal-nodejs/deps/cares/src/lib/ares__llist.h | 203 +++ .../cares/src/lib/ares__parse_into_addrinfo.c | 36 +- .../deps/cares/src/lib/ares__read_line.c | 37 +- .../deps/cares/src/lib/ares__readaddrinfo.c | 39 +- graal-nodejs/deps/cares/src/lib/ares__slist.c | 501 ++++++ graal-nodejs/deps/cares/src/lib/ares__slist.h | 197 +++ .../deps/cares/src/lib/ares__sortaddrinfo.c | 4 +- .../deps/cares/src/lib/ares__timeval.c | 34 +- .../deps/cares/src/lib/ares_android.c | 35 +- .../deps/cares/src/lib/ares_android.h | 35 +- graal-nodejs/deps/cares/src/lib/ares_cancel.c | 98 +- .../deps/cares/src/lib/ares_config.h.cmake | 7 + .../deps/cares/src/lib/ares_config.h.in | 6 + .../deps/cares/src/lib/ares_create_query.c | 37 +- graal-nodejs/deps/cares/src/lib/ares_data.c | 36 +- graal-nodejs/deps/cares/src/lib/ares_data.h | 41 +- .../deps/cares/src/lib/ares_destroy.c | 93 +- .../deps/cares/src/lib/ares_expand_name.c | 37 +- .../deps/cares/src/lib/ares_expand_string.c | 37 +- graal-nodejs/deps/cares/src/lib/ares_fds.c | 80 +- .../deps/cares/src/lib/ares_free_hostent.c | 37 +- .../deps/cares/src/lib/ares_free_string.c | 37 +- .../deps/cares/src/lib/ares_freeaddrinfo.c | 38 +- .../deps/cares/src/lib/ares_getaddrinfo.c | 169 +- graal-nodejs/deps/cares/src/lib/ares_getenv.c | 38 +- graal-nodejs/deps/cares/src/lib/ares_getenv.h | 42 +- .../deps/cares/src/lib/ares_gethostbyaddr.c | 50 +- .../deps/cares/src/lib/ares_gethostbyname.c | 36 +- .../deps/cares/src/lib/ares_getnameinfo.c | 50 +- .../deps/cares/src/lib/ares_getsock.c | 89 +- .../deps/cares/src/lib/ares_inet_net_pton.h | 40 +- graal-nodejs/deps/cares/src/lib/ares_init.c | 410 +++-- .../deps/cares/src/lib/ares_iphlpapi.h | 42 +- graal-nodejs/deps/cares/src/lib/ares_ipv6.h | 36 +- .../deps/cares/src/lib/ares_library_init.c | 38 +- graal-nodejs/deps/cares/src/lib/ares_llist.c | 63 - graal-nodejs/deps/cares/src/lib/ares_llist.h | 39 - .../deps/cares/src/lib/ares_mkquery.c | 37 +- graal-nodejs/deps/cares/src/lib/ares_nowarn.c | 37 +- graal-nodejs/deps/cares/src/lib/ares_nowarn.h | 41 +- .../deps/cares/src/lib/ares_options.c | 49 +- .../deps/cares/src/lib/ares_parse_a_reply.c | 38 +- .../cares/src/lib/ares_parse_aaaa_reply.c | 40 +- .../deps/cares/src/lib/ares_parse_caa_reply.c | 36 +- .../deps/cares/src/lib/ares_parse_mx_reply.c | 38 +- .../cares/src/lib/ares_parse_naptr_reply.c | 39 +- .../deps/cares/src/lib/ares_parse_ns_reply.c | 36 +- .../deps/cares/src/lib/ares_parse_ptr_reply.c | 37 +- .../deps/cares/src/lib/ares_parse_soa_reply.c | 38 +- .../deps/cares/src/lib/ares_parse_srv_reply.c | 38 +- .../deps/cares/src/lib/ares_parse_txt_reply.c | 38 +- .../deps/cares/src/lib/ares_parse_uri_reply.c | 41 +- .../deps/cares/src/lib/ares_platform.c | 39 +- .../deps/cares/src/lib/ares_platform.h | 43 +- .../deps/cares/src/lib/ares_private.h | 189 +- .../deps/cares/src/lib/ares_process.c | 1532 ++++++++--------- graal-nodejs/deps/cares/src/lib/ares_query.c | 85 +- graal-nodejs/deps/cares/src/lib/ares_rand.c | 161 +- graal-nodejs/deps/cares/src/lib/ares_search.c | 42 +- graal-nodejs/deps/cares/src/lib/ares_send.c | 83 +- graal-nodejs/deps/cares/src/lib/ares_setup.h | 39 +- .../deps/cares/src/lib/ares_strcasecmp.c | 38 +- .../deps/cares/src/lib/ares_strcasecmp.h | 42 +- graal-nodejs/deps/cares/src/lib/ares_strdup.c | 38 +- graal-nodejs/deps/cares/src/lib/ares_strdup.h | 42 +- .../deps/cares/src/lib/ares_strerror.c | 37 +- .../deps/cares/src/lib/ares_strsplit.c | 35 +- .../deps/cares/src/lib/ares_strsplit.h | 40 +- .../deps/cares/src/lib/ares_timeout.c | 113 +- .../deps/cares/src/lib/ares_version.c | 27 +- graal-nodejs/deps/cares/src/lib/ares_writev.c | 79 - graal-nodejs/deps/cares/src/lib/ares_writev.h | 36 - graal-nodejs/deps/cares/src/lib/bitncmp.c | 3 +- graal-nodejs/deps/cares/src/lib/bitncmp.h | 41 +- graal-nodejs/deps/cares/src/lib/cares.rc | 36 +- graal-nodejs/deps/cares/src/lib/config-dos.h | 9 +- .../deps/cares/src/lib/config-win32.h | 38 +- .../deps/cares/src/lib/inet_net_pton.c | 3 +- graal-nodejs/deps/cares/src/lib/inet_ntop.c | 6 +- graal-nodejs/deps/cares/src/lib/setup_once.h | 43 +- .../deps/cares/src/lib/windows_port.c | 8 + .../deps/cares/src/tools/CMakeLists.txt | 19 +- graal-nodejs/deps/cares/src/tools/Makefile.am | 8 +- graal-nodejs/deps/cares/src/tools/Makefile.in | 137 +- .../deps/cares/src/tools/Makefile.inc | 2 + graal-nodejs/deps/cares/src/tools/acountry.c | 655 ------- graal-nodejs/deps/cares/src/tools/adig.c | 35 +- graal-nodejs/deps/cares/src/tools/ahost.c | 35 +- .../deps/cares/src/tools/ares_getopt.c | 2 + .../deps/cares/src/tools/ares_getopt.h | 2 + .../maintaining/maintaining-dependencies.md | 6 +- 228 files changed, 7758 insertions(+), 3752 deletions(-) delete mode 100644 graal-nodejs/deps/cares/docs/acountry.1 create mode 100644 graal-nodejs/deps/cares/src/lib/ares__buf.c create mode 100644 graal-nodejs/deps/cares/src/lib/ares__buf.h create mode 100644 graal-nodejs/deps/cares/src/lib/ares__htable.c create mode 100644 graal-nodejs/deps/cares/src/lib/ares__htable.h create mode 100644 graal-nodejs/deps/cares/src/lib/ares__htable_asvp.c create mode 100644 graal-nodejs/deps/cares/src/lib/ares__htable_asvp.h create mode 100644 graal-nodejs/deps/cares/src/lib/ares__htable_stvp.c create mode 100644 graal-nodejs/deps/cares/src/lib/ares__htable_stvp.h create mode 100644 graal-nodejs/deps/cares/src/lib/ares__llist.c create mode 100644 graal-nodejs/deps/cares/src/lib/ares__llist.h create mode 100644 graal-nodejs/deps/cares/src/lib/ares__slist.c create mode 100644 graal-nodejs/deps/cares/src/lib/ares__slist.h delete mode 100644 graal-nodejs/deps/cares/src/lib/ares_llist.c delete mode 100644 graal-nodejs/deps/cares/src/lib/ares_llist.h delete mode 100644 graal-nodejs/deps/cares/src/lib/ares_writev.c delete mode 100644 graal-nodejs/deps/cares/src/lib/ares_writev.h delete mode 100644 graal-nodejs/deps/cares/src/tools/acountry.c diff --git a/graal-nodejs/LICENSE b/graal-nodejs/LICENSE index 0888e1d0f9d..4dda3df4ddb 100644 --- a/graal-nodejs/LICENSE +++ b/graal-nodejs/LICENSE @@ -78,19 +78,30 @@ The externally maintained libraries used by Node.js are: - c-ares, located at deps/cares, is licensed as follows: """ - Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS + MIT License + + Copyright (c) 1998 Massachusetts Institute of Technology + Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS file. - Copyright 1998 by the Massachusetts Institute of Technology. + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee is hereby granted, provided that - the above copyright notice appear in all copies and that both that copyright - notice and this permission notice appear in supporting documentation, and that - the name of M.I.T. not be used in advertising or publicity pertaining to - distribution of the software without specific, written prior permission. - M.I.T. makes no representations about the suitability of this software for any - purpose. It is provided "as is" without express or implied warranty. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. """ - cjs-module-lexer, located at deps/cjs-module-lexer, is licensed as follows: diff --git a/graal-nodejs/deps/cares/CHANGES b/graal-nodejs/deps/cares/CHANGES index d465143131d..82caeb70cdc 100644 --- a/graal-nodejs/deps/cares/CHANGES +++ b/graal-nodejs/deps/cares/CHANGES @@ -1,5 +1,222 @@ Changelog for the c-ares project. Generated with git2changes.pl +Version 1.20.0 (6 Oct 2023) + +Brad House (6 Oct 2023) +- fix slist search off by 1 + +GitHub (6 Oct 2023) +- [Brad House brought this change] + + 1.20.0 release prep (#557) + +- [Brad House brought this change] + + ares__buf should return standard error codes. more helpers implemented. (#558) + + The purpose of this PR is to hopefully make the private API of this set of routines less likely to need to be changed in a future release. While this is not a public API, it could become harder in the future to change usage as it becomes more widely used within c-ares. + + Fix By: Brad House (@bradh352) + +- [Brad House brought this change] + + Update from 1989 MIT license text to modern MIT license text (#556) + + ares (and thus c-ares) was originally licensed under the 1989 MIT license text: + https://fedoraproject.org/wiki/Licensing:MIT#Old_Style_(no_advertising_without_permission) + + This change updates the license to the modern MIT license as recognized here: + https://opensource.org/license/mit/ + + care has been taken to ensure correct attributions remain for the authors contained within the copyright headers, and all authors with attributions in the headers have been contacted for approval regarding the change. Any authors which were not able to be contacted, the original copyright maintains, luckily that exists in only a single file `ares_parse_caa_reply.c` at this time. + + Please see PR #556 for the documented approvals by each contributor. + + Fix By: Brad House (@bradh352) + +- [Brad House brought this change] + + Test Harness: use ares_timeout() to calculate the value to pass to select() these days. (#555) + + The test framework was using 100ms timeout passed to select(), and not using ares_timeout() to calculate the actual recommended value based on the queries in queue. Using ares_timeout() tests the functionality of ares_timeout() itself and will provide more responsive results. + + Fix By: Brad House (@bradh352) + +- [Brad House brought this change] + + Fix for TCP back to back queries (#552) + + As per #266, TCP queries are basically broken. If we get a partial reply, things just don't work, but unlike UDP, TCP may get fragmented and we need to properly handle that. + + I've started creating a basic parser/buffer framework for c-ares for memory safety reasons, but it also helps for things like this where we shouldn't be manually tracking positions and fetching only a couple of bytes at a time from a socket. This parser/buffer will be expanded and used more in the future. + + This also resolves #206 by allowing NULL to be specified for some socket callbacks so they will auto-route to the built-in c-ares functions. + + Fixes: #206, #266 + Fix By: Brad House (@bradh352) + +- [Brad House brought this change] + + remove acountry from built tools as nerd.dk is gone (#554) + + The acountry utility required a third party DNSBL service from nerd.dk in order to operate. That service has been offline for about a year and there is no other comparable service offering. We are keeping the code in the repository as an example, but no longer building it. + + Fixes: #537 + Fix By: Brad House (@bradh352) + +- [Brad House brought this change] + + Don't requeue any queries for getaddrinfo() during destruction. (#553) + + During ares_destroy(), any outstanding queries are terminated, however ares_getaddrinfo() had an ordering issue with status codes which in some circumstances could lead to a new query being enqueued rather than honoring the termination. + + Fixes #532 + Fix By: @Chilledheart and Brad House (@bradh352) + +- [Brad House brought this change] + + ares_getaddrinfo(): Fail faster on AF_UNSPEC if we've already received one address class (#551) + + As per #541, when using AF_UNSPEC with ares_getaddrinfo() (and in turn with ares_gethostbynam()) if we receive a successful response for one address class, we should not allow the other address class to continue on with retries, just return the address class we have. + + This will limit the overall query time to whatever timeout remains for the pending query for the other address class, it will not, however, terminate the other query as it may still prove to be successful (possibly coming in less than a millisecond later) and we'd want that result still. It just turns off additional error processing to get the result back quicker. + + Fixes Bug: #541 + Fix By: Brad House (@bradh352) + +- [Sam Morris brought this change] + + Avoid producing an ill-formed result when qualifying a name with the root domain (#546) + + This prevents the result of qualifying "name" with "." being "name.." which is ill-formed. + + Fixes Bug: #545 + Fix By: Sam Morris (@yrro) + +- [Brad House brought this change] + + Configuration option to limit number of UDP queries per ephemeral port (#549) + + Add a new ARES_OPT_UDP_MAX_QUERIES option with udp_max_queries parameter that can be passed to ares_init_options(). This value defaults to 0 (unlimited) to maintain existing compatibility, any positive number will cause new UDP ephemeral ports to be created once the threshold is reached, we'll call these 'connections' even though its technically wrong for UDP. + + Implementation Details: + * Each server entry in a channel now has a linked-list of connections/ports for udp and tcp. The first connection in the list is the one most likely to be eligible to accept new queries. + * Queries are now tracked by connection rather than by server. + * Every time a query is detached from a connection, the connection that it was attached to will be checked to see if it needs to be cleaned up. + * Insertion, lookup, and searching for connections has been implemented as O(1) complexity so the number of connections will not impact performance. + * Remove is_broken from the server, it appears it would be set and immediately unset, so must have been invalidated via a prior patch. A future patch should probably track consecutive server errors and de-prioritize such servers. The code right now will always try servers in the order of configuration, so a bad server in the list will always be tried and may rely on timeout logic to try the next. + * Various other cleanups to remove code duplication and for clarification. + + Fixes Bug: #444 + Fix By: Brad House (@bradh352) + +- [Brad House brought this change] + + its not 1991 anymore, lower default timeout and retry count (#542) + + A lot of time has passed since the original timeouts and retry counts were chosen. We have on and off issues reported due to this. Even on geostationary satellite links, latency is worst case around 1.5s. This PR changes the per-server timeout to 2s and the retry count lowered from 4 to 3. + + Fix By: Brad House (@bradh352) + +- [Brad House brought this change] + + Modernization: Implement base data-structures and replace usage (#540) + + c-ares currently lacks modern data structures that can make coding easier and more efficient. This PR implements a new linked list, skip list (sorted linked list), and hashtable implementation that are easy to use and hard to misuse. Though these implementations use more memory allocations than the prior implementation, the ability to more rapidly iterate on the codebase is a bigger win than any marginal performance difference (which is unlikely to be visible, modern systems are much more powerful than when c-ares was initially created). + + The data structure implementation favors readability and audit-ability over performance, however using the algorithmically correct data type for the purpose should offset any perceived losses. + + The primary motivation for this PR is to facilitate future implementation for Issues #444, #135, #458, and possibly #301 + + A couple additional notes: + + The ares_timeout() function is now O(1) complexity instead of O(n) due to the use of a skiplist. + Some obscure bugs were uncovered which were actually being incorrectly validated in the test cases. These have been addressed in this PR but are not explicitly discussed. + Fixed some dead code warnings in ares_rand for systems that don't need rc4 + + Fix By: Brad House (@bradh352) + +- [Jérôme Duval brought this change] + + fix missing prefix for CMake generated libcares.pc (#530) + + 'pkg-config grpc --cflags' complains with: + Variable 'prefix' not defined in libcares.pc + + Fix By: Jérôme Duval (@korli) + +bradh352 (11 Jul 2023) +- windows get_DNS_Windows port fix for ipv6 + +- windows get_DNS_Windows port is in network byte order + +- backoff to debian 11 due to coverage check failure + +- extend on PR #534, windows should also honor a port + +GitHub (11 Jul 2023) +- [Brad House brought this change] + + Support configuration of DNS server ports (#534) + + As per https://man.openbsd.org/OpenBSD-5.1/resolv.conf.5 we should + support bracketed syntax for resolv.conf entries to contain an optional + port number. + + We also need to utilize this format for configuration of MacOS + DNS servers as seen when using the Viscosity OpenVPN client, where + it starts a private DNS server listening on localhost on a non-standard + port. + + Fix By: Brad House (@bradh352) + +Daniel Stenberg (9 Jun 2023) +- provide SPDX identifiers and a REUSE CI job to verify + + All files have their licence and copyright information clearly + identifiable. If not in the file header, they are set separately in + .reuse/dep5. + + All used license texts are provided in LICENSES/ + +GitHub (30 May 2023) +- [Alexey A Tikhonov brought this change] + + Remove unreachable code as reported by Coverity (#527) + + Coverity reported some code as unreachable. A manual inspection confirmed the reports. + + Fix By: Alexey A Tikhonov (@alexey-tikhonov) + +- [Ben Noordhuis brought this change] + + rand: add support for getrandom() (#526) + + glibc provides arc4random_buf() but musl does not and /dev/urandom is + not always available. + +- [Tim Wojtulewicz brought this change] + + Replace uses of sprintf with snprintf (#525) + + sprintf isn't safe even if you think you are using it right. Switch to snprintf(). + + Fix By: Tim Wojtulewicz (@timwoj) + +bradh352 (23 May 2023) +- update version and release procedure + +GitHub (22 May 2023) +- [Douglas R. Reno brought this change] + + INSTALL.md: Add Watcom instructions and update Windows documentation URLs (#524) + + This commit adds instructions on how to use the WATCOM compiler to build c-ares. This was just tested on c-ares-1.19.1 and works well. + + While going through the links for the C Runtime documentation for Windows systems, I discovered that all three of the KB articles that were linked are now nonexistent. This commit replaces KB94248 with the current replacement available on Microsoft's website, which also makes the other two KB articles obsolete. + + Fix By: Douglas R. Reno (@renodr) + Version 1.19.1 (22 May 2023) bradh352 (22 May 2023) @@ -5477,78 +5694,3 @@ Daniel Stenberg (11 Jun 2010) - [BogDan Vatra brought this change] init: allow c-ares to work on Android OS - -- changelog: fill in the 1.7.2 changes - -- added another pdf to ignore - -Yang Tse (11 Jun 2010) -- add ares_parse_mx_reply.c to VS dsp file - -Daniel Stenberg (10 Jun 2010) -- tarball: add $(CSOURCES) $(HHEADERS) to EXTRA_DIST - - It's not clear to me why we need this, but we apparently may - otherwise not get all files bundled in the dist tarball. - -- version: start working on 1.7.3 - -Version 1.7.2 (10 Jun 2010) - -Daniel Stenberg (10 Jun 2010) -- RELEASE-NOTES: 1.7.2 details added - -- [Jakub Hrozek brought this change] - - ares_init: Last, not first instance of domain or search should win - -- style: make code less than 80 columns wide - -Yang Tse (31 May 2010) -- [Tor Arntsen brought this change] - - improve alternative definition of bool to use enum instead of unsigned char - -- fix VS2010 compiler warnings - -Daniel Stenberg (18 Apr 2010) -- [Jérémy Lal brought this change] - - added ares_parse_mx_reply - -- repair the file mode - -- remove all $Id$ lines - -- remove all .cvsignore files - -- spell fix - - reported by Gregor Jasny on the mailing list - -- [Peter Pentchev brought this change] - - Fix a couple of typos and grammar nits. - -- ignore the GPG signature files too - -- start the journey towards 1.7.2 - -- no longer CVS tagging - -- ignore generated PDFs - -Version 1.7.1 (23 Mar 2010) - -Daniel Stenberg (23 Mar 2010) -- 1.7.1 - -- made README the primary readme file - - ... and did README.cares to contain a historic reason etc. - -- s/CVS/git - -- git now, not CVS - -- ignore lots of generated files diff --git a/graal-nodejs/deps/cares/CMakeLists.txt b/graal-nodejs/deps/cares/CMakeLists.txt index 9379014296c..9a855503fc9 100644 --- a/graal-nodejs/deps/cares/CMakeLists.txt +++ b/graal-nodejs/deps/cares/CMakeLists.txt @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT CMAKE_MINIMUM_REQUIRED (VERSION 3.1.0) INCLUDE (CheckIncludeFiles) @@ -8,10 +10,10 @@ INCLUDE (CheckCSourceCompiles) INCLUDE (CheckStructHasMember) INCLUDE (CheckLibraryExists) -PROJECT (c-ares LANGUAGES C VERSION "1.19.1" ) +PROJECT (c-ares LANGUAGES C VERSION "1.20.0" ) # Set this version before release -SET (CARES_VERSION "1.19.1") +SET (CARES_VERSION "1.20.0") INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are wrong. @@ -26,7 +28,7 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w # For example, a version of 4:0:2 would generate output such as: # libname.so -> libname.so.2 # libname.so.2 -> libname.so.2.2.0 -SET (CARES_LIB_VERSIONINFO "8:1:6") +SET (CARES_LIB_VERSIONINFO "9:0:7") OPTION (CARES_STATIC "Build as a static library" OFF) @@ -164,6 +166,7 @@ CARES_FUNCTION_IN_LIBRARY (clock_gettime rt HAVE_LIBRT) # Look for necessary includes CHECK_INCLUDE_FILES (sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILES (sys/random.h HAVE_SYS_RANDOM_H) CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H) CHECK_INCLUDE_FILES (sys/sockio.h HAVE_SYS_SOCKIO_H) CHECK_INCLUDE_FILES (arpa/inet.h HAVE_ARPA_INET_H) @@ -281,6 +284,7 @@ CARES_EXTRAINCLUDE_IFSET (HAVE_STDLIB_H stdlib.h) CARES_EXTRAINCLUDE_IFSET (HAVE_STRING_H string.h) CARES_EXTRAINCLUDE_IFSET (HAVE_STRINGS_H strings.h) CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_IOCTL_H sys/ioctl.h) +CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_RANDOM_H sys/random.h) CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SELECT_H sys/select.h) CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SOCKET_H sys/socket.h) CARES_EXTRAINCLUDE_IFSET (HAVE_SYS_SOCKIO_H sys/sockio.h) @@ -365,6 +369,7 @@ CHECK_SYMBOL_EXISTS (gethostbyaddr "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOST CHECK_SYMBOL_EXISTS (gethostbyname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTBYNAME) CHECK_SYMBOL_EXISTS (gethostname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETHOSTNAME) CHECK_SYMBOL_EXISTS (getnameinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETNAMEINFO) +CHECK_SYMBOL_EXISTS (getrandom "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETRANDOM) CHECK_SYMBOL_EXISTS (getservbyport_r "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETSERVBYPORT_R) CHECK_SYMBOL_EXISTS (getservbyname_r "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETSERVBYNAME_R) CHECK_SYMBOL_EXISTS (gettimeofday "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETTIMEOFDAY) @@ -562,6 +567,9 @@ ENDIF () IF (HAVE_SYS_TYPES_H) SET (CARES_HAVE_SYS_TYPES_H 1) ENDIF () +IF (HAVE_SYS_RANDOM_H) + SET (CARES_HAVE_SYS_RANDOM_H 1) +ENDIF() IF (HAVE_SYS_SOCKET_H) SET (CARES_HAVE_SYS_SOCKET_H 1) ENDIF() diff --git a/graal-nodejs/deps/cares/INSTALL.md b/graal-nodejs/deps/cares/INSTALL.md index 0f9d95a5219..9b2f847be8c 100644 --- a/graal-nodejs/deps/cares/INSTALL.md +++ b/graal-nodejs/deps/cares/INSTALL.md @@ -291,16 +291,12 @@ As a general rule, building a DLL with static CRT linkage is highly discouraged, and intermixing CRTs in the same app is something to avoid at any cost. -Reading and comprehension of Microsoft Knowledge Base articles -KB94248 and KB140584 is a must for any Windows developer. Especially +Reading and comprehension of the following Microsoft Learn article +is a must for any Windows developer. Especially important is full understanding if you are not going to follow the advice given above. - - [KB94248](http://support.microsoft.com/kb/94248/en-us) - How To Use the C Run-Time - - - [KB140584](http://support.microsoft.com/kb/140584/en-us) - How to link with the correct C Run-Time (CRT) library - - - [KB190799](http://msdn.microsoft.com/en-us/library/ms235460) - Potential Errors Passing CRT Objects Across DLL Boundaries + - [Use the C Run-Time](https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/cpp/libraries/use-c-run-time) If your app is misbehaving in some strange way, or it is suffering from memory corruption, before asking for further help, please try @@ -397,6 +393,21 @@ You can build and install c-ares using [vcpkg](https://github.com/Microsoft/vcpk The c-ares port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository. +WATCOM +===== + +To build c-ares with OpenWatcom, you need to have at least version 1.9 of OpenWatcom. You can get the latest version from [http://openwatcom.org/ftp/install/](http://openwatcom.org/ftp/install/). Install the version that corresponds to your current host platform. + +After installing OpenWatcom, open a new command prompt and execute the following commands: + +``` + cd \path\to\cmake\source + buildconf.bat + wmake -u -f Makefile.Watcom +``` + +After running wmake, you should get adig.exe, ahost.exe, and the static and dynamic versions of libcares. + PORTS ===== diff --git a/graal-nodejs/deps/cares/LICENSE.md b/graal-nodejs/deps/cares/LICENSE.md index ad6bb52b729..134145428aa 100644 --- a/graal-nodejs/deps/cares/LICENSE.md +++ b/graal-nodejs/deps/cares/LICENSE.md @@ -1,15 +1,27 @@ # c-ares license -Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS +MIT License + + +Copyright (c) 1998 Massachusetts Institute of Technology +Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS file. -Copyright 1998 by the Massachusetts Institute of Technology. +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, provided that -the above copyright notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting documentation, and that -the name of M.I.T. not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior permission. -M.I.T. makes no representations about the suitability of this software for any -purpose. It is provided "as is" without express or implied warranty. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/graal-nodejs/deps/cares/Makefile.Watcom b/graal-nodejs/deps/cares/Makefile.Watcom index 34e07bb4c6b..6ea10e532bc 100644 --- a/graal-nodejs/deps/cares/Makefile.Watcom +++ b/graal-nodejs/deps/cares/Makefile.Watcom @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT # # Watcom / OpenWatcom / Win32 makefile for cares. # Quick hack by Guenter; comments to: /dev/nul @@ -17,7 +19,7 @@ LIBNAME = $(%libname) LIBNAME = cares !endif TARGETS = $(LIBNAME).dll $(LIBNAME)_imp.lib $(LIBNAME).lib -DEMOS = adig.exe ahost.exe acountry.exe +DEMOS = adig.exe ahost.exe CC = wcc386 LD = wlink @@ -118,10 +120,6 @@ ahost.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib $(CC) $(CFLAGS) src\tools\ahost.c -fo=$(OBJ_BASE)\tools\ahost.obj $(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\ahost.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib -acountry.exe: $(OBJ_BASE)\tools\ares_getopt.obj $(LIBNAME).lib - $(CC) $(CFLAGS) src\tools\acountry.c -fo=$(OBJ_BASE)\tools\acountry.obj - $(LD) name $^@ system nt $(LFLAGS) file { $(OBJ_BASE)\tools\acountry.obj $[@ } library $]@, ws2_32.lib, iphlpapi.lib - clean: .SYMBOLIC -$(RM) $(OBJS_STAT) -$(RM) $(OBJS_DYN) diff --git a/graal-nodejs/deps/cares/Makefile.am b/graal-nodejs/deps/cares/Makefile.am index eef3d3d160e..cc22ac13b31 100644 --- a/graal-nodejs/deps/cares/Makefile.am +++ b/graal-nodejs/deps/cares/Makefile.am @@ -1,3 +1,24 @@ +############################################################# +# +# Copyright (C) the Massachusetts Institute of Technology. +# Copyright (C) Daniel Stenberg +# +# Permission to use, copy, modify, and distribute this +# software and its documentation for any purpose and without +# fee is hereby granted, provided that the above copyright +# notice appear in all copies and that both that copyright +# notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in +# advertising or publicity pertaining to distribution of the +# software without specific, written prior permission. +# M.I.T. makes no representations about the suitability of +# this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# SPDX-License-Identifier: MIT +# +############################################################# + AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6 ACLOCAL_AMFLAGS = -I m4 --install diff --git a/graal-nodejs/deps/cares/Makefile.dj b/graal-nodejs/deps/cares/Makefile.dj index a88aae219da..2f221888638 100644 --- a/graal-nodejs/deps/cares/Makefile.dj +++ b/graal-nodejs/deps/cares/Makefile.dj @@ -1,6 +1,7 @@ # # c-ares Makefile for djgpp/gcc/Watt-32. -# By Gisle Vanem 2004 - 2020. +# Copyright (C) Gisle Vanem +# SPDX-License-Identifier: MIT # include src/lib/Makefile.inc @@ -46,7 +47,7 @@ OBJECTS = $(addprefix $(OBJ_DIR)/, \ GENERATED = src/lib/ares_config.h \ include/ares_build.h -TARGETS = libcares.a acountry.exe adig.exe ahost.exe +TARGETS = libcares.a adig.exe ahost.exe .SECONDARY: $(OBJ_DIR)/ares_getopt.o diff --git a/graal-nodejs/deps/cares/Makefile.in b/graal-nodejs/deps/cares/Makefile.in index 3dfa479a244..271369e15a6 100644 --- a/graal-nodejs/deps/cares/Makefile.in +++ b/graal-nodejs/deps/cares/Makefile.in @@ -14,6 +14,27 @@ @SET_MAKE@ +############################################################# +# +# Copyright (C) the Massachusetts Institute of Technology. +# Copyright (C) Daniel Stenberg +# +# Permission to use, copy, modify, and distribute this +# software and its documentation for any purpose and without +# fee is hereby granted, provided that the above copyright +# notice appear in all copies and that both that copyright +# notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in +# advertising or publicity pertaining to distribution of the +# software without specific, written prior permission. +# M.I.T. makes no representations about the suitability of +# this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# SPDX-License-Identifier: MIT +# +############################################################# + VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ diff --git a/graal-nodejs/deps/cares/Makefile.m32 b/graal-nodejs/deps/cares/Makefile.m32 index 66d28b1c146..e51e64b3f93 100644 --- a/graal-nodejs/deps/cares/Makefile.m32 +++ b/graal-nodejs/deps/cares/Makefile.m32 @@ -1,10 +1,12 @@ ############################################################# # -## Makefile for building libcares.a with MingW32 (GCC-3.2) -## Use: make -f Makefile.m32 [demos] -## -## Quick hack by Guenter; comments to: /dev/nul +# Makefile for building libcares.a with MingW32 (GCC-3.2) +# Use: make -f Makefile.m32 [demos] # +# Quick hack by Guenter; comments to: /dev/nul +# +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT ######################################################## ## Nothing more to do below this line! @@ -34,7 +36,7 @@ $(LIB): $(OBJLIB) all: $(LIB) demos -demos: src/tools/adig.exe src/tools/ahost.exe src/tools/acountry.exe +demos: src/tools/adig.exe src/tools/ahost.exe tags: etags *.[ch] @@ -68,7 +70,7 @@ install: done) clean: - $(RM) src/tools/ares_getopt.o $(OBJLIB) $(LIB) src/tools/adig.exe src/tools/ahost.exe src/tools/acountry.exe + $(RM) src/tools/ares_getopt.o $(OBJLIB) $(LIB) src/tools/adig.exe src/tools/ahost.exe distclean: clean $(RM) config.cache config.log config.status Makefile diff --git a/graal-nodejs/deps/cares/Makefile.msvc b/graal-nodejs/deps/cares/Makefile.msvc index 62cc48fb3b5..17daa0c8c0c 100644 --- a/graal-nodejs/deps/cares/Makefile.msvc +++ b/graal-nodejs/deps/cares/Makefile.msvc @@ -12,6 +12,8 @@ # M.I.T. makes no representations about the suitability of # this software for any purpose. It is provided "as is" # without express or implied warranty. +# +# SPDX-License-Identifier: MIT # ------------------------------------------------------------------------------ # @@ -20,7 +22,7 @@ # Usage: nmake /f makefile.msvc CFG= # # must be one of: [ lib-release | lib-debug | dll-release | dll-debug } -# must be one of: [ ALL | c-ares | acountry | adig | ahost | clean } +# must be one of: [ ALL | c-ares | adig | ahost | clean } # # If a other than ALL or clean is given, becomes mandatory. # @@ -130,7 +132,7 @@ VALID_CFGSET = TRUE ! MESSAGE Usage: nmake /f makefile.msvc CFG= ! MESSAGE ! MESSAGE must be one of: [ lib-release | lib-debug | dll-release | dll-debug } -! MESSAGE must be one of: [ ALL | c-ares | acountry | adig | ahost | clean } +! MESSAGE must be one of: [ ALL | c-ares | adig | ahost | clean } ! MESSAGE ! MESSAGE If a other than ALL or clean is given, becomes mandatory. ! MESSAGE @@ -145,7 +147,6 @@ VALID_CFGSET = TRUE # -------------------------------------------------------- CARES_DIR = $(BASE_DIR)\cares -PROG1_DIR = $(BASE_DIR)\acountry PROG2_DIR = $(BASE_DIR)\adig PROG3_DIR = $(BASE_DIR)\ahost @@ -156,20 +157,16 @@ PROG3_DIR = $(BASE_DIR)\ahost !IF "$(VALID_CFGSET)" == "TRUE" CARES_OUTDIR = $(CARES_DIR)\$(CFG) -PROG1_OUTDIR = $(PROG1_DIR)\$(CFG) PROG2_OUTDIR = $(PROG2_DIR)\$(CFG) PROG3_OUTDIR = $(PROG3_DIR)\$(CFG) CARES_OBJDIR = $(CARES_OUTDIR)\obj -PROG1_OBJDIR = $(PROG1_OUTDIR)\obj PROG2_OBJDIR = $(PROG2_OUTDIR)\obj PROG3_OBJDIR = $(PROG3_OUTDIR)\obj !ELSE !UNDEF CARES_OUTDIR -!UNDEF PROG1_OUTDIR !UNDEF PROG2_OUTDIR !UNDEF PROG3_OUTDIR !UNDEF CARES_OBJDIR -!UNDEF PROG1_OBJDIR !UNDEF PROG2_OBJDIR !UNDEF PROG3_OBJDIR !ENDIF @@ -301,17 +298,6 @@ CARES_OBJS = $(CARES_OBJS:.c=.obj) CARES_OBJS = $(CARES_OBJS) $(CARES_OBJDIR)\cares.res !ENDIF -!IF [ECHO PROG1_OBJS=^$(PROG1_OBJDIR)\$(SAMPLESOURCES: = $(PROG1_OBJDIR^)\) > .\prog1_objs.inc] == 0 -!INCLUDE .\prog1_objs.inc -!IF [DEL .\prog1_objs.inc] -!ENDIF -!ELSE -!ERROR Problem generating PROG1_OBJS list. -!ENDIF -PROG1_OBJS = $(PROG1_OBJS:.c=.obj) -PROG1_OBJS = $(PROG1_OBJS:/=\) -PROG1_OBJS = $(PROG1_OBJS) $(PROG1_OBJDIR)\acountry.obj - !IF [ECHO PROG2_OBJS=^$(PROG2_OBJDIR)\$(SAMPLESOURCES: = $(PROG2_OBJDIR^)\) > .\prog2_objs.inc] == 0 !INCLUDE .\prog2_objs.inc !IF [DEL .\prog2_objs.inc] @@ -350,9 +336,6 @@ PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj {$(SRCDIR)\src\lib}.c{$(CARES_OBJDIR)}.obj: $(CC_CMD) $(CC_CFLAGS) $(CARES_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< -{$(SRCDIR)\src\tools}.c{$(PROG1_OBJDIR)}.obj: - $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< - {$(SRCDIR)\src\tools}.c{$(PROG2_OBJDIR)}.obj: $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$@ /Fd$(@D)\ /c $< @@ -362,9 +345,6 @@ PROG3_OBJS = $(PROG3_OBJS) $(PROG3_OBJDIR)\ahost.obj # Hack Alert! we reference ../lib/ files in the Makefile.inc for tools as they # share some files with the library itself. We need to hack around that here. -{$(SRCDIR)\src\lib}.c{$(PROG1_OBJDIR)\..\lib}.obj: - $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG1_OBJDIR)\$(@F) /Fd$(PROG1_OBJDIR)\ /c $< - {$(SRCDIR)\src\lib}.c{$(PROG2_OBJDIR)\..\lib}.obj: $(CC_CMD) $(CC_CFLAGS) $(SPROG_CFLAGS) /Fo$(PROG2_OBJDIR)\$(@F) /Fd$(PROG2_OBJDIR)\ /c $< @@ -403,7 +383,7 @@ install: !IF "$(VALID_CFGSET)" == "TRUE" -ALL: c-ares acountry adig ahost +ALL: c-ares adig ahost @ # $(HHEADERS) $(CSOURCES) @@ -413,11 +393,6 @@ c-ares: $(CARES_OBJDIR) $(CARES_OBJS) $(CARES_OUTDIR) @if exist $(CARES_OUTDIR)\$(CARES_TARGET).manifest mt -nologo -manifest $(CARES_OUTDIR)\$(CARES_TARGET).manifest -outputresource:$(CARES_OUTDIR)\$(CARES_TARGET);2 ! ENDIF -# acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS) -acountry: c-ares $(PROG1_OBJDIR) $(PROG1_OBJS) $(PROG1_OUTDIR) - $(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG1_OUTDIR)\acountry.exe $(PROG1_OBJS:..\lib=) - @if exist $(PROG1_OUTDIR)\acountry.exe.manifest mt -nologo -manifest $(PROG1_OUTDIR)\acountry.exe.manifest -outputresource:$(PROG1_OUTDIR)\acountry.exe;1 - # adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS) adig: c-ares $(PROG2_OBJDIR) $(PROG2_OBJS) $(PROG2_OUTDIR) $(SPROG_LINK) $(SPROG_LFLAGS) /out:$(PROG2_OUTDIR)\adig.exe $(PROG2_OBJS:..\lib=) @@ -431,9 +406,6 @@ ahost: c-ares $(PROG3_OBJDIR) $(PROG3_OBJS) $(PROG3_OUTDIR) $(CARES_OUTDIR): $(CARES_DIR) @if not exist $(CARES_OUTDIR) mkdir $(CARES_OUTDIR) -$(PROG1_OUTDIR): $(PROG1_DIR) - @if not exist $(PROG1_OUTDIR) mkdir $(PROG1_OUTDIR) - $(PROG2_OUTDIR): $(PROG2_DIR) @if not exist $(PROG2_OUTDIR) mkdir $(PROG2_OUTDIR) @@ -443,9 +415,6 @@ $(PROG3_OUTDIR): $(PROG3_DIR) $(CARES_OBJDIR): $(CARES_OUTDIR) @if not exist $(CARES_OBJDIR) mkdir $(CARES_OBJDIR) -$(PROG1_OBJDIR): $(PROG1_OUTDIR) - @if not exist $(PROG1_OBJDIR) mkdir $(PROG1_OBJDIR) - $(PROG2_OBJDIR): $(PROG2_OUTDIR) @if not exist $(PROG2_OBJDIR) mkdir $(PROG2_OBJDIR) @@ -454,7 +423,6 @@ $(PROG3_OBJDIR): $(PROG3_OUTDIR) clean: @-RMDIR /S /Q $(CARES_OUTDIR) >NUL 2>&1 - @-RMDIR /S /Q $(PROG1_OUTDIR) >NUL 2>&1 @-RMDIR /S /Q $(PROG2_OUTDIR) >NUL 2>&1 @-RMDIR /S /Q $(PROG3_OUTDIR) >NUL 2>&1 @@ -479,9 +447,6 @@ $(BASE_DIR): $(CARES_DIR): $(BASE_DIR) @if not exist $(CARES_DIR) mkdir $(CARES_DIR) -$(PROG1_DIR): $(BASE_DIR) - @if not exist $(PROG1_DIR) mkdir $(PROG1_DIR) - $(PROG2_DIR): $(BASE_DIR) @if not exist $(PROG2_DIR) mkdir $(PROG2_DIR) diff --git a/graal-nodejs/deps/cares/Makefile.netware b/graal-nodejs/deps/cares/Makefile.netware index e1a8a5523ca..790b17a8e01 100644 --- a/graal-nodejs/deps/cares/Makefile.netware +++ b/graal-nodejs/deps/cares/Makefile.netware @@ -1,9 +1,10 @@ ################################################################# # -## Makefile for building libcares (NetWare version - gnu make) -## Use: make -f Makefile.netware -## -## Comments to: Guenter Knauf http://www.gknw.de/phpbb +# Makefile for building libcares (NetWare version - gnu make) +# Use: make -f Makefile.netware +# +# Copyright (C) Guenter Knauf +# SPDX-License-Identifier: MIT # ################################################################# @@ -17,7 +18,7 @@ INSTDIR = ../ares-$(LIBCARES_VERSION_STR)-bin-nw endif # Edit the vars below to change NLM target settings. -TARGETS = adig.nlm ahost.nlm acountry.nlm +TARGETS = adig.nlm ahost.nlm LTARGET = libcares.$(LIBEXT) VERSION = $(LIBCARES_VERSION) COPYR = $(LIBCARES_COPYRIGHT_STR) diff --git a/graal-nodejs/deps/cares/README.msvc b/graal-nodejs/deps/cares/README.msvc index 396f497db40..97d4f0cf583 100644 --- a/graal-nodejs/deps/cares/README.msvc +++ b/graal-nodejs/deps/cares/README.msvc @@ -28,7 +28,7 @@ depends on the MSVC compiler version being used to build c-ares. Below the MSVCXX folder there will exist four folders named 'cares', - 'ahost', 'acountry', and 'adig'. The 'cares' folder is the one that + 'ahost', and 'adig'. The 'cares' folder is the one that holds the c-ares libraries you have just generated, the other three hold sample programs that use the libraries. diff --git a/graal-nodejs/deps/cares/RELEASE-NOTES b/graal-nodejs/deps/cares/RELEASE-NOTES index 2524f3ccf41..062f7a73e22 100644 --- a/graal-nodejs/deps/cares/RELEASE-NOTES +++ b/graal-nodejs/deps/cares/RELEASE-NOTES @@ -1,57 +1,60 @@ -c-ares version 1.19.1 +c-ares version 1.20.0 -This is a security and bugfix release. +This is a feature and bugfix release with some significant internal changes. -A special thanks goes out to the Open Source Technology Improvement Fund -(https://ostif.org) for sponsoring a security audit of c-ares performed by X41 -(https://x41-dsec.de). - -Security: - o CVE-2023-32067. High. 0-byte UDP payload causes Denial of Service [12] - o CVE-2023-31147. Moderate. Insufficient randomness in generation of DNS - query IDs [13] - o CVE-2023-31130. Moderate. Buffer Underwrite in ares_inet_net_pton() [14] - o CVE-2023-31124. Low. AutoTools does not set CARES_RANDOM_FILE during cross - compilation [15] +Changes: + o Update from 1989 MIT license text to modern MIT license text [1] + o Remove acountry from built tools as nerd.dk is gone [3] + o Add new ARES_OPT_UDP_MAX_QUERIES configuration option to limit the number of + queries that can be made from a single ephemeral port [7] + o Default per-query timeout has been reduced to 2s with a 3x retry count [8] + o Modernization: start implementing some common data structures that are easy + to use and hard to misuse. This will make code refactoring easier and remove + some varied implementations in use. This change also makes ares_timeout() + more efficient [9] + o Use SPDX identifiers and a REUSE CI job to verify [12] + o rand: add support for getrandom() [14] Bug fixes: - o Fix uninitialized memory warning in test [1] - o Turn off IPV6_V6ONLY on Windows to allow IPv4-mapped IPv6 addresses [2] - o ares_getaddrinfo() should allow a port of 0 [3] - o Fix memory leak in ares_send() on error [4] - o Fix comment style in ares_data.h [5] - o Remove unneeded ifdef for Windows [6] - o Fix typo in ares_init_options.3 [7] - o Re-add support for Watcom compiler [8] - o Sync ax_pthread.m4 with upstream [9] - o Windows: Invalid stack variable used out of scope for HOSTS path [10] - o Sync ax_cxx_compile_stdcxx_11.m4 with upstream to fix uclibc support [11] + o TCP back to back queries were broken [2] + o Ensure queries for ares_getaddrinfo() are not requeued during destruction [4] + o ares_getaddrinfo() should not retry other address classes if one address + class has already been returned [5] + o Avoid production ill-formed result when qualifying a name with the root + domain [6] + o Fix missing prefix for CMake generated libcares.pc [10] + o DNS server ports will now be read from system configuration instead of + defaulting to port 53 [11] + o Remove some unreachable code [13] + o Replace usages of sprintf with snprintf [15] + o Fix Watcom instructions and update Windows URLs [16] Thanks go to these friendly people for their efforts and contributions: + Alexey A Tikhonov (@alexey-tikhonov) + Ben Noordhuis (@bnoordhuis) Brad House (@bradh352) @Chilledheart Daniel Stenberg (@bagder) Douglas R. Reno (@renodr) - Gregor Jasny (@gjasny) - Jay Freeman (@saurik) - @lifenjoiner - Nikolaos Chatzikonstantinou (@createyourpersonalaccount) - Yijie Ma (@yijiem) + Jérôme Duval (@korli) + Sam Morris (@yrro) + Tim Wojtulewicz (@timwoj) (9 contributors) References to bug reports and discussions on issues: - [1] = https://github.com/c-ares/c-ares/pull/515 - [2] = https://github.com/c-ares/c-ares/pull/520 - [3] = https://github.com/c-ares/c-ares/issues/517 - [4] = https://github.com/c-ares/c-ares/pull/511 - [5] = https://github.com/c-ares/c-ares/pull/513 - [6] = https://github.com/c-ares/c-ares/pull/512 - [7] = https://github.com/c-ares/c-ares/pull/510 - [8] = https://github.com/c-ares/c-ares/pull/509 - [9] = https://github.com/c-ares/c-ares/pull/507 - [10] = https://github.com/c-ares/c-ares/pull/502 - [11] = https://github.com/c-ares/c-ares/pull/505 - [12] = https://github.com/c-ares/c-ares/security/advisories/GHSA-9g78-jv2r-p7vc - [13] = https://github.com/c-ares/c-ares/security/advisories/GHSA-8r8p-23f3-64c2 - [14] = https://github.com/c-ares/c-ares/security/advisories/GHSA-x6mf-cxr9-8q6v - [15] = https://github.com/c-ares/c-ares/security/advisories/GHSA-54xr-f67r-4pc4 + [1] = https://github.com/c-ares/c-ares/pull/556 + [2] = https://github.com/c-ares/c-ares/pull/552 + [3] = https://github.com/c-ares/c-ares/pull/554 + [4] = https://github.com/c-ares/c-ares/pull/553 + [5] = https://github.com/c-ares/c-ares/pull/551 + [6] = https://github.com/c-ares/c-ares/pull/546 + [7] = https://github.com/c-ares/c-ares/pull/549 + [8] = https://github.com/c-ares/c-ares/pull/542 + [9] = https://github.com/c-ares/c-ares/pull/540 + [10] = https://github.com/c-ares/c-ares/pull/530 + [11] = https://github.com/c-ares/c-ares/pull/534 + [12] = https://github.com/c-ares/c-ares/commit/c1b00c41 + [13] = https://github.com/c-ares/c-ares/pull/527 + [14] = https://github.com/c-ares/c-ares/pull/526 + [15] = https://github.com/c-ares/c-ares/pull/525 + [16] = https://github.com/c-ares/c-ares/pull/524 diff --git a/graal-nodejs/deps/cares/acinclude.m4 b/graal-nodejs/deps/cares/acinclude.m4 index c255198e5f4..2644cdfa34b 100644 --- a/graal-nodejs/deps/cares/acinclude.m4 +++ b/graal-nodejs/deps/cares/acinclude.m4 @@ -1,4 +1,5 @@ - +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) dnl ------------------------------------------------- diff --git a/graal-nodejs/deps/cares/aminclude_static.am b/graal-nodejs/deps/cares/aminclude_static.am index 94db7e3a8c6..01a565d7710 100644 --- a/graal-nodejs/deps/cares/aminclude_static.am +++ b/graal-nodejs/deps/cares/aminclude_static.am @@ -1,6 +1,6 @@ # aminclude_static.am generated automatically by Autoconf -# from AX_AM_MACROS_STATIC on Mon May 22 14:23:05 CEST 2023 +# from AX_AM_MACROS_STATIC on Sat Oct 7 13:50:28 CEST 2023 # Code coverage diff --git a/graal-nodejs/deps/cares/buildconf b/graal-nodejs/deps/cares/buildconf index 4e4c17e9991..94c6abc7c22 100755 --- a/graal-nodejs/deps/cares/buildconf +++ b/graal-nodejs/deps/cares/buildconf @@ -1,4 +1,6 @@ #!/bin/sh +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT echo "*** Do not use buildconf. Instead, just use: autoreconf -fi" >&2 exec ${AUTORECONF:-autoreconf} -fi "${@}" diff --git a/graal-nodejs/deps/cares/buildconf.bat b/graal-nodejs/deps/cares/buildconf.bat index dcee45239b8..0227c885214 100644 --- a/graal-nodejs/deps/cares/buildconf.bat +++ b/graal-nodejs/deps/cares/buildconf.bat @@ -6,6 +6,9 @@ REM systems where there is no autotools support (i.e. Microsoft). REM REM This file is not included nor needed for c-ares' release REM archives, neither for c-ares' daily snapshot archives. +REM +REM Copyright (C) The c-ares project and its contributors +REM SPDX-License-Identifier: MIT if exist GIT-INFO goto start_doing ECHO ERROR: This file shall only be used with a c-ares git checkout. diff --git a/graal-nodejs/deps/cares/c-ares-config.cmake.in b/graal-nodejs/deps/cares/c-ares-config.cmake.in index 1d05b24e547..f68ed832b98 100644 --- a/graal-nodejs/deps/cares/c-ares-config.cmake.in +++ b/graal-nodejs/deps/cares/c-ares-config.cmake.in @@ -1,3 +1,6 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT + @PACKAGE_INIT@ set_and_check(c-ares_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@") diff --git a/graal-nodejs/deps/cares/cares.gyp b/graal-nodejs/deps/cares/cares.gyp index 110024a3316..9797a3216ae 100644 --- a/graal-nodejs/deps/cares/cares.gyp +++ b/graal-nodejs/deps/cares/cares.gyp @@ -8,9 +8,27 @@ 'include/ares_version.h', 'src/lib/ares__addrinfo2hostent.c', 'src/lib/ares__addrinfo_localhost.c', + 'src/lib/ares__buf.c', + 'src/lib/ares__buf.h', + 'src/lib/ares__close_sockets.c', + 'src/lib/ares__htable.c', + 'src/lib/ares__htable.h', + 'src/lib/ares__htable_asvp.c', + 'src/lib/ares__htable_asvp.h', + 'src/lib/ares__htable_stvp.c', + 'src/lib/ares__htable_stvp.h', + 'src/lib/ares__llist.c', + 'src/lib/ares__llist.h', + 'src/lib/ares__get_hostent.c', + 'src/lib/ares__parse_into_addrinfo.c', + 'src/lib/ares__read_line.c', + 'src/lib/ares__readaddrinfo.c', + 'src/lib/ares__slist.c', + 'src/lib/ares__slist.h', + 'src/lib/ares__sortaddrinfo.c', + 'src/lib/ares__timeval.c', 'src/lib/ares_android.c', 'src/lib/ares_cancel.c', - 'src/lib/ares__close_sockets.c', 'src/lib/ares_create_query.c', 'src/lib/ares_data.c', 'src/lib/ares_data.h', @@ -21,25 +39,22 @@ 'src/lib/ares_free_hostent.c', 'src/lib/ares_free_string.c', 'src/lib/ares_freeaddrinfo.c', - 'src/lib/ares_getenv.h', 'src/lib/ares_getaddrinfo.c', + 'src/lib/ares_getenv.h', 'src/lib/ares_gethostbyaddr.c', 'src/lib/ares_gethostbyname.c', - 'src/lib/ares__get_hostent.c', 'src/lib/ares_getnameinfo.c', 'src/lib/ares_getsock.c', + 'src/lib/ares_inet_net_pton.h', 'src/lib/ares_init.c', 'src/lib/ares_ipv6.h', 'src/lib/ares_library_init.c', - 'src/lib/ares_llist.c', - 'src/lib/ares_llist.h', 'src/lib/ares_mkquery.c', 'src/lib/ares_nowarn.c', 'src/lib/ares_nowarn.h', 'src/lib/ares_options.c', - 'src/lib/ares__parse_into_addrinfo.c', - 'src/lib/ares_parse_aaaa_reply.c', 'src/lib/ares_parse_a_reply.c', + 'src/lib/ares_parse_aaaa_reply.c', 'src/lib/ares_parse_caa_reply.c', 'src/lib/ares_parse_mx_reply.c', 'src/lib/ares_parse_naptr_reply.c', @@ -54,12 +69,9 @@ 'src/lib/ares_process.c', 'src/lib/ares_query.c', 'src/lib/ares_rand.c', - 'src/lib/ares__read_line.c', - 'src/lib/ares__readaddrinfo.c', 'src/lib/ares_search.c', 'src/lib/ares_send.c', 'src/lib/ares_setup.h', - 'src/lib/ares__sortaddrinfo.c', 'src/lib/ares_strcasecmp.c', 'src/lib/ares_strcasecmp.h', 'src/lib/ares_strdup.c', @@ -67,15 +79,11 @@ 'src/lib/ares_strerror.c', 'src/lib/ares_strsplit.c', 'src/lib/ares_timeout.c', - 'src/lib/ares__timeval.c', 'src/lib/ares_version.c', - 'src/lib/ares_writev.c', - 'src/lib/ares_writev.h', 'src/lib/bitncmp.c', 'src/lib/bitncmp.h', 'src/lib/inet_net_pton.c', 'src/lib/inet_ntop.c', - 'src/lib/ares_inet_net_pton.h', 'src/lib/setup_once.h', 'src/tools/ares_getopt.c', 'src/tools/ares_getopt.h', diff --git a/graal-nodejs/deps/cares/configure b/graal-nodejs/deps/cares/configure index 2f182e0ce31..63c917a937e 100755 --- a/graal-nodejs/deps/cares/configure +++ b/graal-nodejs/deps/cares/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for c-ares 1.19.1. +# Generated by GNU Autoconf 2.71 for c-ares 1.20.0. # # Report bugs to . # @@ -855,8 +855,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='c-ares' PACKAGE_TARNAME='c-ares' -PACKAGE_VERSION='1.19.1' -PACKAGE_STRING='c-ares 1.19.1' +PACKAGE_VERSION='1.20.0' +PACKAGE_STRING='c-ares 1.20.0' PACKAGE_BUGREPORT='c-ares mailing list: http://lists.haxx.se/listinfo/c-ares' PACKAGE_URL='' @@ -1650,7 +1650,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures c-ares 1.19.1 to adapt to many kinds of systems. +\`configure' configures c-ares 1.20.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1721,7 +1721,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of c-ares 1.19.1:";; + short | recursive ) echo "Configuration of c-ares 1.20.0:";; esac cat <<\_ACEOF @@ -1861,7 +1861,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -c-ares configure 1.19.1 +c-ares configure 1.20.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2453,7 +2453,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by c-ares $as_me 1.19.1, which was +It was created by c-ares $as_me 1.20.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3426,7 +3426,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -CARES_VERSION_INFO="8:1:6" +CARES_VERSION_INFO="9:0:7" @@ -7060,7 +7060,7 @@ fi # Define the identity of the package. PACKAGE='c-ares' - VERSION='1.19.1' + VERSION='1.20.0' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -29558,6 +29558,182 @@ printf "%s\n" "no" >&6; } fi +cares_includes_sys_random="\ +/* includes start */ +#ifdef HAVE_SYS_RANDOM_H +# include +#endif +/* includes end */" + ac_fn_c_check_header_compile "$LINENO" "sys/random.h" "ac_cv_header_sys_random_h" "$cares_includes_sys_random +" +if test "x$ac_cv_header_sys_random_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_RANDOM_H 1" >>confdefs.h + +fi + + + + # + tst_links_getrandom="unknown" + tst_proto_getrandom="unknown" + tst_compi_getrandom="unknown" + tst_allow_getrandom="unknown" + # + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if getrandom can be linked" >&5 +printf %s "checking if getrandom can be linked... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* Define getrandom to an innocuous variant, in case declares getrandom. + For example, HP-UX 11i declares gettimeofday. */ +#define getrandom innocuous_getrandom + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char getrandom (); below. */ + +#include +#undef getrandom + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char getrandom (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_getrandom || defined __stub___getrandom +choke me +#endif + +int +main (void) +{ +return getrandom (); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + tst_links_getrandom="yes" + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + tst_links_getrandom="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + # + if test "$tst_links_getrandom" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if getrandom is prototyped" >&5 +printf %s "checking if getrandom is prototyped... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $cares_includes_sys_random + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "getrandom" >/dev/null 2>&1 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + tst_proto_getrandom="yes" + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + tst_proto_getrandom="no" + +fi +rm -rf conftest* + + fi + # + if test "$tst_proto_getrandom" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if getrandom is compilable" >&5 +printf %s "checking if getrandom is compilable... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + + $cares_includes_sys_random + +int +main (void) +{ + + if(0 != getrandom(0, 0, 0)) + return 1; + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + tst_compi_getrandom="yes" + +else $as_nop + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + tst_compi_getrandom="no" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + # + if test "$tst_compi_getrandom" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if getrandom usage allowed" >&5 +printf %s "checking if getrandom usage allowed... " >&6; } + if test "x$cares_disallow_getrandom" != "xyes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + tst_allow_getrandom="yes" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + tst_allow_getrandom="no" + fi + fi + # + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if getrandom might be used" >&5 +printf %s "checking if getrandom might be used... " >&6; } + if test "$tst_links_getrandom" = "yes" && + test "$tst_proto_getrandom" = "yes" && + test "$tst_compi_getrandom" = "yes" && + test "$tst_allow_getrandom" = "yes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_GETRANDOM 1" >>confdefs.h + + ac_cv_func_getrandom="yes" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ac_cv_func_getrandom="no" + fi + + # tst_links_getservbyport_r="unknown" tst_proto_getservbyport_r="unknown" @@ -35178,7 +35354,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by c-ares $as_me 1.19.1, which was +This file was extended by c-ares $as_me 1.20.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -35246,7 +35422,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -c-ares config.status 1.19.1 +c-ares config.status 1.20.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/graal-nodejs/deps/cares/configure.ac b/graal-nodejs/deps/cares/configure.ac index 54e79d6e2a9..9f0b5a87097 100644 --- a/graal-nodejs/deps/cares/configure.ac +++ b/graal-nodejs/deps/cares/configure.ac @@ -1,9 +1,29 @@ +############################################################# +# +# Copyright (C) the Massachusetts Institute of Technology. +# Copyright (C) Daniel Stenberg +# +# Permission to use, copy, modify, and distribute this +# software and its documentation for any purpose and without +# fee is hereby granted, provided that the above copyright +# notice appear in all copies and that both that copyright +# notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in +# advertising or publicity pertaining to distribution of the +# software without specific, written prior permission. +# M.I.T. makes no representations about the suitability of +# this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# SPDX-License-Identifier: MIT +# +############################################################# AC_PREREQ([2.60]) -AC_INIT([c-ares], [1.19.1], +AC_INIT([c-ares], [1.20.0], [c-ares mailing list: http://lists.haxx.se/listinfo/c-ares]) -CARES_VERSION_INFO="8:1:6" +CARES_VERSION_INFO="9:0:7" 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. @@ -666,6 +686,7 @@ CARES_CHECK_FUNC_GETENV CARES_CHECK_FUNC_GETHOSTBYADDR CARES_CHECK_FUNC_GETHOSTBYNAME CARES_CHECK_FUNC_GETHOSTNAME +CARES_CHECK_FUNC_GETRANDOM CARES_CHECK_FUNC_GETSERVBYPORT_R CARES_CHECK_FUNC_INET_NET_PTON CARES_CHECK_FUNC_INET_NTOP diff --git a/graal-nodejs/deps/cares/docs/CMakeLists.txt b/graal-nodejs/deps/cares/docs/CMakeLists.txt index 5b91d313e2f..3fcf39e8af6 100644 --- a/graal-nodejs/deps/cares/docs/CMakeLists.txt +++ b/graal-nodejs/deps/cares/docs/CMakeLists.txt @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT # Headers and Man Pages installation target IF (CARES_INSTALL) # ManPages diff --git a/graal-nodejs/deps/cares/docs/Makefile.am b/graal-nodejs/deps/cares/docs/Makefile.am index 289445ce49b..1aff3818850 100644 --- a/graal-nodejs/deps/cares/docs/Makefile.am +++ b/graal-nodejs/deps/cares/docs/Makefile.am @@ -1,6 +1,5 @@ -#*************************************************************************** - -########################################################################### +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT AUTOMAKE_OPTIONS = foreign subdir-objects no-dependencies @@ -8,4 +7,4 @@ include Makefile.inc man_MANS = $(MANPAGES) -EXTRA_DIST = $(MANPAGES) ahost.1 adig.1 acountry.1 Makefile.inc CMakeLists.txt +EXTRA_DIST = $(MANPAGES) ahost.1 adig.1 Makefile.inc CMakeLists.txt diff --git a/graal-nodejs/deps/cares/docs/Makefile.in b/graal-nodejs/deps/cares/docs/Makefile.in index b169b2a01d1..710fa605841 100644 --- a/graal-nodejs/deps/cares/docs/Makefile.in +++ b/graal-nodejs/deps/cares/docs/Makefile.in @@ -14,9 +14,8 @@ @SET_MAKE@ -#*************************************************************************** - -########################################################################### +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ @@ -327,6 +326,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign subdir-objects no-dependencies + +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT MANPAGES = ares_cancel.3 \ ares_create_query.3 \ ares_destroy.3 \ @@ -388,7 +390,7 @@ MANPAGES = ares_cancel.3 \ ares_version.3 man_MANS = $(MANPAGES) -EXTRA_DIST = $(MANPAGES) ahost.1 adig.1 acountry.1 Makefile.inc CMakeLists.txt +EXTRA_DIST = $(MANPAGES) ahost.1 adig.1 Makefile.inc CMakeLists.txt all: all-am .SUFFIXES: diff --git a/graal-nodejs/deps/cares/docs/Makefile.inc b/graal-nodejs/deps/cares/docs/Makefile.inc index 3aa62aa43b3..f042c06688a 100644 --- a/graal-nodejs/deps/cares/docs/Makefile.inc +++ b/graal-nodejs/deps/cares/docs/Makefile.inc @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT MANPAGES = ares_cancel.3 \ ares_create_query.3 \ ares_destroy.3 \ diff --git a/graal-nodejs/deps/cares/docs/acountry.1 b/graal-nodejs/deps/cares/docs/acountry.1 deleted file mode 100644 index ab5ab3d0223..00000000000 --- a/graal-nodejs/deps/cares/docs/acountry.1 +++ /dev/null @@ -1,54 +0,0 @@ -.TH ACOUNTRY "1" "April 2011" "c-ares utilities" -.SH NAME -acountry \- print the country where an IPv4 address or host is located -.SH SYNOPSIS -.B acountry -[\fIOPTION\fR]... \fIHOST\fR... -.SH DESCRIPTION -.PP -.\" Add any additional description here -.PP -Print the country where HOST (an IPv4 address or hostname) is located, -using the countries.nerd.dk DNS domain to identify the country. -.PP -This utility comes with the \fBc\-ares\fR asynchronous resolver library. -.SH OPTIONS -.TP -\fB\-d\fR -Print some extra debugging output. -.TP -\fB\-h\fR, \fB\-?\fR -Display this help and exit. -.TP -\fB\-v\fR -Be more verbose. Print extra information. -.SH "REPORTING BUGS" -Report bugs to the c-ares mailing list: -.br -\fBhttps://lists.haxx.se/listinfo/c-ares\fR -.SH "SEE ALSO" -.PP -adig(1), ahost(1). -.PP -The DNSBL countries.nerd.dk -.br -\fBhttp://countries.nerd.dk/\fR -.SH COPYRIGHT -This utility is based on code/ideas contained in sofware written by Greg Hudson (ares) -carrying the following notice: -.br -Copyright 1998 by the Massachusetts Institute of Technology. -.br -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of M.I.T. not be used in -advertising or publicity pertaining to distribution of the software -without specific, written prior permission. M.I.T. makes no -representations about the suitability of this software for any -purpose. It is provided "as is" without express or implied warranty. -.br -No further copyright claims are being made by the author(s) of this utility. -.SH AUTHOR -Gisle Vanem diff --git a/graal-nodejs/deps/cares/docs/adig.1 b/graal-nodejs/deps/cares/docs/adig.1 index 52ff49b7395..6760bbef7db 100644 --- a/graal-nodejs/deps/cares/docs/adig.1 +++ b/graal-nodejs/deps/cares/docs/adig.1 @@ -1,3 +1,21 @@ +.\" +.\" Copyright (C) the Massachusetts Institute of Technology. +.\" Copyright (C) Daniel Stenberg +.\" +.\" Permission to use, copy, modify, and distribute this +.\" software and its documentation for any purpose and without +.\" fee is hereby granted, provided that the above copyright +.\" notice appear in all copies and that both that copyright +.\" notice and this permission notice appear in supporting +.\" documentation, and that the name of M.I.T. not be used in +.\" advertising or publicity pertaining to distribution of the +.\" software without specific, written prior permission. +.\" M.I.T. makes no representations about the suitability of +.\" this software for any purpose. It is provided "as is" +.\" without express or implied warranty. +.\" +.\" SPDX-License-Identifier: MIT +.\" .TH ADIG "1" "April 2011" "c-ares utilities" .SH NAME adig \- print information collected from Domain Name System (DNS) servers diff --git a/graal-nodejs/deps/cares/docs/ahost.1 b/graal-nodejs/deps/cares/docs/ahost.1 index 07d9d1d18a1..30b968deeb5 100644 --- a/graal-nodejs/deps/cares/docs/ahost.1 +++ b/graal-nodejs/deps/cares/docs/ahost.1 @@ -1,3 +1,21 @@ +.\" +.\" Copyright (C) the Massachusetts Institute of Technology. +.\" Copyright (C) Daniel Stenberg +.\" +.\" Permission to use, copy, modify, and distribute this +.\" software and its documentation for any purpose and without +.\" fee is hereby granted, provided that the above copyright +.\" notice appear in all copies and that both that copyright +.\" notice and this permission notice appear in supporting +.\" documentation, and that the name of M.I.T. not be used in +.\" advertising or publicity pertaining to distribution of the +.\" software without specific, written prior permission. +.\" M.I.T. makes no representations about the suitability of +.\" this software for any purpose. It is provided "as is" +.\" without express or implied warranty. +.\" +.\" SPDX-License-Identifier: MIT +.\" .TH AHOST "1" "April 2011" "c-ares utilities" .SH NAME ahost \- print the A or AAAA record associated with a hostname or IP address diff --git a/graal-nodejs/deps/cares/docs/ares_cancel.3 b/graal-nodejs/deps/cares/docs/ares_cancel.3 index 1a2d3f5846e..49f025d74cc 100644 --- a/graal-nodejs/deps/cares/docs/ares_cancel.3 +++ b/graal-nodejs/deps/cares/docs/ares_cancel.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_CANCEL 3 "31 March 2004" .SH NAME ares_cancel \- Cancel a resolve diff --git a/graal-nodejs/deps/cares/docs/ares_create_query.3 b/graal-nodejs/deps/cares/docs/ares_create_query.3 index 1ab0624e413..28d12603a1f 100644 --- a/graal-nodejs/deps/cares/docs/ares_create_query.3 +++ b/graal-nodejs/deps/cares/docs/ares_create_query.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_CREATE_QUERY 3 "17 Aug 2012" .SH NAME ares_create_query \- Compose a single-question DNS query buffer diff --git a/graal-nodejs/deps/cares/docs/ares_destroy.3 b/graal-nodejs/deps/cares/docs/ares_destroy.3 index 9cdee30aac6..a65a522c276 100644 --- a/graal-nodejs/deps/cares/docs/ares_destroy.3 +++ b/graal-nodejs/deps/cares/docs/ares_destroy.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_DESTROY 3 "7 December 2004" .SH NAME ares_destroy \- Destroy a resolver channel diff --git a/graal-nodejs/deps/cares/docs/ares_destroy_options.3 b/graal-nodejs/deps/cares/docs/ares_destroy_options.3 index d3779b60cf4..96520d3de37 100644 --- a/graal-nodejs/deps/cares/docs/ares_destroy_options.3 +++ b/graal-nodejs/deps/cares/docs/ares_destroy_options.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_DESTROY_OPTIONS 3 "1 June 2007" .SH NAME ares_destroy_options \- Destroy options initialized with ares_save_options diff --git a/graal-nodejs/deps/cares/docs/ares_dup.3 b/graal-nodejs/deps/cares/docs/ares_dup.3 index 925c0cdd5f7..879be0e1661 100644 --- a/graal-nodejs/deps/cares/docs/ares_dup.3 +++ b/graal-nodejs/deps/cares/docs/ares_dup.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_DUP 3 "26 May 2009" .SH NAME ares_dup \- Duplicate a resolver channel diff --git a/graal-nodejs/deps/cares/docs/ares_expand_name.3 b/graal-nodejs/deps/cares/docs/ares_expand_name.3 index e750ab89162..a4f340e4fca 100644 --- a/graal-nodejs/deps/cares/docs/ares_expand_name.3 +++ b/graal-nodejs/deps/cares/docs/ares_expand_name.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_EXPAND_NAME 3 "20 Nov 2009" .SH NAME ares_expand_name \- Expand a DNS-encoded domain name diff --git a/graal-nodejs/deps/cares/docs/ares_expand_string.3 b/graal-nodejs/deps/cares/docs/ares_expand_string.3 index 89037424f1f..572881853d7 100644 --- a/graal-nodejs/deps/cares/docs/ares_expand_string.3 +++ b/graal-nodejs/deps/cares/docs/ares_expand_string.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_EXPAND_NAME 3 "20 Nov 2009" .SH NAME ares_expand_string \- Expand a length encoded string diff --git a/graal-nodejs/deps/cares/docs/ares_fds.3 b/graal-nodejs/deps/cares/docs/ares_fds.3 index 07063fb008f..08731eae043 100644 --- a/graal-nodejs/deps/cares/docs/ares_fds.3 +++ b/graal-nodejs/deps/cares/docs/ares_fds.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_FDS 3 "23 July 1998" .SH NAME ares_fds \- return file descriptors to select on diff --git a/graal-nodejs/deps/cares/docs/ares_free_data.3 b/graal-nodejs/deps/cares/docs/ares_free_data.3 index a6f3938be5c..f4159729f3b 100644 --- a/graal-nodejs/deps/cares/docs/ares_free_data.3 +++ b/graal-nodejs/deps/cares/docs/ares_free_data.3 @@ -14,6 +14,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_FREE_DATA 3 "5 March 2010" .SH NAME ares_free_data \- Free data allocated by several c-ares functions diff --git a/graal-nodejs/deps/cares/docs/ares_free_hostent.3 b/graal-nodejs/deps/cares/docs/ares_free_hostent.3 index 7c92724e70c..ef7840800bf 100644 --- a/graal-nodejs/deps/cares/docs/ares_free_hostent.3 +++ b/graal-nodejs/deps/cares/docs/ares_free_hostent.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_FREE_HOSTENT 3 "23 July 1998" .SH NAME ares_free_hostent \- Free host structure allocated by ares functions diff --git a/graal-nodejs/deps/cares/docs/ares_free_string.3 b/graal-nodejs/deps/cares/docs/ares_free_string.3 index d8a8e4689b5..7a4063f8f7c 100644 --- a/graal-nodejs/deps/cares/docs/ares_free_string.3 +++ b/graal-nodejs/deps/cares/docs/ares_free_string.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_FREE_STRING 3 "4 February 2004" .SH NAME ares_free_string \- Free strings allocated by ares functions diff --git a/graal-nodejs/deps/cares/docs/ares_freeaddrinfo.3 b/graal-nodejs/deps/cares/docs/ares_freeaddrinfo.3 index 8a8ad591872..8a3bb12a48a 100644 --- a/graal-nodejs/deps/cares/docs/ares_freeaddrinfo.3 +++ b/graal-nodejs/deps/cares/docs/ares_freeaddrinfo.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_FREEADDRINFO 3 "31 October 2018" .SH NAME ares_freeaddrinfo \- Free addrinfo structure allocated by ares functions diff --git a/graal-nodejs/deps/cares/docs/ares_get_servers.3 b/graal-nodejs/deps/cares/docs/ares_get_servers.3 index eb5861b6015..fbd911ea256 100644 --- a/graal-nodejs/deps/cares/docs/ares_get_servers.3 +++ b/graal-nodejs/deps/cares/docs/ares_get_servers.3 @@ -14,6 +14,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_GET_SERVERS 3 "5 March 2010" .SH NAME ares_get_servers, ares_get_servers_ports \- Retrieve name servers from an initialized ares_channel diff --git a/graal-nodejs/deps/cares/docs/ares_get_servers_ports.3 b/graal-nodejs/deps/cares/docs/ares_get_servers_ports.3 index 1f5d1f708b7..2fb648531bb 100644 --- a/graal-nodejs/deps/cares/docs/ares_get_servers_ports.3 +++ b/graal-nodejs/deps/cares/docs/ares_get_servers_ports.3 @@ -1 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT .so man3/ares_get_servers.3 diff --git a/graal-nodejs/deps/cares/docs/ares_getaddrinfo.3 b/graal-nodejs/deps/cares/docs/ares_getaddrinfo.3 index eb085e5d26e..ea90f9c7f86 100644 --- a/graal-nodejs/deps/cares/docs/ares_getaddrinfo.3 +++ b/graal-nodejs/deps/cares/docs/ares_getaddrinfo.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_GETADDRINFO 3 "4 November 2018" .SH NAME ares_getaddrinfo \- Initiate a host query by name and service diff --git a/graal-nodejs/deps/cares/docs/ares_gethostbyaddr.3 b/graal-nodejs/deps/cares/docs/ares_gethostbyaddr.3 index c58ca506150..eaeb58d5db9 100644 --- a/graal-nodejs/deps/cares/docs/ares_gethostbyaddr.3 +++ b/graal-nodejs/deps/cares/docs/ares_gethostbyaddr.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_GETHOSTBYADDR 3 "24 July 1998" .SH NAME ares_gethostbyaddr \- Initiate a host query by address diff --git a/graal-nodejs/deps/cares/docs/ares_gethostbyname.3 b/graal-nodejs/deps/cares/docs/ares_gethostbyname.3 index 5b4d9702b3f..b3614eb43c9 100644 --- a/graal-nodejs/deps/cares/docs/ares_gethostbyname.3 +++ b/graal-nodejs/deps/cares/docs/ares_gethostbyname.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_GETHOSTBYNAME 3 "25 July 1998" .SH NAME ares_gethostbyname \- Initiate a host query by name diff --git a/graal-nodejs/deps/cares/docs/ares_gethostbyname_file.3 b/graal-nodejs/deps/cares/docs/ares_gethostbyname_file.3 index ab127fce77a..5bbb28a8fed 100644 --- a/graal-nodejs/deps/cares/docs/ares_gethostbyname_file.3 +++ b/graal-nodejs/deps/cares/docs/ares_gethostbyname_file.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_GETHOSTBYNAME 3 "25 July 1998" .SH NAME ares_gethostbyname_file \- Lookup a name in the system's hosts file diff --git a/graal-nodejs/deps/cares/docs/ares_getnameinfo.3 b/graal-nodejs/deps/cares/docs/ares_getnameinfo.3 index d10d8410157..bde3e800e46 100644 --- a/graal-nodejs/deps/cares/docs/ares_getnameinfo.3 +++ b/graal-nodejs/deps/cares/docs/ares_getnameinfo.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_GETNAMEINFO 3 "1 May 2009" .SH NAME ares_getnameinfo \- Address-to-nodename translation in protocol-independent manner diff --git a/graal-nodejs/deps/cares/docs/ares_getsock.3 b/graal-nodejs/deps/cares/docs/ares_getsock.3 index 7908daebc19..c502e483500 100644 --- a/graal-nodejs/deps/cares/docs/ares_getsock.3 +++ b/graal-nodejs/deps/cares/docs/ares_getsock.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_GETSOCK 3 "11 March 2010" .SH NAME ares_getsock \- get socket descriptors to wait on diff --git a/graal-nodejs/deps/cares/docs/ares_inet_ntop.3 b/graal-nodejs/deps/cares/docs/ares_inet_ntop.3 index d0d0b5915ab..68d1db9b95c 100644 --- a/graal-nodejs/deps/cares/docs/ares_inet_ntop.3 +++ b/graal-nodejs/deps/cares/docs/ares_inet_ntop.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_INET_NTOP 3 "17 Feb 2013" .SH NAME ares_inet_ntop \- convert a network format address to presentation format diff --git a/graal-nodejs/deps/cares/docs/ares_inet_pton.3 b/graal-nodejs/deps/cares/docs/ares_inet_pton.3 index bf7140d3b54..21c4eacdab6 100644 --- a/graal-nodejs/deps/cares/docs/ares_inet_pton.3 +++ b/graal-nodejs/deps/cares/docs/ares_inet_pton.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_INET_PTON 3 "17 Feb 2013" .SH NAME ares_inet_pton \- convert an IPv4 or IPv6 address from text to binary form diff --git a/graal-nodejs/deps/cares/docs/ares_init.3 b/graal-nodejs/deps/cares/docs/ares_init.3 index 0baf4b76fea..d68e2241f4e 100644 --- a/graal-nodejs/deps/cares/docs/ares_init.3 +++ b/graal-nodejs/deps/cares/docs/ares_init.3 @@ -14,6 +14,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_INIT 3 "5 March 2010" .SH NAME ares_init \- Initialize a resolver channel diff --git a/graal-nodejs/deps/cares/docs/ares_init_options.3 b/graal-nodejs/deps/cares/docs/ares_init_options.3 index b31f6637c75..2fc14c569a9 100644 --- a/graal-nodejs/deps/cares/docs/ares_init_options.3 +++ b/graal-nodejs/deps/cares/docs/ares_init_options.3 @@ -14,6 +14,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_INIT 3 "5 March 2010" .SH NAME ares_init_options \- Initialize a resolver channel @@ -42,6 +44,7 @@ struct ares_options { int ednspsz; char *resolvconf_path; char *hosts_path; + int udp_max_queries; }; int ares_init_options(ares_channel *\fIchannelptr\fP, @@ -71,7 +74,7 @@ description of possible flag values. The number of seconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of \fItimeout\fP.) The -default is five seconds. This option is being deprecated by +default is two seconds. This option is being deprecated by \fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2. .TP 18 .B ARES_OPT_TIMEOUTMS @@ -80,7 +83,7 @@ default is five seconds. This option is being deprecated by The number of milliseconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of \fItimeout\fP.) The -default is five seconds. Note that this option is specified with the same +default is two seconds. Note that this option is specified with the same struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits that tell c-ares how to interpret the number. This option was added in c-ares 1.5.2. @@ -89,7 +92,7 @@ that tell c-ares how to interpret the number. This option was added in c-ares .B int \fItries\fP; .br The number of tries the resolver will try contacting each name server -before giving up. The default is four tries. +before giving up. The default is three tries. .TP 18 .B ARES_OPT_NDOTS .B int \fIndots\fP; @@ -204,6 +207,14 @@ should be set to a path string, and will be honoured on *nix like systems. The default is .B /etc/hosts .br +.TP 18 +.B ARES_OPT_UDP_MAX_QUERIES +.B int \fIudp_max_queries\fP; +.br +The maximum number of udp queries that can be sent on a single ephemeral port +to a given DNS server before a new ephemeral port is assigned. Any value of 0 +or less will be considered unlimited, and is the default. +.br .PP The \fIoptmask\fP parameter also includes options without a corresponding field in the diff --git a/graal-nodejs/deps/cares/docs/ares_library_cleanup.3 b/graal-nodejs/deps/cares/docs/ares_library_cleanup.3 index a1ffa6a948a..1af89d78d3f 100644 --- a/graal-nodejs/deps/cares/docs/ares_library_cleanup.3 +++ b/graal-nodejs/deps/cares/docs/ares_library_cleanup.3 @@ -14,6 +14,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_LIBRARY_CLEANUP 3 "19 May 2009" .SH NAME ares_library_cleanup \- c-ares library deinitialization diff --git a/graal-nodejs/deps/cares/docs/ares_library_init.3 b/graal-nodejs/deps/cares/docs/ares_library_init.3 index 21fc3ecab54..286702da56f 100644 --- a/graal-nodejs/deps/cares/docs/ares_library_init.3 +++ b/graal-nodejs/deps/cares/docs/ares_library_init.3 @@ -14,6 +14,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_LIBRARY_INIT 3 "19 May 2009" .SH NAME ares_library_init \- c-ares library initialization diff --git a/graal-nodejs/deps/cares/docs/ares_library_init_android.3 b/graal-nodejs/deps/cares/docs/ares_library_init_android.3 index 9e1ac4cd5be..51ec20d5bd7 100644 --- a/graal-nodejs/deps/cares/docs/ares_library_init_android.3 +++ b/graal-nodejs/deps/cares/docs/ares_library_init_android.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_LIBRARY_INIT_ANDROID 3 "13 Sept 2017" .SH NAME ares_library_init_android \- c-ares library Android initialization diff --git a/graal-nodejs/deps/cares/docs/ares_library_initialized.3 b/graal-nodejs/deps/cares/docs/ares_library_initialized.3 index 3e2727f8574..c9baad37e19 100644 --- a/graal-nodejs/deps/cares/docs/ares_library_initialized.3 +++ b/graal-nodejs/deps/cares/docs/ares_library_initialized.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_LIBRARY_INITIALIZED 3 "29 Sep 2016" .SH NAME ares_library_initialized \- get the initialization state diff --git a/graal-nodejs/deps/cares/docs/ares_mkquery.3 b/graal-nodejs/deps/cares/docs/ares_mkquery.3 index e394fe2847a..c8788433246 100644 --- a/graal-nodejs/deps/cares/docs/ares_mkquery.3 +++ b/graal-nodejs/deps/cares/docs/ares_mkquery.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_MKQUERY 3 "20 Nov 2009" .SH NAME ares_mkquery \- Compose a single-question DNS query buffer diff --git a/graal-nodejs/deps/cares/docs/ares_parse_a_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_a_reply.3 index 6038f68e599..8dd20c3dcd9 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_a_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_a_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_A_REPLY 3 "25 July 1998" .SH NAME ares_parse_a_reply \- Parse a reply to a DNS query of type A diff --git a/graal-nodejs/deps/cares/docs/ares_parse_aaaa_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_aaaa_reply.3 index bddd3c2f9fe..ebb490464cc 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_aaaa_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_aaaa_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_AAAA_REPLY 3 "20 Nov 2009" .SH NAME ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA diff --git a/graal-nodejs/deps/cares/docs/ares_parse_caa_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_caa_reply.3 index 71bd6be9601..f99fb26496c 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_caa_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_caa_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_CAA_REPLY 3 "16 September 2020" .SH NAME ares_parse_caa_reply \- Parse a reply to a DNS query of type CAA diff --git a/graal-nodejs/deps/cares/docs/ares_parse_mx_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_mx_reply.3 index 6c5c902d10c..05e6cc4e9bb 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_mx_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_mx_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_MX_REPLY 3 "4 August 2009" .SH NAME ares_parse_mx_reply \- Parse a reply to a DNS query of type MX diff --git a/graal-nodejs/deps/cares/docs/ares_parse_naptr_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_naptr_reply.3 index b98f8fd2409..5cefa2604fd 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_naptr_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_naptr_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_NAPTR_REPLY 3 "23 February 2012" .SH NAME ares_parse_naptr_reply \- Parse a reply to a DNS query of type NAPTR diff --git a/graal-nodejs/deps/cares/docs/ares_parse_ns_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_ns_reply.3 index b767e04f683..2fed14c4743 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_ns_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_ns_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_NS_REPLY 3 "10 February 2007" .SH NAME ares_parse_ns_reply \- Parse a reply to a DNS query of type NS into a hostent diff --git a/graal-nodejs/deps/cares/docs/ares_parse_ptr_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_ptr_reply.3 index e3eb4d09b39..c554ecaa1f1 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_ptr_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_ptr_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_PTR_REPLY 3 "25 July 1998" .SH NAME ares_parse_ptr_reply \- Parse a reply to a DNS query of type PTR into a hostent diff --git a/graal-nodejs/deps/cares/docs/ares_parse_soa_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_soa_reply.3 index c43f9be0841..04d70fa79a3 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_soa_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_soa_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_SOA_REPLY 3 "29 May 2012" .SH NAME ares_parse_soa_reply \- Parse a reply to a DNS query of type SOA diff --git a/graal-nodejs/deps/cares/docs/ares_parse_srv_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_srv_reply.3 index d3c26dbc287..1a04b6282d4 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_srv_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_srv_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_SRV_REPLY 3 "4 August 2009" .SH NAME ares_parse_srv_reply \- Parse a reply to a DNS query of type SRV diff --git a/graal-nodejs/deps/cares/docs/ares_parse_txt_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_txt_reply.3 index 6eeb04c7419..e4d7aa736ec 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_txt_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_txt_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_TXT_REPLY 3 "27 October 2009" .SH NAME ares_parse_txt_reply \- Parse a reply to a DNS query of type TXT diff --git a/graal-nodejs/deps/cares/docs/ares_parse_uri_reply.3 b/graal-nodejs/deps/cares/docs/ares_parse_uri_reply.3 index 60bc22854c7..2c2268c1c51 100644 --- a/graal-nodejs/deps/cares/docs/ares_parse_uri_reply.3 +++ b/graal-nodejs/deps/cares/docs/ares_parse_uri_reply.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PARSE_URI_REPLY 3 "14 August 2020" .SH NAME ares_parse_uri_reply \- Parse a reply to a DNS query of type URI diff --git a/graal-nodejs/deps/cares/docs/ares_process.3 b/graal-nodejs/deps/cares/docs/ares_process.3 index 28666f2e152..4f6ec981259 100644 --- a/graal-nodejs/deps/cares/docs/ares_process.3 +++ b/graal-nodejs/deps/cares/docs/ares_process.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_PROCESS 3 "25 July 1998" .SH NAME ares_process \- Process events for name resolution diff --git a/graal-nodejs/deps/cares/docs/ares_query.3 b/graal-nodejs/deps/cares/docs/ares_query.3 index 1055baaed80..aa40f850ad5 100644 --- a/graal-nodejs/deps/cares/docs/ares_query.3 +++ b/graal-nodejs/deps/cares/docs/ares_query.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_QUERY 3 "24 July 1998" .SH NAME ares_query \- Initiate a single-question DNS query diff --git a/graal-nodejs/deps/cares/docs/ares_save_options.3 b/graal-nodejs/deps/cares/docs/ares_save_options.3 index b5fcf17776d..308eb395f83 100644 --- a/graal-nodejs/deps/cares/docs/ares_save_options.3 +++ b/graal-nodejs/deps/cares/docs/ares_save_options.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SAVE_OPTIONS 3 "5 March 2010" .SH NAME ares_save_options \- Save configuration values obtained from initialized ares_channel diff --git a/graal-nodejs/deps/cares/docs/ares_search.3 b/graal-nodejs/deps/cares/docs/ares_search.3 index 6b301877d04..c81f03b3dc1 100644 --- a/graal-nodejs/deps/cares/docs/ares_search.3 +++ b/graal-nodejs/deps/cares/docs/ares_search.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SEARCH 3 "24 July 1998" .SH NAME ares_search \- Initiate a DNS query with domain search diff --git a/graal-nodejs/deps/cares/docs/ares_send.3 b/graal-nodejs/deps/cares/docs/ares_send.3 index bcd55b3f4e6..59f2e2b4233 100644 --- a/graal-nodejs/deps/cares/docs/ares_send.3 +++ b/graal-nodejs/deps/cares/docs/ares_send.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SEND 3 "25 July 1998" .SH NAME ares_send \- Initiate a DNS query diff --git a/graal-nodejs/deps/cares/docs/ares_set_local_dev.3 b/graal-nodejs/deps/cares/docs/ares_set_local_dev.3 index 059eae54753..7c32d1a51fe 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_local_dev.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_local_dev.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SET_LOCAL_DEV 3 "30 June 2010" .SH NAME ares_set_local_dev \- Bind to a specific network device when creating sockets. diff --git a/graal-nodejs/deps/cares/docs/ares_set_local_ip4.3 b/graal-nodejs/deps/cares/docs/ares_set_local_ip4.3 index 8425f5b67bf..86965ab212d 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_local_ip4.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_local_ip4.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SET_LOCAL_IP4 3 "30 June 2010" .SH NAME ares_set_local_ip4 \- Set local IPv4 address outgoing requests. diff --git a/graal-nodejs/deps/cares/docs/ares_set_local_ip6.3 b/graal-nodejs/deps/cares/docs/ares_set_local_ip6.3 index 6719ad35989..585be294e94 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_local_ip6.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_local_ip6.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SET_LOCAL_IP6 3 "30 June 2010" .SH NAME ares_set_local_ip6 \- Set local IPv6 address outgoing requests. diff --git a/graal-nodejs/deps/cares/docs/ares_set_servers.3 b/graal-nodejs/deps/cares/docs/ares_set_servers.3 index aeed0a51566..6634ef5a257 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_servers.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_servers.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SET_SERVERS 3 "5 March 2010" .SH NAME ares_set_servers, ares_set_servers_ports \- Initialize an ares_channel name servers configuration diff --git a/graal-nodejs/deps/cares/docs/ares_set_servers_csv.3 b/graal-nodejs/deps/cares/docs/ares_set_servers_csv.3 index a729281b978..fd37a1789e2 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_servers_csv.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_servers_csv.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SET_SERVERS_CSV 3 "30 June 2010" .SH NAME ares_set_servers_csv, ares_set_servers_ports_csv \- Set list of DNS servers to be used. diff --git a/graal-nodejs/deps/cares/docs/ares_set_servers_ports.3 b/graal-nodejs/deps/cares/docs/ares_set_servers_ports.3 index a3be18938e6..5b08f580913 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_servers_ports.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_servers_ports.3 @@ -1 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT .so man3/ares_set_servers.3 diff --git a/graal-nodejs/deps/cares/docs/ares_set_servers_ports_csv.3 b/graal-nodejs/deps/cares/docs/ares_set_servers_ports_csv.3 index 30535c69f10..77fd3bbae9f 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_servers_ports_csv.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_servers_ports_csv.3 @@ -1 +1,4 @@ +.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT .so man3/ares_set_servers_csv.3 diff --git a/graal-nodejs/deps/cares/docs/ares_set_socket_callback.3 b/graal-nodejs/deps/cares/docs/ares_set_socket_callback.3 index 70d7cf7d598..d251eb821b0 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_socket_callback.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_socket_callback.3 @@ -1,4 +1,7 @@ .\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SET_SOCKET_CALLBACK 3 "20 Nov 2009" .SH NAME ares_set_socket_callback \- Set a socket creation callback diff --git a/graal-nodejs/deps/cares/docs/ares_set_socket_configure_callback.3 b/graal-nodejs/deps/cares/docs/ares_set_socket_configure_callback.3 index 89188a6a9a0..7cc27fe60b7 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_socket_configure_callback.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_socket_configure_callback.3 @@ -1,4 +1,6 @@ .\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT .TH ARES_SET_SOCKET_CONFIGURE_CALLBACK 3 "6 Feb 2016" .SH NAME ares_set_socket_configure_callback \- Set a socket configuration callback diff --git a/graal-nodejs/deps/cares/docs/ares_set_socket_functions.3 b/graal-nodejs/deps/cares/docs/ares_set_socket_functions.3 index 0c33a494118..1b4e1aaee32 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_socket_functions.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_socket_functions.3 @@ -1,4 +1,5 @@ -.\" +.\" Copyright (C) Daniel Stenberg +.\" SPDX-License-Identifier: MIT .TH ARES_SET_SOCKET_FUNCTIONS 3 "13 Dec 2016" .SH NAME ares_set_socket_functions \- Set socket io callbacks @@ -24,7 +25,9 @@ void ares_set_socket_functions(ares_channel \fIchannel\fP, This function sets a set of callback \fIfunctions\fP in the given ares channel handle. These callback functions will be invoked to create/destroy socket objects and perform io, instead of the normal system calls. A client application can override normal network -operation fully through this functionality, and provide its own transport layer. +operation fully through this functionality, and provide its own transport layer. You +can choose to only implement some of the socket functions, and provide NULL to any +others and c-ares will use its built-in system functions in that case. .PP All callback functions are expected to operate like their system equivalents, and to set diff --git a/graal-nodejs/deps/cares/docs/ares_set_sortlist.3 b/graal-nodejs/deps/cares/docs/ares_set_sortlist.3 index 50e99e87df8..24c3c35a731 100644 --- a/graal-nodejs/deps/cares/docs/ares_set_sortlist.3 +++ b/graal-nodejs/deps/cares/docs/ares_set_sortlist.3 @@ -1,4 +1,5 @@ .\" +.\" Copyright (C) Daniel Stenberg .\" Permission to use, copy, modify, and distribute this .\" software and its documentation for any purpose and without .\" fee is hereby granted, provided that the above copyright @@ -11,6 +12,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_SET_SORTLIST 3 "23 November 2015" .SH NAME ares_set_sortlist \- Initialize an ares_channel sortlist configuration diff --git a/graal-nodejs/deps/cares/docs/ares_strerror.3 b/graal-nodejs/deps/cares/docs/ares_strerror.3 index 6369fccd607..745a0d607be 100644 --- a/graal-nodejs/deps/cares/docs/ares_strerror.3 +++ b/graal-nodejs/deps/cares/docs/ares_strerror.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_STRERROR 3 "25 July 1998" .SH NAME ares_strerror \- Get the description of an ares library error code diff --git a/graal-nodejs/deps/cares/docs/ares_timeout.3 b/graal-nodejs/deps/cares/docs/ares_timeout.3 index c57685dcf7c..d61bdd98ed6 100644 --- a/graal-nodejs/deps/cares/docs/ares_timeout.3 +++ b/graal-nodejs/deps/cares/docs/ares_timeout.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_TIMEOUT 3 "25 July 1998" .SH NAME ares_timeout \- return maximum time to wait diff --git a/graal-nodejs/deps/cares/docs/ares_version.3 b/graal-nodejs/deps/cares/docs/ares_version.3 index 9ba7831f54d..e6a338e3410 100644 --- a/graal-nodejs/deps/cares/docs/ares_version.3 +++ b/graal-nodejs/deps/cares/docs/ares_version.3 @@ -13,6 +13,8 @@ .\" this software for any purpose. It is provided "as is" .\" without express or implied warranty. .\" +.\" SPDX-License-Identifier: MIT +.\" .TH ARES_VERSION 3 "29 January 2004" .SH NAME ares_version \- Get the version number of the library diff --git a/graal-nodejs/deps/cares/get_ver.awk b/graal-nodejs/deps/cares/get_ver.awk index 5e3db6db99a..263ca02ded0 100644 --- a/graal-nodejs/deps/cares/get_ver.awk +++ b/graal-nodejs/deps/cares/get_ver.awk @@ -1,6 +1,8 @@ # *************************************************************************** # * Project: c-ares # * +# * Copyright (C) The c-ares project and its contributors +# * SPDX-License-Identifier: MIT # *************************************************************************** # awk script which fetches c-ares version number and string from input # file and writes them to STDOUT. Here you can get an awk version for Win32: diff --git a/graal-nodejs/deps/cares/include/CMakeLists.txt b/graal-nodejs/deps/cares/include/CMakeLists.txt index 3321956dd74..4801d873b5a 100644 --- a/graal-nodejs/deps/cares/include/CMakeLists.txt +++ b/graal-nodejs/deps/cares/include/CMakeLists.txt @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT # Write ares_build.h configuration file. This is an installed file. CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h) diff --git a/graal-nodejs/deps/cares/include/Makefile.am b/graal-nodejs/deps/cares/include/Makefile.am index d208bece64c..c9db5671d70 100644 --- a/graal-nodejs/deps/cares/include/Makefile.am +++ b/graal-nodejs/deps/cares/include/Makefile.am @@ -1,3 +1,5 @@ +# Copyright (C) Daniel Stenberg +# SPDX-License-Identifier: MIT AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6 ACLOCAL_AMFLAGS = -I m4 --install diff --git a/graal-nodejs/deps/cares/include/Makefile.in b/graal-nodejs/deps/cares/include/Makefile.in index 8586bd52f11..bd37daee03e 100644 --- a/graal-nodejs/deps/cares/include/Makefile.in +++ b/graal-nodejs/deps/cares/include/Makefile.in @@ -336,6 +336,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + +# Copyright (C) Daniel Stenberg +# SPDX-License-Identifier: MIT AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6 ACLOCAL_AMFLAGS = -I m4 --install diff --git a/graal-nodejs/deps/cares/include/ares.h b/graal-nodejs/deps/cares/include/ares.h index 8c7520eec65..d2c1e9e3a6f 100644 --- a/graal-nodejs/deps/cares/include/ares.h +++ b/graal-nodejs/deps/cares/include/ares.h @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2007-2013 by Daniel Stenberg +/* MIT License + * + * Copyright (c) Massachusetts Institute of Technology + * Copyright (c) Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #ifndef ARES__H @@ -157,25 +167,26 @@ extern "C" { #define ARES_FLAG_EDNS (1 << 8) /* Option mask values */ -#define ARES_OPT_FLAGS (1 << 0) -#define ARES_OPT_TIMEOUT (1 << 1) -#define ARES_OPT_TRIES (1 << 2) -#define ARES_OPT_NDOTS (1 << 3) -#define ARES_OPT_UDP_PORT (1 << 4) -#define ARES_OPT_TCP_PORT (1 << 5) -#define ARES_OPT_SERVERS (1 << 6) -#define ARES_OPT_DOMAINS (1 << 7) -#define ARES_OPT_LOOKUPS (1 << 8) -#define ARES_OPT_SOCK_STATE_CB (1 << 9) -#define ARES_OPT_SORTLIST (1 << 10) -#define ARES_OPT_SOCK_SNDBUF (1 << 11) -#define ARES_OPT_SOCK_RCVBUF (1 << 12) -#define ARES_OPT_TIMEOUTMS (1 << 13) -#define ARES_OPT_ROTATE (1 << 14) -#define ARES_OPT_EDNSPSZ (1 << 15) -#define ARES_OPT_NOROTATE (1 << 16) -#define ARES_OPT_RESOLVCONF (1 << 17) -#define ARES_OPT_HOSTS_FILE (1 << 18) +#define ARES_OPT_FLAGS (1 << 0) +#define ARES_OPT_TIMEOUT (1 << 1) +#define ARES_OPT_TRIES (1 << 2) +#define ARES_OPT_NDOTS (1 << 3) +#define ARES_OPT_UDP_PORT (1 << 4) +#define ARES_OPT_TCP_PORT (1 << 5) +#define ARES_OPT_SERVERS (1 << 6) +#define ARES_OPT_DOMAINS (1 << 7) +#define ARES_OPT_LOOKUPS (1 << 8) +#define ARES_OPT_SOCK_STATE_CB (1 << 9) +#define ARES_OPT_SORTLIST (1 << 10) +#define ARES_OPT_SOCK_SNDBUF (1 << 11) +#define ARES_OPT_SOCK_RCVBUF (1 << 12) +#define ARES_OPT_TIMEOUTMS (1 << 13) +#define ARES_OPT_ROTATE (1 << 14) +#define ARES_OPT_EDNSPSZ (1 << 15) +#define ARES_OPT_NOROTATE (1 << 16) +#define ARES_OPT_RESOLVCONF (1 << 17) +#define ARES_OPT_HOSTS_FILE (1 << 18) +#define ARES_OPT_UDP_MAX_QUERIES (1 << 19) /* Nameinfo flag values */ #define ARES_NI_NOFQDN (1 << 0) @@ -286,6 +297,7 @@ struct ares_options { int ednspsz; char *resolvconf_path; char *hosts_path; + int udp_max_queries; }; struct hostent; diff --git a/graal-nodejs/deps/cares/include/ares_build.h b/graal-nodejs/deps/cares/include/ares_build.h index 7f7d2e02daa..0a2b7a711a3 100644 --- a/graal-nodejs/deps/cares/include/ares_build.h +++ b/graal-nodejs/deps/cares/include/ares_build.h @@ -1,20 +1,32 @@ +/* MIT License + * + * Copyright (c) 2009 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ #ifndef __CARES_BUILD_H #define __CARES_BUILD_H -/* Copyright (C) 2009 - 2021 by Daniel Stenberg et al - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - /* ================================================================ */ /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ /* ================================================================ */ diff --git a/graal-nodejs/deps/cares/include/ares_build.h.cmake b/graal-nodejs/deps/cares/include/ares_build.h.cmake index e847f17ea79..e2ab7173bf8 100644 --- a/graal-nodejs/deps/cares/include/ares_build.h.cmake +++ b/graal-nodejs/deps/cares/include/ares_build.h.cmake @@ -1,5 +1,9 @@ #ifndef __CARES_BUILD_H #define __CARES_BUILD_H +/* + * Copyright (C) The c-ares project and its contributors + * SPDX-License-Identifier: MIT + */ #define CARES_TYPEOF_ARES_SOCKLEN_T @CARES_TYPEOF_ARES_SOCKLEN_T@ #define CARES_TYPEOF_ARES_SSIZE_T @CARES_TYPEOF_ARES_SSIZE_T@ @@ -8,6 +12,7 @@ * files. We need to include some dependent headers that may be system specific * for C-Ares */ #cmakedefine CARES_HAVE_SYS_TYPES_H +#cmakedefine CARES_HAVE_SYS_RANDOM_H #cmakedefine CARES_HAVE_SYS_SOCKET_H #cmakedefine CARES_HAVE_WINDOWS_H #cmakedefine CARES_HAVE_WS2TCPIP_H @@ -20,6 +25,10 @@ # include #endif +#ifdef CARES_HAVE_SYS_RANDOM_H +# include +#endif + #ifdef CARES_HAVE_SYS_SOCKET_H # include #endif diff --git a/graal-nodejs/deps/cares/include/ares_build.h.in b/graal-nodejs/deps/cares/include/ares_build.h.in index 8abc874c809..c8624da855d 100644 --- a/graal-nodejs/deps/cares/include/ares_build.h.in +++ b/graal-nodejs/deps/cares/include/ares_build.h.in @@ -1,19 +1,30 @@ -#ifndef __CARES_BUILD_H -#define __CARES_BUILD_H - - -/* Copyright (C) 2009 - 2021 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 2009 Daniel Stenberg * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef __CARES_BUILD_H +#define __CARES_BUILD_H /* ================================================================ */ /* NOTES FOR CONFIGURE CAPABLE SYSTEMS */ diff --git a/graal-nodejs/deps/cares/include/ares_dns.h b/graal-nodejs/deps/cares/include/ares_dns.h index bc8aa7b1091..e49c3d26ab1 100644 --- a/graal-nodejs/deps/cares/include/ares_dns.h +++ b/graal-nodejs/deps/cares/include/ares_dns.h @@ -1,20 +1,31 @@ -#ifndef HEADER_CARES_DNS_H -#define HEADER_CARES_DNS_H - -/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_DNS_H +#define HEADER_CARES_DNS_H /* * NOTE TO INTEGRATORS: diff --git a/graal-nodejs/deps/cares/include/ares_nameser.h b/graal-nodejs/deps/cares/include/ares_nameser.h index 18a9e5ac0e2..3138d89d747 100644 --- a/graal-nodejs/deps/cares/include/ares_nameser.h +++ b/graal-nodejs/deps/cares/include/ares_nameser.h @@ -1,3 +1,29 @@ +/* MIT License + * + * Copyright (c) Massachusetts Institute of Technology + * Copyright (c) Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ #ifndef ARES_NAMESER_H #define ARES_NAMESER_H diff --git a/graal-nodejs/deps/cares/include/ares_rules.h b/graal-nodejs/deps/cares/include/ares_rules.h index 1706ab7d004..f6b1f663e2d 100644 --- a/graal-nodejs/deps/cares/include/ares_rules.h +++ b/graal-nodejs/deps/cares/include/ares_rules.h @@ -1,19 +1,30 @@ -#ifndef __CARES_RULES_H -#define __CARES_RULES_H - - -/* Copyright (C) 2009 - 2021 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 2009 Daniel Stenberg * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef __CARES_RULES_H +#define __CARES_RULES_H /* ================================================================ */ /* COMPILE TIME SANITY CHECKS */ diff --git a/graal-nodejs/deps/cares/include/ares_version.h b/graal-nodejs/deps/cares/include/ares_version.h index 35a1ed1a3d3..fa83494fd4e 100644 --- a/graal-nodejs/deps/cares/include/ares_version.h +++ b/graal-nodejs/deps/cares/include/ares_version.h @@ -1,17 +1,42 @@ +/* MIT License + * + * Copyright (c) Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ #ifndef ARES__VERSION_H #define ARES__VERSION_H /* This is the global package copyright */ -#define ARES_COPYRIGHT "2004 - 2021 Daniel Stenberg, ." +#define ARES_COPYRIGHT "2004 - 2023 Daniel Stenberg, ." #define ARES_VERSION_MAJOR 1 -#define ARES_VERSION_MINOR 19 -#define ARES_VERSION_PATCH 1 +#define ARES_VERSION_MINOR 20 +#define ARES_VERSION_PATCH 0 #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ (ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.19.1" +#define ARES_VERSION_STR "1.20.0" #if (ARES_VERSION >= 0x010700) # define CARES_HAVE_ARES_LIBRARY_INIT 1 diff --git a/graal-nodejs/deps/cares/libcares.pc.cmake b/graal-nodejs/deps/cares/libcares.pc.cmake index f1213cf8b69..df49368633b 100644 --- a/graal-nodejs/deps/cares/libcares.pc.cmake +++ b/graal-nodejs/deps/cares/libcares.pc.cmake @@ -4,6 +4,9 @@ # | (_|_____| (_| | | | __/\__ \ # \___| \__,_|_| \___||___/ # +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT +prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ diff --git a/graal-nodejs/deps/cares/libcares.pc.in b/graal-nodejs/deps/cares/libcares.pc.in index e7ef5d25072..aa4bfc91ddb 100644 --- a/graal-nodejs/deps/cares/libcares.pc.in +++ b/graal-nodejs/deps/cares/libcares.pc.in @@ -4,6 +4,8 @@ # | (_|_____| (_| | | | __/\__ \ # \___| \__,_|_| \___||___/ # +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ diff --git a/graal-nodejs/deps/cares/ltmain.sh b/graal-nodejs/deps/cares/ltmain.sh index 8fb8700eef3..9b12fbb7fa9 100755 --- a/graal-nodejs/deps/cares/ltmain.sh +++ b/graal-nodejs/deps/cares/ltmain.sh @@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.7 Debian-2.4.7-4" +VERSION="2.4.7 Debian-2.4.7-5" package_revision=2.4.7 @@ -2308,7 +2308,7 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname $scriptversion Debian-2.4.7-4 + version: $progname $scriptversion Debian-2.4.7-5 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` diff --git a/graal-nodejs/deps/cares/m4/ax_check_user_namespace.m4 b/graal-nodejs/deps/cares/m4/ax_check_user_namespace.m4 index 27ba69821cb..aca721626f2 100644 --- a/graal-nodejs/deps/cares/m4/ax_check_user_namespace.m4 +++ b/graal-nodejs/deps/cares/m4/ax_check_user_namespace.m4 @@ -8,6 +8,9 @@ # # This macro checks whether the local system supports Linux user namespaces. # If so, it calls AC_DEFINE(HAVE_USER_NAMESPACE). +# +# Copyright (C) The c-ares team +# SPDX-License-Identifier: MIT AC_DEFUN([AX_CHECK_USER_NAMESPACE],[dnl AC_CACHE_CHECK([whether user namespaces are supported], @@ -34,9 +37,9 @@ int main() { pid_t child = clone(userfn, userst + 1024*1024, CLONE_NEWUSER|SIGCHLD, 0); if (child < 0) return 1; - sprintf(buffer, "/proc/%d/uid_map", child); + snprintf(buffer, sizeof(buffer), "/proc/%d/uid_map", child); fd = open(buffer, O_CREAT|O_WRONLY|O_TRUNC, 0755); - sprintf(buffer, "0 %d 1\n", getuid()); + snprintf(buffer, sizeof(buffer), "0 %d 1\n", getuid()); write(fd, buffer, strlen(buffer)); close(fd); diff --git a/graal-nodejs/deps/cares/m4/ax_check_uts_namespace.m4 b/graal-nodejs/deps/cares/m4/ax_check_uts_namespace.m4 index cf7b145c30e..5708acf1b9f 100644 --- a/graal-nodejs/deps/cares/m4/ax_check_uts_namespace.m4 +++ b/graal-nodejs/deps/cares/m4/ax_check_uts_namespace.m4 @@ -10,6 +10,9 @@ # Also requires user namespaces to be available, so that non-root users # can enter the namespace. # If so, it calls AC_DEFINE(HAVE_UTS_NAMESPACE). +# +# Copyright (C) The c-ares team +# SPDX-License-Identifier: MIT AC_DEFUN([AX_CHECK_UTS_NAMESPACE],[dnl AC_CACHE_CHECK([whether UTS namespaces are supported], @@ -55,9 +58,9 @@ int main() { pid_t child = clone(fn, st + 1024*1024, CLONE_NEWUSER|SIGCHLD, 0); if (child < 0) return 1; - sprintf(buffer, "/proc/%d/uid_map", child); + snprintf(buffer, sizeof(buffer), "/proc/%d/uid_map", child); fd = open(buffer, O_CREAT|O_WRONLY|O_TRUNC, 0755); - sprintf(buffer, "0 %d 1\n", getuid()); + snprintf(buffer, sizeof(buffer), "0 %d 1\n", getuid()); write(fd, buffer, strlen(buffer)); close(fd); diff --git a/graal-nodejs/deps/cares/m4/cares-compilers.m4 b/graal-nodejs/deps/cares/m4/cares-compilers.m4 index a5b1e2b182b..e11b35c33ef 100644 --- a/graal-nodejs/deps/cares/m4/cares-compilers.m4 +++ b/graal-nodejs/deps/cares/m4/cares-compilers.m4 @@ -1,6 +1,6 @@ #*************************************************************************** # -# Copyright (C) 2009 - 2021 by Daniel Stenberg et al +# Copyright (C) Daniel Stenberg et al # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, provided @@ -12,6 +12,7 @@ # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # +# SPDX-License-Identifier: MIT #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. diff --git a/graal-nodejs/deps/cares/m4/cares-confopts.m4 b/graal-nodejs/deps/cares/m4/cares-confopts.m4 index 78af64bffe1..0c6f1484fb2 100644 --- a/graal-nodejs/deps/cares/m4/cares-confopts.m4 +++ b/graal-nodejs/deps/cares/m4/cares-confopts.m4 @@ -1,6 +1,6 @@ #*************************************************************************** # -# Copyright (C) 2008 - 2013 by Daniel Stenberg et al +# Copyright (C) Daniel Stenberg et al # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, provided @@ -12,6 +12,7 @@ # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # +# SPDX-License-Identifier: MIT #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. diff --git a/graal-nodejs/deps/cares/m4/cares-functions.m4 b/graal-nodejs/deps/cares/m4/cares-functions.m4 index d4f4f994c6f..b12ab247257 100644 --- a/graal-nodejs/deps/cares/m4/cares-functions.m4 +++ b/graal-nodejs/deps/cares/m4/cares-functions.m4 @@ -1,6 +1,6 @@ #*************************************************************************** # -# Copyright (C) 2008 - 2012 by Daniel Stenberg et al +# Copyright (C) Daniel Stenberg et al # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, provided @@ -12,6 +12,7 @@ # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # +# SPDX-License-Identifier: MIT #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. @@ -186,6 +187,24 @@ cares_includes_stropts="\ ]) +dnl CARES_INCLUDES_SYS_RANDOM +dnl ------------------------------------------------- +dnl Set up variable with list of headers that must be +dnl included when sys/random.h is to be included. + +AC_DEFUN([CARES_INCLUDES_SYS_RANDOM], [ +cares_includes_sys_random="\ +/* includes start */ +#ifdef HAVE_SYS_RANDOM_H +# include +#endif +/* includes end */" + AC_CHECK_HEADERS( + sys/random.h, + [], [], [$cares_includes_sys_random]) +]) + + dnl CARES_INCLUDES_SYS_SOCKET dnl ------------------------------------------------- dnl Set up variable with list of headers that must be @@ -1520,6 +1539,90 @@ AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [ fi ]) +dnl CARES_CHECK_FUNC_GETRANDOM +dnl ------------------------------------------------- +dnl Verify if getrandom is available, prototyped, and +dnl can be compiled. If all of these are true, and +dnl usage has not been previously disallowed with +dnl shell variable cares_disallow_getrandom, then +dnl HAVE_GETRANDOM will be defined. + +AC_DEFUN([CARES_CHECK_FUNC_GETRANDOM], [ + AC_REQUIRE([CARES_INCLUDES_SYS_RANDOM])dnl + # + tst_links_getrandom="unknown" + tst_proto_getrandom="unknown" + tst_compi_getrandom="unknown" + tst_allow_getrandom="unknown" + # + AC_MSG_CHECKING([if getrandom can be linked]) + AC_LINK_IFELSE([ + AC_LANG_FUNC_LINK_TRY([getrandom]) + ],[ + AC_MSG_RESULT([yes]) + tst_links_getrandom="yes" + ],[ + AC_MSG_RESULT([no]) + tst_links_getrandom="no" + ]) + # + if test "$tst_links_getrandom" = "yes"; then + AC_MSG_CHECKING([if getrandom is prototyped]) + AC_EGREP_CPP([getrandom],[ + $cares_includes_sys_random + ],[ + AC_MSG_RESULT([yes]) + tst_proto_getrandom="yes" + ],[ + AC_MSG_RESULT([no]) + tst_proto_getrandom="no" + ]) + fi + # + if test "$tst_proto_getrandom" = "yes"; then + AC_MSG_CHECKING([if getrandom is compilable]) + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ + $cares_includes_sys_random + ]],[[ + if(0 != getrandom(0, 0, 0)) + return 1; + ]]) + ],[ + AC_MSG_RESULT([yes]) + tst_compi_getrandom="yes" + ],[ + AC_MSG_RESULT([no]) + tst_compi_getrandom="no" + ]) + fi + # + if test "$tst_compi_getrandom" = "yes"; then + AC_MSG_CHECKING([if getrandom usage allowed]) + if test "x$cares_disallow_getrandom" != "xyes"; then + AC_MSG_RESULT([yes]) + tst_allow_getrandom="yes" + else + AC_MSG_RESULT([no]) + tst_allow_getrandom="no" + fi + fi + # + AC_MSG_CHECKING([if getrandom might be used]) + if test "$tst_links_getrandom" = "yes" && + test "$tst_proto_getrandom" = "yes" && + test "$tst_compi_getrandom" = "yes" && + test "$tst_allow_getrandom" = "yes"; then + AC_MSG_RESULT([yes]) + AC_DEFINE_UNQUOTED(HAVE_GETRANDOM, 1, + [Define to 1 if you have the getrandom function.]) + ac_cv_func_getrandom="yes" + else + AC_MSG_RESULT([no]) + ac_cv_func_getrandom="no" + fi +]) + dnl CARES_CHECK_FUNC_GETSERVBYPORT_R dnl ------------------------------------------------- diff --git a/graal-nodejs/deps/cares/m4/cares-reentrant.m4 b/graal-nodejs/deps/cares/m4/cares-reentrant.m4 index 052326b3c0e..2a16fb22117 100644 --- a/graal-nodejs/deps/cares/m4/cares-reentrant.m4 +++ b/graal-nodejs/deps/cares/m4/cares-reentrant.m4 @@ -1,7 +1,5 @@ #*************************************************************************** -# $Id$ -# -# Copyright (C) 2008 - 2009 by Daniel Stenberg et al +# Copyright (C) Daniel Stenberg et al # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, provided @@ -13,6 +11,7 @@ # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # +# SPDX-License-Identifier: MIT #*************************************************************************** # File version for 'aclocal' use. Keep it a single number. diff --git a/graal-nodejs/deps/cares/m4/xc-am-iface.m4 b/graal-nodejs/deps/cares/m4/xc-am-iface.m4 index 1571c211fb4..80c53b61822 100644 --- a/graal-nodejs/deps/cares/m4/xc-am-iface.m4 +++ b/graal-nodejs/deps/cares/m4/xc-am-iface.m4 @@ -2,7 +2,7 @@ # # xc-am-iface.m4 # -# Copyright (c) 2013 Daniel Stenberg +# Copyright (c) Daniel Stenberg # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +# SPDX-License-Identifier: MIT #--------------------------------------------------------------------------- # serial 1 diff --git a/graal-nodejs/deps/cares/m4/xc-cc-check.m4 b/graal-nodejs/deps/cares/m4/xc-cc-check.m4 index 777decf2983..cfa201ac9dc 100644 --- a/graal-nodejs/deps/cares/m4/xc-cc-check.m4 +++ b/graal-nodejs/deps/cares/m4/xc-cc-check.m4 @@ -2,7 +2,7 @@ # # xc-cc-check.m4 # -# Copyright (c) 2013 Daniel Stenberg +# Copyright (c) Daniel Stenberg # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +# SPDX-License-Identifier: MIT #--------------------------------------------------------------------------- # serial 1 diff --git a/graal-nodejs/deps/cares/m4/xc-lt-iface.m4 b/graal-nodejs/deps/cares/m4/xc-lt-iface.m4 index 0b90d5f25f0..f8a6c125ff8 100644 --- a/graal-nodejs/deps/cares/m4/xc-lt-iface.m4 +++ b/graal-nodejs/deps/cares/m4/xc-lt-iface.m4 @@ -2,7 +2,7 @@ # # xc-lt-iface.m4 # -# Copyright (c) 2013 Daniel Stenberg +# Copyright (c) Daniel Stenberg # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,8 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +# +# SPDX-License-Identifier: MIT #--------------------------------------------------------------------------- # serial 1 diff --git a/graal-nodejs/deps/cares/m4/xc-translit.m4 b/graal-nodejs/deps/cares/m4/xc-translit.m4 index 1918f168408..db8ca82137a 100644 --- a/graal-nodejs/deps/cares/m4/xc-translit.m4 +++ b/graal-nodejs/deps/cares/m4/xc-translit.m4 @@ -2,7 +2,7 @@ # # xc-translit.m4 # -# Copyright (c) 2011 Daniel Stenberg +# Copyright (c) Daniel Stenberg # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,8 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +# +# SPDX-License-Identifier: MIT #--------------------------------------------------------------------------- # File version for 'aclocal' use. Keep it a single number. diff --git a/graal-nodejs/deps/cares/m4/xc-val-flgs.m4 b/graal-nodejs/deps/cares/m4/xc-val-flgs.m4 index 81d1eac9e3b..c9e472e6ae9 100644 --- a/graal-nodejs/deps/cares/m4/xc-val-flgs.m4 +++ b/graal-nodejs/deps/cares/m4/xc-val-flgs.m4 @@ -2,7 +2,7 @@ # # xc-val-flgs.m4 # -# Copyright (c) 2013 Daniel Stenberg +# Copyright (c) Daniel Stenberg # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,8 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +# +# SPDX-License-Identifier: MIT #--------------------------------------------------------------------------- # serial 1 diff --git a/graal-nodejs/deps/cares/m4/zz40-xc-ovr.m4 b/graal-nodejs/deps/cares/m4/zz40-xc-ovr.m4 index 0e3b1cba61e..4183347924e 100644 --- a/graal-nodejs/deps/cares/m4/zz40-xc-ovr.m4 +++ b/graal-nodejs/deps/cares/m4/zz40-xc-ovr.m4 @@ -2,7 +2,7 @@ # # zz40-xc-ovr.m4 # -# Copyright (c) 2013 Daniel Stenberg +# Copyright (c) Daniel Stenberg # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,7 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # +# SPDX-License-Identifier: MIT #--------------------------------------------------------------------------- # serial 1 diff --git a/graal-nodejs/deps/cares/maketgz b/graal-nodejs/deps/cares/maketgz index ec1ecea540a..aa1241f96ef 100755 --- a/graal-nodejs/deps/cares/maketgz +++ b/graal-nodejs/deps/cares/maketgz @@ -1,4 +1,6 @@ #!/usr/bin/env perl +# Copyright (C) Daniel Stenberg +# SPDX-License-Identifier: MIT $version = $ARGV[0]; diff --git a/graal-nodejs/deps/cares/msvc_ver.inc b/graal-nodejs/deps/cares/msvc_ver.inc index 595cbdf1dea..61bdb59ae2c 100644 --- a/graal-nodejs/deps/cares/msvc_ver.inc +++ b/graal-nodejs/deps/cares/msvc_ver.inc @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT # ----------------------------------------------- # Detect NMAKE version deducing old MSVC versions # ----------------------------------------------- diff --git a/graal-nodejs/deps/cares/src/CMakeLists.txt b/graal-nodejs/deps/cares/src/CMakeLists.txt index 6750c1780f6..b8ea0a17740 100644 --- a/graal-nodejs/deps/cares/src/CMakeLists.txt +++ b/graal-nodejs/deps/cares/src/CMakeLists.txt @@ -1,2 +1,4 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT ADD_SUBDIRECTORY (lib) ADD_SUBDIRECTORY (tools) diff --git a/graal-nodejs/deps/cares/src/Makefile.am b/graal-nodejs/deps/cares/src/Makefile.am index 2e97e422f73..896dd62e408 100644 --- a/graal-nodejs/deps/cares/src/Makefile.am +++ b/graal-nodejs/deps/cares/src/Makefile.am @@ -1,2 +1,4 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT EXTRA_DIST=CMakeLists.txt SUBDIRS=lib tools diff --git a/graal-nodejs/deps/cares/src/Makefile.in b/graal-nodejs/deps/cares/src/Makefile.in index 6aa63b002ad..af4e680b76a 100644 --- a/graal-nodejs/deps/cares/src/Makefile.in +++ b/graal-nodejs/deps/cares/src/Makefile.in @@ -347,6 +347,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT EXTRA_DIST = CMakeLists.txt SUBDIRS = lib tools all: all-recursive diff --git a/graal-nodejs/deps/cares/src/lib/CMakeLists.txt b/graal-nodejs/deps/cares/src/lib/CMakeLists.txt index 5cea0762827..34dc9c3d68a 100644 --- a/graal-nodejs/deps/cares/src/lib/CMakeLists.txt +++ b/graal-nodejs/deps/cares/src/lib/CMakeLists.txt @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT # Transform Makefile.inc transform_makefile_inc("Makefile.inc" "${PROJECT_BINARY_DIR}/src/lib/Makefile.inc.cmake") diff --git a/graal-nodejs/deps/cares/src/lib/Makefile.am b/graal-nodejs/deps/cares/src/lib/Makefile.am index 4813621ce23..998996b1eef 100644 --- a/graal-nodejs/deps/cares/src/lib/Makefile.am +++ b/graal-nodejs/deps/cares/src/lib/Makefile.am @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 ACLOCAL_AMFLAGS = -I m4 --install diff --git a/graal-nodejs/deps/cares/src/lib/Makefile.in b/graal-nodejs/deps/cares/src/lib/Makefile.in index f1ed8a0b0c5..0dd3c19661c 100644 --- a/graal-nodejs/deps/cares/src/lib/Makefile.in +++ b/graal-nodejs/deps/cares/src/lib/Makefile.in @@ -15,7 +15,10 @@ @SET_MAKE@ # aminclude_static.am generated automatically by Autoconf -# from AX_AM_MACROS_STATIC on Mon May 22 13:34:17 CEST 2023 +# from AX_AM_MACROS_STATIC on Sat Oct 7 13:47:45 CEST 2023 + +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT VPATH = @srcdir@ am__is_gnu_make = { \ @@ -164,10 +167,12 @@ libcares_la_LIBADD = am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \ libcares_la-ares__addrinfo_localhost.lo \ libcares_la-ares__close_sockets.lo \ - libcares_la-ares__get_hostent.lo \ + libcares_la-ares__get_hostent.lo libcares_la-ares__htable.lo \ + libcares_la-ares__htable_asvp.lo \ + libcares_la-ares__htable_stvp.lo libcares_la-ares__llist.lo \ libcares_la-ares__parse_into_addrinfo.lo \ - libcares_la-ares__readaddrinfo.lo \ - libcares_la-ares__sortaddrinfo.lo \ + libcares_la-ares__buf.lo libcares_la-ares__readaddrinfo.lo \ + libcares_la-ares__slist.lo libcares_la-ares__sortaddrinfo.lo \ libcares_la-ares__read_line.lo libcares_la-ares__timeval.lo \ libcares_la-ares_android.lo libcares_la-ares_cancel.lo \ libcares_la-ares_data.lo libcares_la-ares_destroy.lo \ @@ -181,9 +186,9 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \ libcares_la-ares_gethostbyname.lo \ libcares_la-ares_getnameinfo.lo libcares_la-ares_getsock.lo \ libcares_la-ares_init.lo libcares_la-ares_library_init.lo \ - libcares_la-ares_llist.lo libcares_la-ares_mkquery.lo \ - libcares_la-ares_create_query.lo libcares_la-ares_nowarn.lo \ - libcares_la-ares_options.lo libcares_la-ares_parse_a_reply.lo \ + libcares_la-ares_mkquery.lo libcares_la-ares_create_query.lo \ + libcares_la-ares_nowarn.lo libcares_la-ares_options.lo \ + libcares_la-ares_parse_a_reply.lo \ libcares_la-ares_parse_aaaa_reply.lo \ libcares_la-ares_parse_caa_reply.lo \ libcares_la-ares_parse_mx_reply.lo \ @@ -200,9 +205,8 @@ am__objects_1 = libcares_la-ares__addrinfo2hostent.lo \ libcares_la-ares_strcasecmp.lo libcares_la-ares_strdup.lo \ libcares_la-ares_strerror.lo libcares_la-ares_strsplit.lo \ libcares_la-ares_timeout.lo libcares_la-ares_version.lo \ - libcares_la-ares_writev.lo libcares_la-bitncmp.lo \ - libcares_la-inet_net_pton.lo libcares_la-inet_ntop.lo \ - libcares_la-windows_port.lo + libcares_la-bitncmp.lo libcares_la-inet_net_pton.lo \ + libcares_la-inet_ntop.lo libcares_la-windows_port.lo am__objects_2 = am_libcares_la_OBJECTS = $(am__objects_1) $(am__objects_2) libcares_la_OBJECTS = $(am_libcares_la_OBJECTS) @@ -231,11 +235,17 @@ am__maybe_remake_depfiles = depfiles am__depfiles_remade = \ ./$(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo \ ./$(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo \ + ./$(DEPDIR)/libcares_la-ares__buf.Plo \ ./$(DEPDIR)/libcares_la-ares__close_sockets.Plo \ ./$(DEPDIR)/libcares_la-ares__get_hostent.Plo \ + ./$(DEPDIR)/libcares_la-ares__htable.Plo \ + ./$(DEPDIR)/libcares_la-ares__htable_asvp.Plo \ + ./$(DEPDIR)/libcares_la-ares__htable_stvp.Plo \ + ./$(DEPDIR)/libcares_la-ares__llist.Plo \ ./$(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo \ ./$(DEPDIR)/libcares_la-ares__read_line.Plo \ ./$(DEPDIR)/libcares_la-ares__readaddrinfo.Plo \ + ./$(DEPDIR)/libcares_la-ares__slist.Plo \ ./$(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo \ ./$(DEPDIR)/libcares_la-ares__timeval.Plo \ ./$(DEPDIR)/libcares_la-ares_android.Plo \ @@ -257,7 +267,6 @@ am__depfiles_remade = \ ./$(DEPDIR)/libcares_la-ares_getsock.Plo \ ./$(DEPDIR)/libcares_la-ares_init.Plo \ ./$(DEPDIR)/libcares_la-ares_library_init.Plo \ - ./$(DEPDIR)/libcares_la-ares_llist.Plo \ ./$(DEPDIR)/libcares_la-ares_mkquery.Plo \ ./$(DEPDIR)/libcares_la-ares_nowarn.Plo \ ./$(DEPDIR)/libcares_la-ares_options.Plo \ @@ -284,7 +293,6 @@ am__depfiles_remade = \ ./$(DEPDIR)/libcares_la-ares_strsplit.Plo \ ./$(DEPDIR)/libcares_la-ares_timeout.Plo \ ./$(DEPDIR)/libcares_la-ares_version.Plo \ - ./$(DEPDIR)/libcares_la-ares_writev.Plo \ ./$(DEPDIR)/libcares_la-bitncmp.Plo \ ./$(DEPDIR)/libcares_la-inet_net_pton.Plo \ ./$(DEPDIR)/libcares_la-inet_ntop.Plo \ @@ -526,6 +534,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 ACLOCAL_AMFLAGS = -I m4 --install @@ -575,11 +586,17 @@ libcares_la_LIBS = $(CODE_COVERAGE_LIBS) libcares_la_CFLAGS = $(AM_CFLAGS) $(libcares_la_CFLAGS_EXTRA) libcares_la_CPPFLAGS = $(AM_CPPFLAGS) $(libcares_la_CPPFLAGS_EXTRA) CSOURCES = ares__addrinfo2hostent.c \ - ares__addrinfo_localhost.c \ - ares__close_sockets.c \ + ares__addrinfo_localhost.c \ + ares__close_sockets.c \ ares__get_hostent.c \ + ares__htable.c \ + ares__htable_asvp.c \ + ares__htable_stvp.c \ + ares__llist.c \ ares__parse_into_addrinfo.c \ + ares__buf.c \ ares__readaddrinfo.c \ + ares__slist.c \ ares__sortaddrinfo.c \ ares__read_line.c \ ares__timeval.c \ @@ -601,7 +618,6 @@ CSOURCES = ares__addrinfo2hostent.c \ ares_getsock.c \ ares_init.c \ ares_library_init.c \ - ares_llist.c \ ares_mkquery.c \ ares_create_query.c \ ares_nowarn.c \ @@ -620,7 +636,7 @@ CSOURCES = ares__addrinfo2hostent.c \ ares_platform.c \ ares_process.c \ ares_query.c \ - ares_rand.c \ + ares_rand.c \ ares_search.c \ ares_send.c \ ares_strcasecmp.c \ @@ -629,26 +645,29 @@ CSOURCES = ares__addrinfo2hostent.c \ ares_strsplit.c \ ares_timeout.c \ ares_version.c \ - ares_writev.c \ bitncmp.c \ inet_net_pton.c \ inet_ntop.c \ windows_port.c -HHEADERS = ares_android.h \ +HHEADERS = ares__htable.h \ + ares__htable_asvp.h \ + ares__htable_stvp.h \ + ares__llist.h \ + ares__buf.h \ + ares__slist.h \ + ares_android.h \ ares_data.h \ ares_getenv.h \ ares_inet_net_pton.h \ ares_iphlpapi.h \ ares_ipv6.h \ - ares_llist.h \ ares_nowarn.h \ ares_platform.h \ ares_private.h \ ares_strcasecmp.h \ ares_strdup.h \ ares_strsplit.h \ - ares_writev.h \ bitncmp.h \ ares_setup.h \ setup_once.h @@ -753,11 +772,17 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__buf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__close_sockets.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__get_hostent.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__htable.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__htable_asvp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__htable_stvp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__llist.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__read_line.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__readaddrinfo.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__slist.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares__timeval.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_android.Plo@am__quote@ # am--include-marker @@ -779,7 +804,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_getsock.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_init.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_library_init.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_llist.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_mkquery.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_nowarn.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_options.Plo@am__quote@ # am--include-marker @@ -806,7 +830,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_strsplit.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_timeout.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_version.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-ares_writev.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-bitncmp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-inet_net_pton.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcares_la-inet_ntop.Plo@am__quote@ # am--include-marker @@ -870,6 +893,34 @@ libcares_la-ares__get_hostent.lo: ares__get_hostent.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__get_hostent.lo `test -f 'ares__get_hostent.c' || echo '$(srcdir)/'`ares__get_hostent.c +libcares_la-ares__htable.lo: ares__htable.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__htable.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__htable.Tpo -c -o libcares_la-ares__htable.lo `test -f 'ares__htable.c' || echo '$(srcdir)/'`ares__htable.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__htable.Tpo $(DEPDIR)/libcares_la-ares__htable.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__htable.c' object='libcares_la-ares__htable.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__htable.lo `test -f 'ares__htable.c' || echo '$(srcdir)/'`ares__htable.c + +libcares_la-ares__htable_asvp.lo: ares__htable_asvp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__htable_asvp.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__htable_asvp.Tpo -c -o libcares_la-ares__htable_asvp.lo `test -f 'ares__htable_asvp.c' || echo '$(srcdir)/'`ares__htable_asvp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__htable_asvp.Tpo $(DEPDIR)/libcares_la-ares__htable_asvp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__htable_asvp.c' object='libcares_la-ares__htable_asvp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__htable_asvp.lo `test -f 'ares__htable_asvp.c' || echo '$(srcdir)/'`ares__htable_asvp.c + +libcares_la-ares__htable_stvp.lo: ares__htable_stvp.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__htable_stvp.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__htable_stvp.Tpo -c -o libcares_la-ares__htable_stvp.lo `test -f 'ares__htable_stvp.c' || echo '$(srcdir)/'`ares__htable_stvp.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__htable_stvp.Tpo $(DEPDIR)/libcares_la-ares__htable_stvp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__htable_stvp.c' object='libcares_la-ares__htable_stvp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__htable_stvp.lo `test -f 'ares__htable_stvp.c' || echo '$(srcdir)/'`ares__htable_stvp.c + +libcares_la-ares__llist.lo: ares__llist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__llist.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__llist.Tpo -c -o libcares_la-ares__llist.lo `test -f 'ares__llist.c' || echo '$(srcdir)/'`ares__llist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__llist.Tpo $(DEPDIR)/libcares_la-ares__llist.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__llist.c' object='libcares_la-ares__llist.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__llist.lo `test -f 'ares__llist.c' || echo '$(srcdir)/'`ares__llist.c + libcares_la-ares__parse_into_addrinfo.lo: ares__parse_into_addrinfo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__parse_into_addrinfo.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Tpo -c -o libcares_la-ares__parse_into_addrinfo.lo `test -f 'ares__parse_into_addrinfo.c' || echo '$(srcdir)/'`ares__parse_into_addrinfo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Tpo $(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo @@ -877,6 +928,13 @@ libcares_la-ares__parse_into_addrinfo.lo: ares__parse_into_addrinfo.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__parse_into_addrinfo.lo `test -f 'ares__parse_into_addrinfo.c' || echo '$(srcdir)/'`ares__parse_into_addrinfo.c +libcares_la-ares__buf.lo: ares__buf.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__buf.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__buf.Tpo -c -o libcares_la-ares__buf.lo `test -f 'ares__buf.c' || echo '$(srcdir)/'`ares__buf.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__buf.Tpo $(DEPDIR)/libcares_la-ares__buf.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__buf.c' object='libcares_la-ares__buf.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__buf.lo `test -f 'ares__buf.c' || echo '$(srcdir)/'`ares__buf.c + libcares_la-ares__readaddrinfo.lo: ares__readaddrinfo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__readaddrinfo.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__readaddrinfo.Tpo -c -o libcares_la-ares__readaddrinfo.lo `test -f 'ares__readaddrinfo.c' || echo '$(srcdir)/'`ares__readaddrinfo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__readaddrinfo.Tpo $(DEPDIR)/libcares_la-ares__readaddrinfo.Plo @@ -884,6 +942,13 @@ libcares_la-ares__readaddrinfo.lo: ares__readaddrinfo.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__readaddrinfo.lo `test -f 'ares__readaddrinfo.c' || echo '$(srcdir)/'`ares__readaddrinfo.c +libcares_la-ares__slist.lo: ares__slist.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__slist.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__slist.Tpo -c -o libcares_la-ares__slist.lo `test -f 'ares__slist.c' || echo '$(srcdir)/'`ares__slist.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__slist.Tpo $(DEPDIR)/libcares_la-ares__slist.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares__slist.c' object='libcares_la-ares__slist.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares__slist.lo `test -f 'ares__slist.c' || echo '$(srcdir)/'`ares__slist.c + libcares_la-ares__sortaddrinfo.lo: ares__sortaddrinfo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares__sortaddrinfo.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares__sortaddrinfo.Tpo -c -o libcares_la-ares__sortaddrinfo.lo `test -f 'ares__sortaddrinfo.c' || echo '$(srcdir)/'`ares__sortaddrinfo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares__sortaddrinfo.Tpo $(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo @@ -1031,13 +1096,6 @@ libcares_la-ares_library_init.lo: ares_library_init.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_library_init.lo `test -f 'ares_library_init.c' || echo '$(srcdir)/'`ares_library_init.c -libcares_la-ares_llist.lo: ares_llist.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_llist.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_llist.Tpo -c -o libcares_la-ares_llist.lo `test -f 'ares_llist.c' || echo '$(srcdir)/'`ares_llist.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_llist.Tpo $(DEPDIR)/libcares_la-ares_llist.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_llist.c' object='libcares_la-ares_llist.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_llist.lo `test -f 'ares_llist.c' || echo '$(srcdir)/'`ares_llist.c - libcares_la-ares_mkquery.lo: ares_mkquery.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_mkquery.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_mkquery.Tpo -c -o libcares_la-ares_mkquery.lo `test -f 'ares_mkquery.c' || echo '$(srcdir)/'`ares_mkquery.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_mkquery.Tpo $(DEPDIR)/libcares_la-ares_mkquery.Plo @@ -1227,13 +1285,6 @@ libcares_la-ares_version.lo: ares_version.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_version.lo `test -f 'ares_version.c' || echo '$(srcdir)/'`ares_version.c -libcares_la-ares_writev.lo: ares_writev.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-ares_writev.lo -MD -MP -MF $(DEPDIR)/libcares_la-ares_writev.Tpo -c -o libcares_la-ares_writev.lo `test -f 'ares_writev.c' || echo '$(srcdir)/'`ares_writev.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-ares_writev.Tpo $(DEPDIR)/libcares_la-ares_writev.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_writev.c' object='libcares_la-ares_writev.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -c -o libcares_la-ares_writev.lo `test -f 'ares_writev.c' || echo '$(srcdir)/'`ares_writev.c - libcares_la-bitncmp.lo: bitncmp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcares_la_CPPFLAGS) $(CPPFLAGS) $(libcares_la_CFLAGS) $(CFLAGS) -MT libcares_la-bitncmp.lo -MD -MP -MF $(DEPDIR)/libcares_la-bitncmp.Tpo -c -o libcares_la-bitncmp.lo `test -f 'bitncmp.c' || echo '$(srcdir)/'`bitncmp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcares_la-bitncmp.Tpo $(DEPDIR)/libcares_la-bitncmp.Plo @@ -1471,11 +1522,17 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ distclean: distclean-recursive -rm -f ./$(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__buf.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__close_sockets.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__get_hostent.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__htable.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__htable_asvp.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__htable_stvp.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__llist.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__read_line.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__readaddrinfo.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__slist.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__timeval.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_android.Plo @@ -1497,7 +1554,6 @@ distclean: distclean-recursive -rm -f ./$(DEPDIR)/libcares_la-ares_getsock.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_init.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_library_init.Plo - -rm -f ./$(DEPDIR)/libcares_la-ares_llist.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_mkquery.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_nowarn.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_options.Plo @@ -1524,7 +1580,6 @@ distclean: distclean-recursive -rm -f ./$(DEPDIR)/libcares_la-ares_strsplit.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_timeout.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_version.Plo - -rm -f ./$(DEPDIR)/libcares_la-ares_writev.Plo -rm -f ./$(DEPDIR)/libcares_la-bitncmp.Plo -rm -f ./$(DEPDIR)/libcares_la-inet_net_pton.Plo -rm -f ./$(DEPDIR)/libcares_la-inet_ntop.Plo @@ -1576,11 +1631,17 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/libcares_la-ares__addrinfo2hostent.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__addrinfo_localhost.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__buf.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__close_sockets.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__get_hostent.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__htable.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__htable_asvp.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__htable_stvp.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__llist.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__parse_into_addrinfo.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__read_line.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__readaddrinfo.Plo + -rm -f ./$(DEPDIR)/libcares_la-ares__slist.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__sortaddrinfo.Plo -rm -f ./$(DEPDIR)/libcares_la-ares__timeval.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_android.Plo @@ -1602,7 +1663,6 @@ maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/libcares_la-ares_getsock.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_init.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_library_init.Plo - -rm -f ./$(DEPDIR)/libcares_la-ares_llist.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_mkquery.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_nowarn.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_options.Plo @@ -1629,7 +1689,6 @@ maintainer-clean: maintainer-clean-recursive -rm -f ./$(DEPDIR)/libcares_la-ares_strsplit.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_timeout.Plo -rm -f ./$(DEPDIR)/libcares_la-ares_version.Plo - -rm -f ./$(DEPDIR)/libcares_la-ares_writev.Plo -rm -f ./$(DEPDIR)/libcares_la-bitncmp.Plo -rm -f ./$(DEPDIR)/libcares_la-inet_net_pton.Plo -rm -f ./$(DEPDIR)/libcares_la-inet_ntop.Plo diff --git a/graal-nodejs/deps/cares/src/lib/Makefile.inc b/graal-nodejs/deps/cares/src/lib/Makefile.inc index 02d8d58a6d5..ef0a8aca981 100644 --- a/graal-nodejs/deps/cares/src/lib/Makefile.inc +++ b/graal-nodejs/deps/cares/src/lib/Makefile.inc @@ -1,10 +1,18 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT CSOURCES = ares__addrinfo2hostent.c \ - ares__addrinfo_localhost.c \ - ares__close_sockets.c \ + ares__addrinfo_localhost.c \ + ares__close_sockets.c \ ares__get_hostent.c \ + ares__htable.c \ + ares__htable_asvp.c \ + ares__htable_stvp.c \ + ares__llist.c \ ares__parse_into_addrinfo.c \ + ares__buf.c \ ares__readaddrinfo.c \ + ares__slist.c \ ares__sortaddrinfo.c \ ares__read_line.c \ ares__timeval.c \ @@ -26,7 +34,6 @@ CSOURCES = ares__addrinfo2hostent.c \ ares_getsock.c \ ares_init.c \ ares_library_init.c \ - ares_llist.c \ ares_mkquery.c \ ares_create_query.c \ ares_nowarn.c \ @@ -54,26 +61,29 @@ CSOURCES = ares__addrinfo2hostent.c \ ares_strsplit.c \ ares_timeout.c \ ares_version.c \ - ares_writev.c \ bitncmp.c \ inet_net_pton.c \ inet_ntop.c \ windows_port.c -HHEADERS = ares_android.h \ +HHEADERS = ares__htable.h \ + ares__htable_asvp.h \ + ares__htable_stvp.h \ + ares__llist.h \ + ares__buf.h \ + ares__slist.h \ + ares_android.h \ ares_data.h \ ares_getenv.h \ ares_inet_net_pton.h \ ares_iphlpapi.h \ ares_ipv6.h \ - ares_llist.h \ ares_nowarn.h \ ares_platform.h \ ares_private.h \ ares_strcasecmp.h \ ares_strdup.h \ ares_strsplit.h \ - ares_writev.h \ bitncmp.h \ ares_setup.h \ setup_once.h diff --git a/graal-nodejs/deps/cares/src/lib/ares__addrinfo2hostent.c b/graal-nodejs/deps/cares/src/lib/ares__addrinfo2hostent.c index efb145cd11b..1798fc69fa2 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__addrinfo2hostent.c +++ b/graal-nodejs/deps/cares/src/lib/ares__addrinfo2hostent.c @@ -1,19 +1,30 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright 2005 Dominick Meglio - * Copyright (C) 2019 by Andrew Selivanov - * Copyright (C) 2021 by Brad House +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2005 Dominick Meglio + * Copyright (c) 2019 Andrew Selivanov + * Copyright (c) 2021 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares__addrinfo_localhost.c b/graal-nodejs/deps/cares/src/lib/ares__addrinfo_localhost.c index 5bc1e0bff08..a086d3f12fd 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__addrinfo_localhost.c +++ b/graal-nodejs/deps/cares/src/lib/ares__addrinfo_localhost.c @@ -1,16 +1,28 @@ -/* Copyright (C) 2021 +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) Massachusetts Institute of Technology + * Copyright (c) Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares__buf.c b/graal-nodejs/deps/cares/src/lib/ares__buf.c new file mode 100644 index 00000000000..777a5300c99 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__buf.c @@ -0,0 +1,476 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#include "ares_setup.h" +#include "ares.h" +#include "ares_private.h" +#include "ares__buf.h" +#include +#ifdef HAVE_STDINT_H +# include +#endif + +struct ares__buf { + const unsigned char *data; /*!< pointer to start of data buffer */ + size_t data_len; /*!< total size of data in buffer */ + + unsigned char *alloc_buf; /*!< Pointer to allocated data buffer, + * not used for const buffers */ + size_t alloc_buf_len; /*!< Size of allocated data buffer */ + + size_t offset; /*!< Current working offset in buffer */ + size_t tag_offset; /*!< Tagged offset in buffer. Uses + * SIZE_MAX if not set. */ +}; + +ares__buf_t *ares__buf_create(void) +{ + ares__buf_t *buf = ares_malloc(sizeof(*buf)); + if (buf == NULL) + return NULL; + + memset(buf, 0, sizeof(*buf)); + buf->tag_offset = SIZE_MAX; + return buf; +} + + +ares__buf_t *ares__buf_create_const(const unsigned char *data, size_t data_len) +{ + ares__buf_t *buf; + + if (data == NULL || data_len == 0) + return NULL; + + buf = ares__buf_create(); + if (buf == NULL) + return NULL; + + buf->data = data; + buf->data_len = data_len; + + return buf; +} + + +void ares__buf_destroy(ares__buf_t *buf) +{ + if (buf == NULL) + return; + ares_free(buf->alloc_buf); + ares_free(buf); +} + + +static int ares__buf_is_const(const ares__buf_t *buf) +{ + if (buf == NULL) + return 0; + + if (buf->data != NULL && buf->alloc_buf == NULL) + return 1; + + return 0; +} + + +static void ares__buf_reclaim(ares__buf_t *buf) +{ + size_t prefix_size; + size_t data_size; + + if (buf == NULL) + return; + + if (ares__buf_is_const(buf)) + return; + + if (buf->tag_offset != SIZE_MAX) { + prefix_size = buf->tag_offset; + } else { + prefix_size = buf->offset; + } + + if (prefix_size == 0) + return; + + data_size = buf->data_len - prefix_size; + + memmove(buf->alloc_buf, buf->alloc_buf + prefix_size, data_size); + buf->data = buf->alloc_buf; + buf->data_len = data_size; + buf->offset -= prefix_size; + if (buf->tag_offset != SIZE_MAX) + buf->tag_offset -= prefix_size; + + return; +} + + +static int ares__buf_ensure_space(ares__buf_t *buf, size_t needed_size) +{ + size_t remaining_size; + size_t alloc_size; + unsigned char *ptr; + + if (buf == NULL) + return ARES_EFORMERR; + + if (ares__buf_is_const(buf)) + return ARES_EFORMERR; + + /* When calling ares__buf_finish_str() we end up adding a null terminator, + * so we want to ensure the size is always sufficient for this as we don't + * want an ARES_ENOMEM at that point */ + needed_size++; + + /* No need to do an expensive move operation, we have enough to just append */ + remaining_size = buf->alloc_buf_len - buf->data_len; + if (remaining_size >= needed_size) + return ARES_SUCCESS; + + /* See if just moving consumed data frees up enough space */ + ares__buf_reclaim(buf); + + remaining_size = buf->alloc_buf_len - buf->data_len; + if (remaining_size >= needed_size) + return ARES_SUCCESS; + + alloc_size = buf->alloc_buf_len; + + /* Not yet started */ + if (alloc_size == 0) + alloc_size = 16; /* Always shifts 1, so ends up being 32 minimum */ + + /* Increase allocation by powers of 2 */ + do { + alloc_size <<= 1; + remaining_size = alloc_size - buf->data_len; + } while (remaining_size < needed_size); + + ptr = ares_realloc(buf->alloc_buf, alloc_size); + if (ptr == NULL) + return ARES_ENOMEM; + + buf->alloc_buf = ptr; + buf->alloc_buf_len = alloc_size; + buf->data = ptr; + + return ARES_SUCCESS; +} + + +int ares__buf_append(ares__buf_t *buf, const unsigned char *data, + size_t data_len) +{ + int status; + + if (data == NULL || data_len == 0) + return ARES_EFORMERR; + + status = ares__buf_ensure_space(buf, data_len); + if (status != ARES_SUCCESS) + return status; + + memcpy(buf->alloc_buf + buf->data_len, data, data_len); + buf->data_len += data_len; + return ARES_SUCCESS; +} + + +unsigned char *ares__buf_append_start(ares__buf_t *buf, size_t *len) +{ + int status; + + if (len == NULL || *len == 0) + return NULL; + + status = ares__buf_ensure_space(buf, *len); + if (status != ARES_SUCCESS) + return NULL; + + *len = buf->alloc_buf_len - buf->data_len; + return buf->alloc_buf + buf->data_len; +} + + +void ares__buf_append_finish(ares__buf_t *buf, size_t len) +{ + if (buf == NULL) + return; + + buf->data_len += len; +} + + +unsigned char *ares__buf_finish_bin(ares__buf_t *buf, size_t *len) +{ + unsigned char *ptr = NULL; + if (buf == NULL || len == NULL || ares__buf_is_const(buf)) + return NULL; + + ares__buf_reclaim(buf); + ptr = buf->alloc_buf; + *len = buf->data_len; + ares_free(buf); + return ptr; +} + + +char *ares__buf_finish_str(ares__buf_t *buf, size_t *len) +{ + char *ptr; + size_t mylen; + + ptr = (char *)ares__buf_finish_bin(buf, &mylen); + if (ptr == NULL) + return NULL; + + if (len != NULL) + *len = mylen; + + /* NOTE: ensured via ares__buf_ensure_space() that there is always at least + * 1 extra byte available for this specific use-case */ + ptr[mylen] = 0; + + return ptr; +} + + +void ares__buf_tag(ares__buf_t *buf) +{ + if (buf == NULL) + return; + + buf->tag_offset = buf->offset; +} + + +int ares__buf_tag_rollback(ares__buf_t *buf) +{ + if (buf == NULL || buf->tag_offset == SIZE_MAX) + return ARES_EFORMERR; + + buf->offset = buf->tag_offset; + buf->tag_offset = SIZE_MAX; + return ARES_SUCCESS; +} + + +int ares__buf_tag_clear(ares__buf_t *buf) +{ + if (buf == NULL || buf->tag_offset == SIZE_MAX) + return ARES_EFORMERR; + + buf->tag_offset = SIZE_MAX; + return ARES_SUCCESS; +} + + +const unsigned char *ares__buf_tag_fetch(const ares__buf_t *buf, size_t *len) +{ + if (buf == NULL || buf->tag_offset == SIZE_MAX || len == NULL) + return NULL; + + *len = buf->offset - buf->tag_offset; + return buf->data + buf->tag_offset; +} + + +static const unsigned char *ares__buf_fetch(const ares__buf_t *buf, size_t *len) +{ + if (len != NULL) + *len = 0; + + if (buf == NULL || len == NULL || buf->data == NULL) + return NULL; + + *len = buf->data_len - buf->offset; + return buf->data + buf->offset; +} + + +int ares__buf_consume(ares__buf_t *buf, size_t len) +{ + size_t remaining_len; + + ares__buf_fetch(buf, &remaining_len); + + if (remaining_len < len) + return ARES_EBADRESP; + + buf->offset += len; + return ARES_SUCCESS; +} + + +int ares__buf_fetch_be16(ares__buf_t *buf, unsigned short *u16) +{ + size_t remaining_len; + const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + + if (buf == NULL || u16 == NULL || remaining_len < sizeof(*u16)) + return ARES_EBADRESP; + + *u16 = (unsigned short)((unsigned short)(ptr[0]) << 8 | (unsigned short)ptr[1]); + + return ares__buf_consume(buf, sizeof(*u16)); +} + + +int ares__buf_fetch_bytes(ares__buf_t *buf, unsigned char *bytes, + size_t len) +{ + size_t remaining_len; + const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + + if (buf == NULL || bytes == NULL || len == 0 || remaining_len < len) + return ARES_EBADRESP; + + memcpy(bytes, ptr, len); + return ares__buf_consume(buf, len); +} + + +size_t ares__buf_consume_whitespace(ares__buf_t *buf, int include_linefeed) +{ + size_t remaining_len = 0; + const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + size_t i; + + if (ptr == NULL) + return 0; + + for (i=0; i 0) + ares__buf_consume(buf, i); + return i; +} + +size_t ares__buf_consume_nonwhitespace(ares__buf_t *buf) +{ + size_t remaining_len = 0; + const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + size_t i; + + if (ptr == NULL) + return 0; + + for (i=0; i 0) + ares__buf_consume(buf, i); + return i; +} + +size_t ares__buf_consume_line(ares__buf_t *buf, int include_linefeed) +{ + size_t remaining_len = 0; + const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + size_t i; + + if (ptr == NULL) + return 0; + + for (i=0; i 0) + ares__buf_consume(buf, i); + return i; +} + + +int ares__buf_begins_with(ares__buf_t *buf, const unsigned char *data, + size_t data_len) +{ + size_t remaining_len = 0; + const unsigned char *ptr = ares__buf_fetch(buf, &remaining_len); + + if (ptr == NULL || data == NULL || data_len == 0) + return ARES_EFORMERR; + + if (data_len > remaining_len) + return ARES_EBADRESP; + + if (memcmp(ptr, data, data_len) == 0) + return ARES_EBADRESP; + + return ARES_SUCCESS; +} + + +size_t ares__buf_len(const ares__buf_t *buf) +{ + size_t len = 0; + ares__buf_fetch(buf, &len); + return len; +} + + +const unsigned char *ares__buf_peek(const ares__buf_t *buf, size_t *len) +{ + return ares__buf_fetch(buf, len); +} + diff --git a/graal-nodejs/deps/cares/src/lib/ares__buf.h b/graal-nodejs/deps/cares/src/lib/ares__buf.h new file mode 100644 index 00000000000..d81fc26f426 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__buf.h @@ -0,0 +1,252 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#ifndef __ARES__BUF_H +#define __ARES__BUF_H + +/*! \addtogroup ares__buf Safe Data Builder and buffer + * + * This is a buffer building and parsing framework with a focus on security over + * performance. All data to be read from the buffer will perform explicit length + * validation and return a success/fail result. There are also various helpers + * for writing data to the buffer which dynamically grows. + * + * The helpers for this object are meant to be added as needed. If you can't + * find it, write it! + * + * @{ + */ +struct ares__buf; + +/*! Opaque data type for generic hash table implementation */ +typedef struct ares__buf ares__buf_t; + +/*! Create a new buffer object that dynamically allocates buffers for data. + * + * \return initialized buffer object or NULL if out of memory. + */ +ares__buf_t *ares__buf_create(void); + +/*! Create a new buffer object that uses a user-provided data pointer. The + * data provided will not be manipulated, and cannot be appended to. This + * is strictly used for parsing. + * + * \param[in] data Data to provide to buffer, must not be NULL. + * \param[in] data_len Size of buffer provided, must be > 0 + * + * \return initialized buffer object or NULL if out of memory or misuse. + */ +ares__buf_t *ares__buf_create_const(const unsigned char *data, size_t data_len); + +/*! Destroy an initialized buffer object. + * + * \param[in] buf Initialized buf object + */ +void ares__buf_destroy(ares__buf_t *buf); + +/*! Append to a dynamic buffer object + * + * \param[in] buf Initialized buffer object + * \param[in] data Data to copy to buffer object + * \param[in] data_len Length of data to copy to buffer object. + * \return ARES_SUCCESS or one of the c-ares error codes + */ +int ares__buf_append(ares__buf_t *buf, const unsigned char *data, + size_t data_len); + + +/*! Start a dynamic append operation that returns a buffer suitable for + * writing. A desired minimum length is passed in, and the actual allocated + * buffer size is returned which may be greater than the requested size. + * No operation other than ares__buf_append_finish() is allowed on the + * buffer after this request. + * + * \param[in] buf Initialized buffer object + * \param[in,out] len Desired non-zero length passed in, actual buffer size + * returned. + * \return Pointer to writable buffer or NULL on failure (usage, out of mem) + */ +unsigned char *ares__buf_append_start(ares__buf_t *buf, size_t *len); + +/*! Finish a dynamic append operation. Called after + * ares__buf_append_start() once desired data is written. + * + * \param[in] buf Initialized buffer object. + * \param[in] len Length of data written. May be zero to terminate + * operation. Must not be greater than returned from + * ares__buf_append_start(). + */ +void ares__buf_append_finish(ares__buf_t *buf, size_t len); + +/*! Clean up ares__buf_t and return allocated pointer to unprocessed data. It + * is the responsibility of the caller to ares_free() the returned buffer. + * The passed in buf parameter is invalidated by this call. + * + * \param[in] buf Initialized buffer object. Can not be a "const" buffer. + * \param[out] len Length of data returned + * \return pointer to unprocessed data or NULL on error. + */ +unsigned char *ares__buf_finish_bin(ares__buf_t *buf, size_t *len); + +/*! Clean up ares__buf_t and return allocated pointer to unprocessed data and + * return it as a string (null terminated). It is the responsibility of the + * caller to ares_free() the returned buffer. The passed in buf parameter is + * invalidated by this call. + * + * This function in no way validates the data in this buffer is actually + * a string, that characters are printable, or that there aren't multiple + * NULL terminators. It is assumed that the caller will either validate that + * themselves or has built this buffer with only a valid character set. + * + * \param[in] buf Initialized buffer object. Can not be a "const" buffer. + * \param[out] len Optional. Length of data returned, or NULL if not needed. + * \return pointer to unprocessed data or NULL on error. + */ +char *ares__buf_finish_str(ares__buf_t *buf, size_t *len); + +/*! Tag a position to save in the buffer in case parsing needs to rollback, + * such as if insufficient data is available, but more data may be added in + * the future. Only a single tag can be set per buffer object. Setting a + * tag will override any pre-existing tag. + * + * \param[in] buf Initialized buffer object + */ +void ares__buf_tag(ares__buf_t *buf); + +/*! Rollback to a tagged position. Will automatically clear the tag. + * + * \param[in] buf Initialized buffer object + * \return ARES_SUCCESS or one of the c-ares error codes + */ +int ares__buf_tag_rollback(ares__buf_t *buf); + +/*! Clear the tagged position without rolling back. You should do this any + * time a tag is no longer needed as future append operations can reclaim + * buffer space. + * + * \param[in] buf Initialized buffer object + * \return ARES_SUCCESS or one of the c-ares error codes + */ +int ares__buf_tag_clear(ares__buf_t *buf); + +/*! Fetch the buffer and length of data starting from the tagged position up + * to the _current_ position. It will not unset the tagged position. The + * data may be invalidated by any future ares__buf_*() calls. + * + * \param[in] buf Initialized buffer object + * \param[out] len Length between tag and current offset in buffer + * \return NULL on failure (such as no tag), otherwise pointer to start of + * buffer + */ +const unsigned char *ares__buf_tag_fetch(const ares__buf_t *buf, size_t *len); + +/*! Consume the given number of bytes without reading them. + * + * \param[in] buf Initialized buffer object + * \param[in] len Length to consume + * \return ARES_SUCCESS or one of the c-ares error codes + */ +int ares__buf_consume(ares__buf_t *buf, size_t len); + +/*! Fetch a 16bit Big Endian number from the buffer. + * + * \param[in] buf Initialized buffer object + * \param[out] u16 Buffer to hold 16bit integer + * \return ARES_SUCCESS or one of the c-ares error codes + */ +int ares__buf_fetch_be16(ares__buf_t *buf, unsigned short *u16); + +/*! Fetch the requested number of bytes into the provided buffer + * + * \param[in] buf Initialized buffer object + * \param[out] bytes Buffer to hold data + * \param[in] len Requested number of bytes (must be > 0) + * \return ARES_SUCCESS or one of the c-ares error codes + */ +int ares__buf_fetch_bytes(ares__buf_t *buf, unsigned char *bytes, + size_t len); + +/*! Consume whitespace characters (0x09, 0x0B, 0x0C, 0x0D, 0x20, and optionally + * 0x0A). + * + * \param[in] buf Initialized buffer object + * \param[in] include_linefeed 1 to include consuming 0x0A, 0 otherwise. + * \return number of whitespace characters consumed + */ +size_t ares__buf_consume_whitespace(ares__buf_t *buf, int include_linefeed); + + +/*! Consume any non-whitespace character (anything other than 0x09, 0x0B, 0x0C, + * 0x0D, 0x20, and 0x0A). + * + * \param[in] buf Initialized buffer object + * \return number of characters consumed + */ +size_t ares__buf_consume_nonwhitespace(ares__buf_t *buf); + +/*! Consume from the current position until the end of the line, and optionally + * the end of line character (0x0A) itself. + * + * \param[in] buf Initialized buffer object + * \param[in] include_linefeed 1 to include consuming 0x0A, 0 otherwise. + * \return number of characters consumed + */ +size_t ares__buf_consume_line(ares__buf_t *buf, int include_linefeed); + + +/*! Check the unprocessed buffer to see if it begins with the sequence of + * characters provided. + * + * \param[in] buf Initialized buffer object + * \param[in] data Bytes of data to compare. + * \param[in] data_len Length of data to compare. + * \return ARES_SUCCESS or one of the c-ares error codes + */ +int ares__buf_begins_with(ares__buf_t *buf, const unsigned char *data, + size_t data_len); + + +/*! Size of unprocessed remaining data length + * + * \param[in] buf Initialized buffer object + * \return length remaining + */ +size_t ares__buf_len(const ares__buf_t *buf); + +/*! Retrieve a pointer to the currently unprocessed data. Generally this isn't + * recommended to be used in practice. The returned pointer may be invalidated + * by any future ares__buf_*() calls. + * + * \param[in] buf Initialized buffer object + * \param[out] len Length of available data + * \return Pointer to buffer of unprocessed data + */ +const unsigned char *ares__buf_peek(const ares__buf_t *buf, + size_t *len); + + +/*! @} */ + +#endif /* __ARES__BUF_H */ diff --git a/graal-nodejs/deps/cares/src/lib/ares__close_sockets.c b/graal-nodejs/deps/cares/src/lib/ares__close_sockets.c index 0477174e3e1..fe64e54037d 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__close_sockets.c +++ b/graal-nodejs/deps/cares/src/lib/ares__close_sockets.c @@ -1,61 +1,104 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" #include "ares.h" #include "ares_private.h" +#include + -void ares__close_sockets(ares_channel channel, struct server_state *server) +void ares__close_connection(struct server_connection *conn) { - struct send_request *sendreq; - - /* Free all pending output buffers. */ - while (server->qhead) - { - /* Advance server->qhead; pull out query as we go. */ - sendreq = server->qhead; - server->qhead = sendreq->next; - if (sendreq->data_storage != NULL) - ares_free(sendreq->data_storage); - ares_free(sendreq); - } - server->qtail = NULL; - - /* Reset any existing input buffer. */ - if (server->tcp_buffer) - ares_free(server->tcp_buffer); - server->tcp_buffer = NULL; - server->tcp_lenbuf_pos = 0; - - /* Reset brokenness */ - server->is_broken = 0; - - /* Close the TCP and UDP sockets. */ - if (server->tcp_socket != ARES_SOCKET_BAD) - { - SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); - ares__close_socket(channel, server->tcp_socket); - server->tcp_socket = ARES_SOCKET_BAD; - server->tcp_connection_generation = ++channel->tcp_connection_generation; - } - if (server->udp_socket != ARES_SOCKET_BAD) - { - SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); - ares__close_socket(channel, server->udp_socket); - server->udp_socket = ARES_SOCKET_BAD; - } + struct server_state *server = conn->server; + ares_channel channel = server->channel; + + if (conn->is_tcp) { + /* Reset any existing input and output buffer. */ + ares__buf_consume(server->tcp_parser, ares__buf_len(server->tcp_parser)); + ares__buf_consume(server->tcp_send, ares__buf_len(server->tcp_send)); + server->tcp_connection_generation = ++channel->tcp_connection_generation; + server->tcp_conn = NULL; + } + + + SOCK_STATE_CALLBACK(channel, conn->fd, 0, 0); + ares__close_socket(channel, conn->fd); + ares__llist_node_claim( + ares__htable_asvp_get_direct(channel->connnode_by_socket, conn->fd) + ); + ares__htable_asvp_remove(channel->connnode_by_socket, conn->fd); + +#ifndef NDEBUG + assert(ares__llist_len(conn->queries_to_conn) == 0); +#endif + ares__llist_destroy(conn->queries_to_conn); + ares_free(conn); +} + +void ares__close_sockets(struct server_state *server) +{ + ares__llist_node_t *node; + + while ((node = ares__llist_node_first(server->connections)) != NULL) { + struct server_connection *conn = ares__llist_node_val(node); + ares__close_connection(conn); + } +} + +void ares__check_cleanup_conn(ares_channel channel, ares_socket_t fd) +{ + ares__llist_node_t *node; + struct server_connection *conn; + int do_cleanup = 0; + + node = ares__htable_asvp_get_direct(channel->connnode_by_socket, fd); + if (node == NULL) { + return; + } + + conn = ares__llist_node_val(node); + + if (ares__llist_len(conn->queries_to_conn)) { + return; + } + + /* If we are configured not to stay open, close it out */ + if (!(channel->flags & ARES_FLAG_STAYOPEN)) { + do_cleanup = 1; + } + + /* If the udp connection hit its max queries, always close it */ + if (!conn->is_tcp && channel->udp_max_queries > 0 && + conn->total_queries >= (size_t)channel->udp_max_queries) { + do_cleanup = 1; + } + + if (do_cleanup) { + ares__close_connection(conn); + } } diff --git a/graal-nodejs/deps/cares/src/lib/ares__get_hostent.c b/graal-nodejs/deps/cares/src/lib/ares__get_hostent.c index 367f39037b1..8ac2425ed46 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__get_hostent.c +++ b/graal-nodejs/deps/cares/src/lib/ares__get_hostent.c @@ -1,17 +1,28 @@ - -/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998, 2011 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares__htable.c b/graal-nodejs/deps/cares/src/lib/ares__htable.c new file mode 100644 index 00000000000..3ea65642d98 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__htable.c @@ -0,0 +1,374 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#include "ares_setup.h" +#include "ares.h" +#include "ares_private.h" +#include "ares__llist.h" +#include "ares__htable.h" + +#define ARES__HTABLE_MAX_BUCKETS (1U<<24) +#define ARES__HTABLE_MIN_BUCKETS (1U<<4) +#define ARES__HTABLE_EXPAND_PERCENT 75 + +struct ares__htable { + ares__htable_hashfunc_t hash; + ares__htable_bucket_key_t bucket_key; + ares__htable_bucket_free_t bucket_free; + ares__htable_key_eq_t key_eq; + unsigned int seed; + unsigned int size; + size_t num_keys; + /* NOTE: if we converted buckets into ares__slist_t we could guarantee on + * hash collisions we would have O(log n) worst case insert and search + * performance. (We'd also need to make key_eq into a key_cmp to + * support sort). That said, risk with a random hash seed is near zero, + * and ares__slist_t is heavier weight so I think using ares__llist_t is + * is an overall win. */ + ares__llist_t **buckets; +}; + + +static unsigned int ares__htable_generate_seed(ares__htable_t *htable) +{ + unsigned int seed = 0; + + /* Mix stack address, heap address, and time to generate a random seed, it + * doesn't have to be super secure, just quick. Likelihood of a hash + * collision attack is very low with a small amount of effort */ + seed |= (unsigned int)((size_t)htable & 0xFFFFFFFF); + seed |= (unsigned int)((size_t)&seed & 0xFFFFFFFF); + seed |= (unsigned int)time(NULL) & 0xFFFFFFFF; + return seed; +} + +static void ares__htable_buckets_destroy(ares__llist_t **buckets, + unsigned int size, + unsigned char destroy_vals) +{ + unsigned int i; + + if (buckets == NULL) + return; + + for (i=0; ibuckets, htable->size, 1); + ares_free(htable); +} + + +ares__htable_t *ares__htable_create(ares__htable_hashfunc_t hash_func, + ares__htable_bucket_key_t bucket_key, + ares__htable_bucket_free_t bucket_free, + ares__htable_key_eq_t key_eq) +{ + ares__htable_t *htable = NULL; + + if (hash_func == NULL || bucket_key == NULL || bucket_free == NULL || + key_eq == NULL) { + goto fail; + } + + htable = ares_malloc(sizeof(*htable)); + if (htable == NULL) + goto fail; + + memset(htable, 0, sizeof(*htable)); + + htable->hash = hash_func; + htable->bucket_key = bucket_key; + htable->bucket_free = bucket_free; + htable->key_eq = key_eq; + htable->seed = ares__htable_generate_seed(htable); + htable->size = ARES__HTABLE_MIN_BUCKETS; + htable->buckets = ares_malloc(sizeof(*htable->buckets) * htable->size); + + if (htable->buckets == NULL) + goto fail; + + memset(htable->buckets, 0, sizeof(*htable->buckets) * htable->size); + + return htable; + +fail: + ares__htable_destroy(htable); + return NULL; +} + + +/*! Grabs the Hashtable index from the key and length. The h index is + * the hash of the function reduced to the size of the bucket list. + * We are doing "hash & (size - 1)" since we are guaranteeing a power of + * 2 for size. This is equivalent to "hash % size", but should be more + * efficient */ +#define HASH_IDX(h, key) h->hash(key, h->seed) & (h->size - 1) + +static ares__llist_node_t *ares__htable_find(ares__htable_t *htable, + unsigned int idx, + const void *key) +{ + ares__llist_node_t *node = NULL; + + for (node = ares__llist_node_first(htable->buckets[idx]); + node != NULL; + node = ares__llist_node_next(node)) { + + if (htable->key_eq(key, htable->bucket_key(ares__llist_node_val(node)))) + break; + } + + return node; +} + + +static unsigned int ares__htable_expand(ares__htable_t *htable) +{ + ares__llist_t **buckets = NULL; + unsigned int old_size = htable->size; + size_t i; + + /* Not a failure, just won't expand */ + if (old_size == ARES__HTABLE_MAX_BUCKETS) + return 1; + + htable->size <<= 1; + + /* We must do this in 2 passes as we want it to be non-destructive in case + * there is a memory allocation failure. So we will actually use more + * memory doing it this way, but at least we might be able to gracefully + * recover */ + buckets = ares_malloc(sizeof(*buckets) * htable->size); + if (buckets == NULL) + goto fail; + + memset(buckets, 0, sizeof(*buckets) * htable->size); + + for (i=0; ibuckets[i]); + node != NULL; + node = ares__llist_node_next(node)) { + + void *val = ares__llist_node_val(node); + size_t idx = HASH_IDX(htable, htable->bucket_key(val)); + + if (buckets[idx] == NULL) { + buckets[idx] = ares__llist_create(htable->bucket_free); + if (buckets[idx] == NULL) + goto fail; + } + + if (ares__llist_insert_first(buckets[idx], val) == NULL) { + goto fail; + } + + } + } + + /* Swap out buckets */ + ares__htable_buckets_destroy(htable->buckets, old_size, 0); + htable->buckets = buckets; + return 1; + +fail: + ares__htable_buckets_destroy(buckets, htable->size, 0); + htable->size = old_size; + + return 0; +} + + +unsigned int ares__htable_insert(ares__htable_t *htable, void *bucket) +{ + unsigned int idx = 0; + ares__llist_node_t *node = NULL; + const void *key = NULL; + + if (htable == NULL || bucket == NULL) + return 0; + + + key = htable->bucket_key(bucket); + idx = HASH_IDX(htable, key); + + /* See if we have a matching bucket already, if so, replace it */ + node = ares__htable_find(htable, idx, key); + if (node != NULL) { + ares__llist_node_replace(node, bucket); + return 1; + } + + /* Check to see if we should rehash because likelihood of collisions has + * increased beyond our threshold */ + if (htable->num_keys+1 > (htable->size * ARES__HTABLE_EXPAND_PERCENT) / 100) { + if (!ares__htable_expand(htable)) { + return 0; + } + /* If we expanded, need to calculate a new index */ + idx = HASH_IDX(htable, key); + } + + /* We lazily allocate the linked list */ + if (htable->buckets[idx] == NULL) { + htable->buckets[idx] = ares__llist_create(htable->bucket_free); + if (htable->buckets[idx] == NULL) + return 0; + } + + node = ares__llist_insert_first(htable->buckets[idx], bucket); + if (node == NULL) + return 0; + + htable->num_keys++; + + return 1; +} + + +void *ares__htable_get(ares__htable_t *htable, const void *key) +{ + unsigned int idx; + + if (htable == NULL || key == NULL) + return NULL; + + idx = HASH_IDX(htable, key); + + return ares__llist_node_val(ares__htable_find(htable, idx, key)); +} + + +unsigned int ares__htable_remove(ares__htable_t *htable, const void *key) +{ + ares__llist_node_t *node; + unsigned int idx; + + if (htable == NULL || key == NULL) + return 0; + + idx = HASH_IDX(htable, key); + node = ares__htable_find(htable, idx, key); + if (node == NULL) + return 0; + + htable->num_keys--; + ares__llist_node_destroy(node); + return 1; +} + +size_t ares__htable_num_keys(ares__htable_t *htable) +{ + if (htable == NULL) + return 0; + return htable->num_keys; +} + +unsigned int ares__htable_hash_FNV1a(const unsigned char *key, size_t key_len, + unsigned int seed) +{ + /* recommended seed is 2166136261U, but we don't want collisions */ + unsigned int hv = seed; + size_t i; + + for (i = 0; i < key_len; i++) { + hv ^= (unsigned int)key[i]; + /* hv *= 0x01000193 */ + hv += (hv<<1) + (hv<<4) + (hv<<7) + (hv<<8) + (hv<<24); + } + + return hv; +} + +/* tolower() is locale-specific. Use a lookup table fast conversion that only + * operates on ASCII */ +static const unsigned char ares__tolower_lookup[] = { + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, + 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, + 0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, + 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27, + 0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, + 0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, + 0x40,0x61,0x62,0x63,0x64,0x65,0x66,0x67, + 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, + 0x78,0x79,0x7A,0x5B,0x5C,0x5D,0x5E,0x5F, + 0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67, + 0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, + 0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77, + 0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, + 0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97, + 0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, + 0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7, + 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, + 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7, + 0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, + 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7, + 0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, + 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7, + 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, + 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7, + 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, + 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7, + 0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF +}; + + +/* Case insensitive version, meant for ASCII strings */ +unsigned int ares__htable_hash_FNV1a_casecmp(const unsigned char *key, size_t key_len, + unsigned int seed) +{ + /* recommended seed is 2166136261U, but we don't want collisions */ + unsigned int hv = seed; + size_t i; + + for (i = 0; i < key_len; i++) { + hv ^= (unsigned int)ares__tolower_lookup[key[i]]; + /* hv *= 0x01000193 */ + hv += (hv<<1) + (hv<<4) + (hv<<7) + (hv<<8) + (hv<<24); + } + + return hv; +} diff --git a/graal-nodejs/deps/cares/src/lib/ares__htable.h b/graal-nodejs/deps/cares/src/lib/ares__htable.h new file mode 100644 index 00000000000..bbd36f779b4 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__htable.h @@ -0,0 +1,164 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#ifndef __ARES__HTABLE_H +#define __ARES__HTABLE_H + + +/*! \addtogroup ares__htable Base HashTable Data Structure + * + * This is a basic hashtable data structure that is meant to be wrapped + * by a higher level implementation. This data structure is designed to + * be callback-based in order to facilitate wrapping without needing to + * worry about any underlying complexities of the hashtable implementation. + * + * This implementation supports automatic growing by powers of 2 when reaching + * 75% capacity. A rehash will be performed on the expanded bucket list. + * + * Average time complexity: + * - Insert: O(1) + * - Search: O(1) + * - Delete: O(1) + * + * @{ + */ + +struct ares__htable_t; + +/*! Opaque data type for generic hash table implementation */ +typedef struct ares__htable ares__htable_t; + +/*! Callback for generating a hash of the key. + * + * \param[in] key pointer to key to be hashed + * \param[in] seed randomly generated seed used by hash function. + * value is specific to the hashtable instance + * but otherwise will not change between calls. + * \return hash + */ +typedef unsigned int (*ares__htable_hashfunc_t)(const void *key, + unsigned int seed); + +/*! Callback to free the bucket + * + * \param[in] bucket user provided bucket + */ +typedef void (*ares__htable_bucket_free_t)(void *bucket); + +/*! Callback to extract the key from the user-provided bucket + * + * \param[in] bucket user provided bucket + * \return pointer to key held in bucket + */ +typedef const void *(*ares__htable_bucket_key_t)(const void *bucket); + +/*! Callback to compare two keys for equality + * + * \param[in] key1 first key + * \param[in] key2 second key + * \return 1 if equal, 0 if not + */ +typedef unsigned int (*ares__htable_key_eq_t)(const void *key1, + const void *key2); + + +/*! Destroy the initialized hashtable + * + * \param[in] initialized hashtable + */ +void ares__htable_destroy(ares__htable_t *htable); + +/*! Create a new hashtable + * + * \param[in] hash_func Required. Callback for Hash function. + * \param[in] bucket_key Required. Callback to extract key from bucket. + * \param[in] bucket_free Required. Callback to free bucket. + * \param[in] key_eq Required. Callback to check for key equality. + * \return initialized hashtable. NULL if out of memory or misuse. + */ +ares__htable_t *ares__htable_create(ares__htable_hashfunc_t hash_func, + ares__htable_bucket_key_t bucket_key, + ares__htable_bucket_free_t bucket_free, + ares__htable_key_eq_t key_eq); + +/*! Count of keys from initialized hashtable + * + * \param[in] htable Initialized hashtable. + * \return count of keys + */ +size_t ares__htable_num_keys(ares__htable_t *htable); + +/*! Insert bucket into hashtable + * + * \param[in] htable Initialized hashtable. + * \param[in] bucket User-provided bucket to insert. Takes "ownership". Not + * allowed to be NULL. + * \return 1 on success, 0 if out of memory + */ +unsigned int ares__htable_insert(ares__htable_t *htable, void *bucket); + +/*! Retrieve bucket from hashtable based on key. + * + * \param[in] htable Initialized hashtable + * \param[in] key Pointer to key to use for comparison. + * \return matching bucket, or NULL if not found. + */ +void *ares__htable_get(ares__htable_t *htable, const void *key); + +/*! Remove bucket from hashtable by key + * + * \param[in] htable Initialized hashtable + * \param[in] key Pointer to key to use for comparison + * \return 1 if found, 0 if not found + */ +unsigned int ares__htable_remove(ares__htable_t *htable, const void *key); + +/*! FNV1a hash algorithm. Can be used as underlying primitive for building + * a wrapper hashtable. + * + * \param[in] key pointer to key + * \param[in] key_len Length of key + * \param[in] seed Seed for generating hash + * \return hash value + */ +unsigned int ares__htable_hash_FNV1a(const unsigned char *key, size_t key_len, + unsigned int seed); + +/*! FNV1a hash algorithm, but converts all characters to lowercase before + * hashing to make the hash case-insensitive. Can be used as underlying + * primitive for building a wrapper hashtable. Used on string-based keys. + * + * \param[in] key pointer to key + * \param[in] key_len Length of key + * \param[in] seed Seed for generating hash + * \return hash value + */ +unsigned int ares__htable_hash_FNV1a_casecmp(const unsigned char *key, + size_t key_len, + unsigned int seed); + +/*! @} */ + +#endif /* __ARES__HTABLE_H */ diff --git a/graal-nodejs/deps/cares/src/lib/ares__htable_asvp.c b/graal-nodejs/deps/cares/src/lib/ares__htable_asvp.c new file mode 100644 index 00000000000..70265241592 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__htable_asvp.c @@ -0,0 +1,195 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#include "ares_setup.h" +#include "ares.h" +#include "ares_private.h" +#include "ares__htable.h" +#include "ares__htable_asvp.h" + + +struct ares__htable_asvp { + ares__htable_asvp_val_free_t free_val; + ares__htable_t *hash; +}; + + +typedef struct { + ares_socket_t key; + void *val; + ares__htable_asvp_t *parent; +} ares__htable_asvp_bucket_t; + + +void ares__htable_asvp_destroy(ares__htable_asvp_t *htable) +{ + if (htable == NULL) + return; + + ares__htable_destroy(htable->hash); + ares_free(htable); +} + + +static unsigned int hash_func(const void *key, unsigned int seed) +{ + const ares_socket_t *arg = key; + return ares__htable_hash_FNV1a((const unsigned char *)arg, sizeof(*arg), + seed); +} + + +static const void *bucket_key(const void *bucket) +{ + const ares__htable_asvp_bucket_t *arg = bucket; + return &arg->key; +} + + +static void bucket_free(void *bucket) +{ + ares__htable_asvp_bucket_t *arg = bucket; + + if (arg->parent->free_val) + arg->parent->free_val(arg->val); + + ares_free(arg); +} + + +static unsigned int key_eq(const void *key1, const void *key2) +{ + const ares_socket_t *k1 = key1; + const ares_socket_t *k2 = key2; + + if (*k1 == *k2) + return 1; + + return 0; +} + + +ares__htable_asvp_t *ares__htable_asvp_create( + ares__htable_asvp_val_free_t val_free) +{ + ares__htable_asvp_t *htable = ares_malloc(sizeof(*htable)); + if (htable == NULL) + goto fail; + + htable->hash = ares__htable_create(hash_func, + bucket_key, + bucket_free, + key_eq); + if (htable->hash == NULL) + goto fail; + + htable->free_val = val_free; + + return htable; + +fail: + if (htable) { + ares__htable_destroy(htable->hash); + ares_free(htable); + } + return NULL; +} + + +unsigned int ares__htable_asvp_insert(ares__htable_asvp_t *htable, + ares_socket_t key, void *val) +{ + ares__htable_asvp_bucket_t *bucket = NULL; + + if (htable == NULL) + goto fail; + + bucket = ares_malloc(sizeof(*bucket)); + if (bucket == NULL) + goto fail; + + bucket->parent = htable; + bucket->key = key; + bucket->val = val; + + if (!ares__htable_insert(htable->hash, bucket)) + goto fail; + + return 1; + +fail: + if (bucket) { + ares_free(bucket); + } + return 0; +} + + +unsigned int ares__htable_asvp_get(ares__htable_asvp_t *htable, + ares_socket_t key, void **val) +{ + ares__htable_asvp_bucket_t *bucket = NULL; + + if (val) + *val = NULL; + + if (htable == NULL) + return 0; + + bucket = ares__htable_get(htable->hash, &key); + if (bucket == NULL) + return 0; + + if (val) + *val = bucket->val; + return 1; +} + + +void *ares__htable_asvp_get_direct(ares__htable_asvp_t *htable, + ares_socket_t key) +{ + void *val = NULL; + ares__htable_asvp_get(htable, key, &val); + return val; +} + + +unsigned int ares__htable_asvp_remove(ares__htable_asvp_t *htable, + ares_socket_t key) +{ + if (htable == NULL) + return 0; + + return ares__htable_remove(htable->hash, &key); +} + + +size_t ares__htable_asvp_num_keys(ares__htable_asvp_t *htable) +{ + if (htable == NULL) + return 0; + return ares__htable_num_keys(htable->hash); +} diff --git a/graal-nodejs/deps/cares/src/lib/ares__htable_asvp.h b/graal-nodejs/deps/cares/src/lib/ares__htable_asvp.h new file mode 100644 index 00000000000..f53b2775e02 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__htable_asvp.h @@ -0,0 +1,120 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#ifndef __ARES__HTABLE_ASVP_H +#define __ARES__HTABLE_ASVP_H + +/*! \addtogroup ares__htable_asvp HashTable with ares_socket_t Key and + * void pointer Value + * + * This data structure wraps the base ares__htable data structure in order to + * split the key and value data types as ares_socket_t and void pointer, + * respectively. + * + * Average time complexity: + * - Insert: O(1) + * - Search: O(1) + * - Delete: O(1) + * + * @{ + */ + +struct ares__htable_asvp; + +/*! Opaque data type for ares_socket_t key, void pointer hash table + * implementation */ +typedef struct ares__htable_asvp ares__htable_asvp_t; + +/*! Callback to free value stored in hashtable + * + * \param[in] val user-supplied value + */ +typedef void (*ares__htable_asvp_val_free_t)(void *val); + +/*! Destroy hashtable + * + * \param[in] htable Initialized hashtable + */ +void ares__htable_asvp_destroy(ares__htable_asvp_t *htable); + +/*! Create size_t key, void pointer value hash table + * + * \param[in] val_free Optional. Call back to free user-supplied value. If + * NULL it is expected the caller will clean up any user + * supplied values. + */ +ares__htable_asvp_t *ares__htable_asvp_create( + ares__htable_asvp_val_free_t val_free); + +/*! Insert key/value into hash table + * + * \param[in] htable Initialized hash table + * \param[in] key key to associate with value + * \param[in] val value to store (takes ownership). May be NULL. + * \return 1 on success, 0 on out of memory or misuse + */ +unsigned int ares__htable_asvp_insert(ares__htable_asvp_t *htable, + ares_socket_t key, void *val); + +/*! Retrieve value from hashtable based on key + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \param[out] val Optional. Pointer to store value. + * \return 1 on success, 0 on failure + */ +unsigned int ares__htable_asvp_get(ares__htable_asvp_t *htable, + ares_socket_t key, void **val); + +/*! Retrieve value from hashtable directly as return value. Caveat to this + * function over ares__htable_asvp_get() is that if a NULL value is stored + * you cannot determine if the key is not found or the value is NULL. + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return value associated with key in hashtable or NULL + */ +void *ares__htable_asvp_get_direct(ares__htable_asvp_t *htable, + ares_socket_t key); + +/*! Remove a value from the hashtable by key + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return 1 if found, 0 if not + */ +unsigned int ares__htable_asvp_remove(ares__htable_asvp_t *htable, + ares_socket_t key); + +/*! Retrieve the number of keys stored in the hash table + * + * \param[in] htable Initialized hash table + * \return count + */ +size_t ares__htable_asvp_num_keys(ares__htable_asvp_t *htable); + +/*! @} */ + +#endif /* __ARES__HTABLE_ASVP_H */ diff --git a/graal-nodejs/deps/cares/src/lib/ares__htable_stvp.c b/graal-nodejs/deps/cares/src/lib/ares__htable_stvp.c new file mode 100644 index 00000000000..7a4cd40a763 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__htable_stvp.c @@ -0,0 +1,193 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#include "ares_setup.h" +#include "ares.h" +#include "ares_private.h" +#include "ares__htable.h" +#include "ares__htable_stvp.h" + + +struct ares__htable_stvp { + ares__htable_stvp_val_free_t free_val; + ares__htable_t *hash; +}; + + +typedef struct { + size_t key; + void *val; + ares__htable_stvp_t *parent; +} ares__htable_stvp_bucket_t; + + +void ares__htable_stvp_destroy(ares__htable_stvp_t *htable) +{ + if (htable == NULL) + return; + + ares__htable_destroy(htable->hash); + ares_free(htable); +} + + +static unsigned int hash_func(const void *key, unsigned int seed) +{ + const size_t *arg = key; + return ares__htable_hash_FNV1a((const unsigned char *)arg, sizeof(*arg), + seed); +} + + +static const void *bucket_key(const void *bucket) +{ + const ares__htable_stvp_bucket_t *arg = bucket; + return &arg->key; +} + + +static void bucket_free(void *bucket) +{ + ares__htable_stvp_bucket_t *arg = bucket; + + if (arg->parent->free_val) + arg->parent->free_val(arg->val); + + ares_free(arg); +} + + +static unsigned int key_eq(const void *key1, const void *key2) +{ + const size_t *k1 = key1; + const size_t *k2 = key2; + + if (*k1 == *k2) + return 1; + + return 0; +} + + +ares__htable_stvp_t *ares__htable_stvp_create( + ares__htable_stvp_val_free_t val_free) +{ + ares__htable_stvp_t *htable = ares_malloc(sizeof(*htable)); + if (htable == NULL) + goto fail; + + htable->hash = ares__htable_create(hash_func, + bucket_key, + bucket_free, + key_eq); + if (htable->hash == NULL) + goto fail; + + htable->free_val = val_free; + + return htable; + +fail: + if (htable) { + ares__htable_destroy(htable->hash); + ares_free(htable); + } + return NULL; +} + + +unsigned int ares__htable_stvp_insert(ares__htable_stvp_t *htable, size_t key, + void *val) +{ + ares__htable_stvp_bucket_t *bucket = NULL; + + if (htable == NULL) + goto fail; + + bucket = ares_malloc(sizeof(*bucket)); + if (bucket == NULL) + goto fail; + + bucket->parent = htable; + bucket->key = key; + bucket->val = val; + + if (!ares__htable_insert(htable->hash, bucket)) + goto fail; + + return 1; + +fail: + if (bucket) { + ares_free(bucket); + } + return 0; +} + + +unsigned int ares__htable_stvp_get(ares__htable_stvp_t *htable, size_t key, + void **val) +{ + ares__htable_stvp_bucket_t *bucket = NULL; + + if (val) + *val = NULL; + + if (htable == NULL) + return 0; + + bucket = ares__htable_get(htable->hash, &key); + if (bucket == NULL) + return 0; + + if (val) + *val = bucket->val; + return 1; +} + + +void *ares__htable_stvp_get_direct(ares__htable_stvp_t *htable, size_t key) +{ + void *val = NULL; + ares__htable_stvp_get(htable, key, &val); + return val; +} + + +unsigned int ares__htable_stvp_remove(ares__htable_stvp_t *htable, size_t key) +{ + if (htable == NULL) + return 0; + + return ares__htable_remove(htable->hash, &key); +} + + +size_t ares__htable_stvp_num_keys(ares__htable_stvp_t *htable) +{ + if (htable == NULL) + return 0; + return ares__htable_num_keys(htable->hash); +} diff --git a/graal-nodejs/deps/cares/src/lib/ares__htable_stvp.h b/graal-nodejs/deps/cares/src/lib/ares__htable_stvp.h new file mode 100644 index 00000000000..11d9d5ed4cf --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__htable_stvp.h @@ -0,0 +1,115 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#ifndef __ARES__HTABLE_STVP_H +#define __ARES__HTABLE_STVP_H + +/*! \addtogroup ares__htable_stvp HashTable with size_t Key and void pointer Value + * + * This data structure wraps the base ares__htable data structure in order to + * split the key and value data types as size_t and void pointer, respectively. + * + * Average time complexity: + * - Insert: O(1) + * - Search: O(1) + * - Delete: O(1) + * + * @{ + */ + +struct ares__htable_stvp; + +/*! Opaque data type for size_t key, void pointer hash table implementation */ +typedef struct ares__htable_stvp ares__htable_stvp_t; + +/*! Callback to free value stored in hashtable + * + * \param[in] val user-supplied value + */ +typedef void (*ares__htable_stvp_val_free_t)(void *val); + +/*! Destroy hashtable + * + * \param[in] htable Initialized hashtable + */ +void ares__htable_stvp_destroy(ares__htable_stvp_t *htable); + +/*! Create size_t key, void pointer value hash table + * + * \param[in] val_free Optional. Call back to free user-supplied value. If + * NULL it is expected the caller will clean up any user + * supplied values. + */ +ares__htable_stvp_t *ares__htable_stvp_create( + ares__htable_stvp_val_free_t val_free); + +/*! Insert key/value into hash table + * + * \param[in] htable Initialized hash table + * \param[in] key key to associate with value + * \param[in] val value to store (takes ownership). May be NULL. + * \return 1 on success, 0 on out of memory or misuse + */ +unsigned int ares__htable_stvp_insert(ares__htable_stvp_t *htable, size_t key, + void *val); + +/*! Retrieve value from hashtable based on key + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \param[out] val Optional. Pointer to store value. + * \return 1 on success, 0 on failure + */ +unsigned int ares__htable_stvp_get(ares__htable_stvp_t *htable, size_t key, + void **val); + +/*! Retrieve value from hashtable directly as return value. Caveat to this + * function over ares__htable_stvp_get() is that if a NULL value is stored + * you cannot determine if the key is not found or the value is NULL. + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return value associated with key in hashtable or NULL + */ +void *ares__htable_stvp_get_direct(ares__htable_stvp_t *htable, size_t key); + +/*! Remove a value from the hashtable by key + * + * \param[in] htable Initialized hash table + * \param[in] key key to use to search + * \return 1 if found, 0 if not + */ +unsigned int ares__htable_stvp_remove(ares__htable_stvp_t *htable, size_t key); + +/*! Retrieve the number of keys stored in the hash table + * + * \param[in] htable Initialized hash table + * \return count + */ +size_t ares__htable_stvp_num_keys(ares__htable_stvp_t *htable); + +/*! @} */ + +#endif /* __ARES__HTABLE_STVP_H */ diff --git a/graal-nodejs/deps/cares/src/lib/ares__llist.c b/graal-nodejs/deps/cares/src/lib/ares__llist.c new file mode 100644 index 00000000000..9ccda81a6ad --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__llist.c @@ -0,0 +1,316 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#include "ares_setup.h" +#include "ares.h" +#include "ares_private.h" +#include "ares__llist.h" + +struct ares__llist { + ares__llist_node_t *head; + ares__llist_node_t *tail; + ares__llist_destructor_t destruct; + size_t cnt; +}; + + +struct ares__llist_node { + void *data; + ares__llist_node_t *prev; + ares__llist_node_t *next; + ares__llist_t *parent; +}; + + +ares__llist_t *ares__llist_create(ares__llist_destructor_t destruct) +{ + ares__llist_t *list = ares_malloc(sizeof(*list)); + + if (list == NULL) + return NULL; + + memset(list, 0, sizeof(*list)); + + list->destruct = destruct; + + return list; +} + + +void ares__llist_replace_destructor(ares__llist_t *list, + ares__llist_destructor_t destruct) +{ + if (list == NULL) + return; + + list->destruct = destruct; +} + + +typedef enum { + ARES__LLIST_INSERT_HEAD, + ARES__LLIST_INSERT_TAIL, + ARES__LLIST_INSERT_BEFORE +} ares__llist_insert_type_t; + + +static ares__llist_node_t *ares__llist_insert_at(ares__llist_t *list, + ares__llist_insert_type_t type, + ares__llist_node_t *at, + void *val) +{ + ares__llist_node_t *node = NULL; + + if (list == NULL || val == NULL) + return NULL; + + node = ares_malloc(sizeof(*node)); + + if (node == NULL) + return NULL; + + memset(node, 0, sizeof(*node)); + node->data = val; + node->parent = list; + + if (type == ARES__LLIST_INSERT_BEFORE && (at == list->head || at == NULL)) { + type = ARES__LLIST_INSERT_HEAD; + } + + switch (type) { + case ARES__LLIST_INSERT_HEAD: + node->next = list->head; + node->prev = NULL; + if (list->head) + list->head->prev = node; + list->head = node; + break; + case ARES__LLIST_INSERT_TAIL: + node->next = NULL; + node->prev = list->tail; + if (list->tail) + list->tail->next = node; + list->tail = node; + break; + case ARES__LLIST_INSERT_BEFORE: + node->next = at; + node->prev = at->prev; + at->prev = node; + break; + } + if (list->tail == NULL) + list->tail = node; + if (list->head == NULL) + list->head = node; + + list->cnt++; + + return node; +} + + +ares__llist_node_t *ares__llist_insert_first(ares__llist_t *list, void *val) +{ + return ares__llist_insert_at(list, ARES__LLIST_INSERT_HEAD, NULL, val); +} + + +ares__llist_node_t *ares__llist_insert_last(ares__llist_t *list, void *val) +{ + return ares__llist_insert_at(list, ARES__LLIST_INSERT_TAIL, NULL, val); +} + + +ares__llist_node_t *ares__llist_insert_before(ares__llist_node_t *node, + void *val) +{ + if (node == NULL) + return NULL; + + return ares__llist_insert_at(node->parent, ARES__LLIST_INSERT_BEFORE, node, + val); +} + + +ares__llist_node_t *ares__llist_insert_after(ares__llist_node_t *node, + void *val) +{ + if (node == NULL) + return NULL; + + if (node->next == NULL) + return ares__llist_insert_last(node->parent, val); + + return ares__llist_insert_at(node->parent, ARES__LLIST_INSERT_BEFORE, + node->next, val); +} + + +ares__llist_node_t *ares__llist_node_first(ares__llist_t *list) +{ + if (list == NULL) + return NULL; + return list->head; +} + + +ares__llist_node_t *ares__llist_node_last(ares__llist_t *list) +{ + if (list == NULL) + return NULL; + return list->tail; +} + + +ares__llist_node_t *ares__llist_node_next(ares__llist_node_t *node) +{ + if (node == NULL) + return NULL; + return node->next; +} + + +ares__llist_node_t *ares__llist_node_prev(ares__llist_node_t *node) +{ + if (node == NULL) + return NULL; + return node->prev; +} + + +void *ares__llist_node_val(ares__llist_node_t *node) +{ + if (node == NULL) + return NULL; + + return node->data; +} + + +size_t ares__llist_len(ares__llist_t *list) +{ + if (list == NULL) + return 0; + return list->cnt; +} + + +ares__llist_t *ares__llist_node_parent(ares__llist_node_t *node) +{ + if (node == NULL) + return NULL; + return node->parent; +} + + +void *ares__llist_first_val(ares__llist_t *list) +{ + return ares__llist_node_val(ares__llist_node_first(list)); +} + + +void *ares__llist_last_val(ares__llist_t *list) +{ + return ares__llist_node_val(ares__llist_node_last(list)); +} + + +void *ares__llist_node_claim(ares__llist_node_t *node) +{ + void *val; + ares__llist_t *list; + + if (node == NULL) + return NULL; + + list = node->parent; + val = node->data; + + if (node->prev) { + node->prev->next = node->next; + } + + if (node->next) { + node->next->prev = node->prev; + } + + if (node == list->head) { + list->head = node->next; + } + + if (node == list->tail) { + list->tail = node->prev; + } + ares_free(node); + + list->cnt--; + + return val; +} + + +void ares__llist_node_destroy(ares__llist_node_t *node) +{ + ares__llist_destructor_t destruct; + void *val; + + if (node == NULL) + return; + + destruct = node->parent->destruct; + + val = ares__llist_node_claim(node); + if (val != NULL && destruct != NULL) + destruct(val); +} + + +void ares__llist_node_replace(ares__llist_node_t *node, void *val) +{ + ares__llist_destructor_t destruct; + + if (node == NULL) + return; + + destruct = node->parent->destruct; + if (destruct != NULL) + destruct(node->data); + + node->data = val; +} + + +void ares__llist_destroy(ares__llist_t *list) +{ + ares__llist_node_t *node; + + if (list == NULL) + return; + + while ((node = ares__llist_node_first(list)) != NULL) { + ares__llist_node_destroy(node); + } + ares_free(list); +} diff --git a/graal-nodejs/deps/cares/src/lib/ares__llist.h b/graal-nodejs/deps/cares/src/lib/ares__llist.h new file mode 100644 index 00000000000..950c7ac1d0c --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__llist.h @@ -0,0 +1,203 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#ifndef __ARES__LLIST_H +#define __ARES__LLIST_H + +/*! \addtogroup ares__llist LinkedList Data Structure + * + * This is a doubly-linked list data structure. + * + * Average time complexity: + * - Insert: O(1) -- head or tail + * - Search: O(n) + * - Delete: O(1) -- delete assumes you hold a node pointer + * + * @{ + */ + +struct ares__llist; + +/*! Opaque data structure for linked list */ +typedef struct ares__llist ares__llist_t; + +struct ares__llist_node; + +/*! Opaque data structure for a node in a linked list */ +typedef struct ares__llist_node ares__llist_node_t; + +/*! Callback to free user-defined node data + * + * \param[in] data user supplied data + */ +typedef void (*ares__llist_destructor_t)(void *data); + +/*! Create a linked list object + * + * \param[in] destruct Optional. Destructor to call on all removed nodes + * \return linked list object or NULL on out of memory + */ +ares__llist_t *ares__llist_create(ares__llist_destructor_t destruct); + +/*! Replace destructor for linked list nodes. Typically this is used + * when wanting to disable the destructor by using NULL. + * + * \param[in] list Initialized linked list object + * \param[in] destruct replacement destructor, NULL is allowed + */ +void ares__llist_replace_destructor(ares__llist_t *list, + ares__llist_destructor_t destruct); + +/*! Insert value as the first node in the linked list + * + * \param[in] list Initialized linked list object + * \param[in] val user-supplied value. + * \return node object referencing place in list, or null if out of memory or + * misuse + */ +ares__llist_node_t *ares__llist_insert_first(ares__llist_t *list, void *val); + +/*! Insert value as the last node in the linked list + * + * \param[in] list Initialized linked list object + * \param[in] val user-supplied value. + * \return node object referencing place in list, or null if out of memory or + * misuse + */ +ares__llist_node_t *ares__llist_insert_last(ares__llist_t *list, void *val); + +/*! Insert value before specified node in the linked list + * + * \param[in] node node referenced to insert before + * \param[in] val user-supplied value. + * \return node object referencing place in list, or null if out of memory or + * misuse + */ +ares__llist_node_t *ares__llist_insert_before(ares__llist_node_t *node, + void *val); + +/*! Insert value after specified node in the linked list + * + * \param[in] node node referenced to insert after + * \param[in] val user-supplied value. + * \return node object referencing place in list, or null if out of memory or + * misuse + */ +ares__llist_node_t *ares__llist_insert_after(ares__llist_node_t *node, + void *val); + +/*! Obtain first node in list + * + * \param[in] list Initialized list object + * \return first node in list or NULL if none + */ +ares__llist_node_t *ares__llist_node_first(ares__llist_t *list); + +/*! Obtain last node in list + * + * \param[in] list Initialized list object + * \return last node in list or NULL if none + */ +ares__llist_node_t *ares__llist_node_last(ares__llist_t *list); + +/*! Obtain next node in respect to specified node + * + * \param[in] node Node referenced + * \return node or NULL if none + */ +ares__llist_node_t *ares__llist_node_next(ares__llist_node_t *node); + +/*! Obtain previous node in respect to specified node + * + * \param[in] node Node referenced + * \return node or NULL if none + */ +ares__llist_node_t *ares__llist_node_prev(ares__llist_node_t *node); + +/*! Obtain value from node + * + * \param[in] node Node referenced + * \return user provided value from node + */ +void *ares__llist_node_val(ares__llist_node_t *node); + +/*! Obtain the number of entries in the list + * + * \param[in] list Initialized list object + * \return count + */ +size_t ares__llist_len(ares__llist_t *list); + +/*! Obtain list object from referenced node + * + * \param[in] node Node referenced + * \return list object node belongs to + */ +ares__llist_t *ares__llist_node_parent(ares__llist_node_t *node); + +/*! Obtain the first user-supplied value in the list + * + * \param[in] list Initialized list object + * \return first user supplied value or NULL if none + */ +void *ares__llist_first_val(ares__llist_t *list); + +/*! Obtain the last user-supplied value in the list + * + * \param[in] list Initialized list object + * \return last user supplied value or NULL if none + */ +void *ares__llist_last_val(ares__llist_t *list); + +/*! Take ownership of user-supplied value in list without calling destructor. + * Will unchain entry from list. + * + * \param[in] node Node referenced + * \return user supplied value + */ +void *ares__llist_node_claim(ares__llist_node_t *node); + +/*! Replace user-supplied value for node + * + * \param[in] node Node referenced + * \param[in] val new user-supplied value + */ +void ares__llist_node_replace(ares__llist_node_t *node, void *val); + +/*! Destroy the node, removing it from the list and calling destructor. + * + * \param[in] node Node referenced + */ +void ares__llist_node_destroy(ares__llist_node_t *node); + +/*! Destroy the list object and all nodes in the list. + * + * \param[in] list Initialized list object + */ +void ares__llist_destroy(ares__llist_t *list); + +/*! @} */ + +#endif /* __ARES__LLIST_H */ diff --git a/graal-nodejs/deps/cares/src/lib/ares__parse_into_addrinfo.c b/graal-nodejs/deps/cares/src/lib/ares__parse_into_addrinfo.c index 4393f04b961..73a17ea0ed6 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__parse_into_addrinfo.c +++ b/graal-nodejs/deps/cares/src/lib/ares__parse_into_addrinfo.c @@ -1,18 +1,28 @@ -/* Copyright (C) 2019 by Andrew Selivanov +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) 2019 Andrew Selivanov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ - #include "ares_setup.h" #ifdef HAVE_NETINET_IN_H diff --git a/graal-nodejs/deps/cares/src/lib/ares__read_line.c b/graal-nodejs/deps/cares/src/lib/ares__read_line.c index c62ad2a2b41..38beda6fb06 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__read_line.c +++ b/graal-nodejs/deps/cares/src/lib/ares__read_line.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares__readaddrinfo.c b/graal-nodejs/deps/cares/src/lib/ares__readaddrinfo.c index 2315df94111..fe999467828 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__readaddrinfo.c +++ b/graal-nodejs/deps/cares/src/lib/ares__readaddrinfo.c @@ -1,16 +1,27 @@ -/* Copyright (C) 2019 by Andrew Selivanov +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) 2019 Andrew Selivanov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -197,10 +208,6 @@ int ares__readaddrinfo(FILE *fp, } } - if (status != ARES_SUCCESS) - /* Ignore line if invalid address string for the requested family. */ - continue; - if (want_cname) { for (i = 0; i < alias_count; ++i) diff --git a/graal-nodejs/deps/cares/src/lib/ares__slist.c b/graal-nodejs/deps/cares/src/lib/ares__slist.c new file mode 100644 index 00000000000..9974bc045a3 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__slist.c @@ -0,0 +1,501 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#include "ares_setup.h" +#include "ares.h" +#include "ares_private.h" +#include "ares__slist.h" + +/* SkipList implementation */ + +#define ARES__SLIST_START_LEVELS 4 + + +struct ares__slist { + ares_rand_state *rand_state; + unsigned char rand_data[8]; + size_t rand_bits; + + ares__slist_node_t **head; + size_t levels; + ares__slist_node_t *tail; + + ares__slist_cmp_t cmp; + ares__slist_destructor_t destruct; + size_t cnt; +}; + + +struct ares__slist_node { + void *data; + ares__slist_node_t **prev; + ares__slist_node_t **next; + size_t levels; + ares__slist_t *parent; +}; + + +ares__slist_t *ares__slist_create(ares_rand_state *rand_state, + ares__slist_cmp_t cmp, + ares__slist_destructor_t destruct) +{ + ares__slist_t *list; + + if (rand_state == NULL || cmp == NULL) + return NULL; + + list = ares_malloc(sizeof(*list)); + + if (list == NULL) + return NULL; + + memset(list, 0, sizeof(*list)); + + list->rand_state = rand_state; + list->cmp = cmp; + list->destruct = destruct; + + list->levels = ARES__SLIST_START_LEVELS; + list->head = ares_malloc(sizeof(*list->head) * list->levels); + if (list->head == NULL) { + ares_free(list); + return NULL; + } + + memset(list->head, 0, sizeof(*list->head) * list->levels); + + return list; +} + + +static unsigned int ares__slist_coin_flip(ares__slist_t *list) +{ + size_t total_bits = sizeof(list->rand_data) * 8; + size_t bit; + + /* Refill random data used for coin flips. We pull this in 8 byte chunks. + * ares__rand_bytes() has some built-in caching of its own so we don't need + * to be excessive in caching ourselves. Prefer to require less memory per + * skiplist */ + if (list->rand_bits == 0) { + ares__rand_bytes(list->rand_state, list->rand_data, + sizeof(list->rand_data)); + list->rand_bits = total_bits; + } + + bit = total_bits - list->rand_bits; + list->rand_bits--; + + return (list->rand_data[bit / 8] & (1 << (bit % 8)))?1:0; +} + + +void ares__slist_replace_destructor(ares__slist_t *list, + ares__slist_destructor_t destruct) +{ + if (list == NULL) + return; + + list->destruct = destruct; +} + +/* Uses public domain code snipets from http://graphics.stanford.edu/~seander/bithacks.html */ + +static size_t ares__round_up_pow2(size_t n) +{ + n--; + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; + if (sizeof(size_t) > 4) + n |= n >> 32; + n++; + return n; +} + + +static size_t ares__log2(size_t n) +{ + static const unsigned char tab32[32] = { + 0, 1, 28, 2, 29, 14, 24, 3, + 30, 22, 20, 15, 25, 17, 4, 8, + 31, 27, 13, 23, 21, 19, 16, 7, + 26, 12, 18, 6, 11, 5, 10, 9 + }; + static const unsigned char tab64[64] = { + 63, 0, 58, 1, 59, 47, 53, 2, + 60, 39, 48, 27, 54, 33, 42, 3, + 61, 51, 37, 40, 49, 18, 28, 20, + 55, 30, 34, 11, 43, 14, 22, 4, + 62, 57, 46, 52, 38, 26, 32, 41, + 50, 36, 17, 19, 29, 10, 13, 21, + 56, 45, 25, 31, 35, 16, 9, 12, + 44, 24, 15, 8, 23, 7, 6, 5 + }; + + if (sizeof(size_t) == 4) + return tab32[(size_t)(n*0x077CB531) >> 27]; + + return tab64[((size_t)(n*0x07EDD5E59A4E28C2)) >> 58]; +} + + +static size_t ares__slist_max_level(ares__slist_t *list) +{ + size_t max_level = 0; + + if (list->cnt+1 <= (1 << ARES__SLIST_START_LEVELS)) { + max_level = ARES__SLIST_START_LEVELS; + } else { + max_level = ares__log2(ares__round_up_pow2(list->cnt+1)); + } + + if (list->levels > max_level) + max_level = list->levels; + + return max_level; +} + + +static size_t ares__slist_calc_level(ares__slist_t *list) +{ + size_t max_level = ares__slist_max_level(list); + size_t level; + + for (level=1; ares__slist_coin_flip(list) && level < max_level; level++) + ; + + return level; +} + + +ares__slist_node_t *ares__slist_insert(ares__slist_t *list, void *val) +{ + ares__slist_node_t *node = NULL; + ares__slist_node_t *left = NULL; + size_t i; + + if (list == NULL || val == NULL) + return NULL; + + node = ares_malloc(sizeof(*node)); + + if (node == NULL) + goto fail; + + memset(node, 0, sizeof(*node)); + node->data = val; + node->parent = list; + + /* Randomly determine the number of levels we want to use */ + node->levels = ares__slist_calc_level(list); + + /* Allocate array of next and prev nodes for linking each level */ + node->next = ares_malloc(sizeof(*node->next) * node->levels); + if (node->next == NULL) + goto fail; + + memset(node->next, 0, sizeof(*node->next) * node->levels); + + node->prev = ares_malloc(sizeof(*node->prev) * node->levels); + if (node->prev == NULL) + goto fail; + + memset(node->prev, 0, sizeof(*node->prev) * node->levels); + + /* If the number of levels is greater than we currently support in the slist, + * increase the count */ + if (list->levels < node->levels) { + size_t zero_len = sizeof(*list->head) * (node->levels - list->levels); + size_t offset = sizeof(*list->head) * list->levels; + void *ptr = ares_realloc(list->head, sizeof(*list->head) * node->levels); + if (ptr == NULL) + goto fail; + + memset((unsigned char *)ptr + offset, 0, zero_len); + list->head = ptr; + list->levels = node->levels; + } + + + /* Scan from highest level in the slist, even if we're not using that number + * of levels for this entry as this is what makes it O(log n) */ + for (i=list->levels; i-- > 0; ) { + /* set left if left is NULL and the current node value is greater than the + * head at this level */ + if (left == NULL && + list->head[i] != NULL && + list->cmp(node->data, list->head[i]->data) > 0 + ) { + left = list->head[i]; + } + + if (left != NULL) { + /* scan forward to find our insertion point */ + while (left->next[i] != NULL && + list->cmp(node->data, left->next[i]->data) > 0) { + left = left->next[i]; + } + } + + /* search only as we didn't randomly select this number of levels */ + if (i >= node->levels) + continue; + + if (left == NULL) { + /* head insertion */ + node->next[i] = list->head[i]; + node->prev[i] = NULL; + list->head[i] = node; + } else { + /* Chain */ + node->next[i] = left->next[i]; + node->prev[i] = left; + left->next[i] = node; + } + + if (node->next[i] != NULL) { + /* chain prev */ + node->next[i]->prev[i] = node; + } else { + if (i == 0) { + /* update tail */ + list->tail = node; + } + } + } + + list->cnt++; + + return node; + +fail: + if (node) { + ares_free(node->prev); + ares_free(node->next); + ares_free(node); + } + return NULL; +} + + +ares__slist_node_t *ares__slist_node_find(ares__slist_t *list, const void *val) +{ + size_t i; + ares__slist_node_t *node = NULL; + int rv = -1; + + if (list == NULL || val == NULL) + return NULL; + + /* Scan nodes starting at the highest level. For each level scan forward + * until the value is between the prior and next node, or if equal quit + * as we found a match */ + for (i=list->levels; i-- > 0; ) { + if (node == NULL) + node = list->head[i]; + + if (node == NULL) + continue; + + do { + rv = list->cmp(val, node->data); + + if (rv < 0) { + /* back off, our value is greater than current node reference */ + node = node->prev[i]; + } else if (rv > 0) { + /* move forward and try again. if it goes past, it will loop again and + * go to previous entry */ + node = node->next[i]; + } + + /* rv == 0 will terminate loop */ + + } while (node != NULL && rv > 0); + + /* Found a match, no need to continue */ + if (rv == 0) { + break; + } + } + + /* no match */ + if (rv != 0) { + return NULL; + } + + /* The list may have multiple entries that match. They're guaranteed to be + * in order, but we're not guaranteed to have selected the _first_ matching + * node. Lets scan backwards to find the first match */ + while (node->prev[0] != NULL && list->cmp(node->prev[0]->data, val) == 0) { + node = node->prev[0]; + } + + return node; +} + + +ares__slist_node_t *ares__slist_node_first(ares__slist_t *list) +{ + if (list == NULL) + return NULL; + + return list->head[0]; +} + + +ares__slist_node_t *ares__slist_node_last(ares__slist_t *list) +{ + if (list == NULL) + return NULL; + return list->tail; +} + + +ares__slist_node_t *ares__slist_node_next(ares__slist_node_t *node) +{ + if (node == NULL) + return NULL; + return node->next[0]; +} + + +ares__slist_node_t *ares__slist_node_prev(ares__slist_node_t *node) +{ + if (node == NULL) + return NULL; + return node->prev[0]; +} + + +void *ares__slist_node_val(ares__slist_node_t *node) +{ + if (node == NULL) + return NULL; + + return node->data; +} + + +size_t ares__slist_len(ares__slist_t *list) +{ + if (list == NULL) + return 0; + return list->cnt; +} + + +ares__slist_t *ares__slist_node_parent(ares__slist_node_t *node) +{ + if (node == NULL) + return NULL; + return node->parent; +} + + +void *ares__slist_first_val(ares__slist_t *list) +{ + return ares__slist_node_val(ares__slist_node_first(list)); +} + + +void *ares__slist_last_val(ares__slist_t *list) +{ + return ares__slist_node_val(ares__slist_node_last(list)); +} + + +void *ares__slist_node_claim(ares__slist_node_t *node) +{ + void *val; + ares__slist_t *list; + size_t i; + + if (node == NULL) + return NULL; + + list = node->parent; + val = node->data; + + /* relink each node at each level */ + for (i=node->levels; i-- > 0; ) { + if (node->next[i] == NULL) { + if (i == 0) { + list->tail = node->prev[0]; + } + } else { + node->next[i]->prev[i] = node->prev[i]; + } + + if (node->prev[i] == NULL) { + list->head[i] = node->next[i]; + } else { + node->prev[i]->next[i] = node->next[i]; + } + } + + ares_free(node->next); + ares_free(node->prev); + ares_free(node); + + list->cnt--; + + return val; +} + + +void ares__slist_node_destroy(ares__slist_node_t *node) +{ + ares__slist_destructor_t destruct; + void *val; + + if (node == NULL) + return; + + destruct = node->parent->destruct; + val = ares__slist_node_claim(node); + + if (val != NULL && destruct != NULL) + destruct(val); +} + + +void ares__slist_destroy(ares__slist_t *list) +{ + ares__slist_node_t *node; + + if (list == NULL) + return; + + while ((node = ares__slist_node_first(list)) != NULL) { + ares__slist_node_destroy(node); + } + + ares_free(list->head); + ares_free(list); +} diff --git a/graal-nodejs/deps/cares/src/lib/ares__slist.h b/graal-nodejs/deps/cares/src/lib/ares__slist.h new file mode 100644 index 00000000000..2cce2171647 --- /dev/null +++ b/graal-nodejs/deps/cares/src/lib/ares__slist.h @@ -0,0 +1,197 @@ +/* MIT License + * + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ +#ifndef __ARES__SLIST_H +#define __ARES__SLIST_H + + +/*! \addtogroup ares__slist SkipList Data Structure + * + * This data structure is known as a Skip List, which in essence is a sorted + * linked list with multiple levels of linkage to gain some algorithmic + * advantages. The usage symantecs are almost identical to what you'd expect + * with a linked list. + * + * Average time complexity: + * - Insert: O(log n) + * - Search: O(log n) + * - Delete: O(1) -- delete assumes you hold a node pointer + * + * It should be noted, however, that "effort" involved with an insert or + * remove operation is higher than a normal linked list. For very small + * lists this may be less efficient, but for any list with a moderate number + * of entries this will prove much more efficient. + * + * This data structure is often compared with a Binary Search Tree in + * functionality and usage. + * + * @{ + */ +struct ares__slist; + +/*! SkipList Object, opaque */ +typedef struct ares__slist ares__slist_t; + +struct ares__slist_node; + +/*! SkipList Node Object, opaque */ +typedef struct ares__slist_node ares__slist_node_t; + +/*! SkipList Node Value destructor callback + * + * \param[in] data User-defined data to destroy + */ +typedef void (*ares__slist_destructor_t)(void *data); + +/*! SkipList comparison function + * + * \param[in] data1 First user-defined data object + * \param[in] data2 Second user-defined data object + * \return < 0 if data1 < data1, > 0 if data1 > data2, 0 if data1 == data2 + */ +typedef int (*ares__slist_cmp_t)(const void *data1, const void *data2); + +/*! Create SkipList + * + * \param[in] rand_state Initialized ares random state. + * \param[in] cmp SkipList comparison function + * \param[in] destruct SkipList Node Value Destructor. Optional, use NULL. + * \return Initialized SkipList Object or NULL on misuse or ENOMEM + */ +ares__slist_t *ares__slist_create(ares_rand_state *rand_state, + ares__slist_cmp_t cmp, + ares__slist_destructor_t destruct); + +/*! Replace SkipList Node Value Destructor + * + * \param[in] list Initialized SkipList Object + * \param[in] destruct Replacement destructor. May be NULL. + */ +void ares__slist_replace_destructor(ares__slist_t *list, + ares__slist_destructor_t destruct); + +/*! Insert Value into SkipList + * + * \param[in] list Initialized SkipList Object + * \param[in] val Node Value. Must not be NULL. Function takes ownership + * and will have destructor called. + * \return SkipList Node Object or NULL on misuse or ENOMEM + */ +ares__slist_node_t *ares__slist_insert(ares__slist_t *list, void *val); + +/*! Fetch first node in SkipList + * + * \param[in] list Initialized SkipList Object + * \return SkipList Node Object or NULL if none + */ +ares__slist_node_t *ares__slist_node_first(ares__slist_t *list); + +/*! Fetch last node in SkipList + * + * \param[in] list Initialized SkipList Object + * \return SkipList Node Object or NULL if none + */ +ares__slist_node_t *ares__slist_node_last(ares__slist_t *list); + +/*! Fetch next node in SkipList + * + * \param[in] node SkipList Node Object + * \return SkipList Node Object or NULL if none + */ +ares__slist_node_t *ares__slist_node_next(ares__slist_node_t *node); + +/*! Fetch previous node in SkipList + * + * \param[in] node SkipList Node Object + * \return SkipList Node Object or NULL if none + */ +ares__slist_node_t *ares__slist_node_prev(ares__slist_node_t *node); + +/*! Fetch SkipList Node Object by Value + * + * \param[in] list Initialized SkipList Object + * \param[in] val Object to use for comparison + * \return SkipList Node Object or NULL if not found + */ +ares__slist_node_t *ares__slist_node_find(ares__slist_t *list, const void *val); + + +/*! Fetch Node Value + * + * \param[in] node SkipList Node Object + * \return user defined node value + */ +void *ares__slist_node_val(ares__slist_node_t *node); + +/*! Fetch number of entries in SkipList Object + * + * \param[in] list Initialized SkipList Object + * \return number of entries + */ +size_t ares__slist_len(ares__slist_t *list); + +/*! Fetch SkipList Object from SkipList Node + * + * \param[in] node SkipList Node Object + * \return SkipList Object + */ +ares__slist_t *ares__slist_node_parent(ares__slist_node_t *node); + +/*! Fetch first Node Value in SkipList + * + * \param[in] list Initialized SkipList Object + * \return user defined node value or NULL if none + */ +void *ares__slist_first_val(ares__slist_t *list); + +/*! Fetch last Node Value in SkipList + * + * \param[in] list Initialized SkipList Object + * \return user defined node value or NULL if none + */ +void *ares__slist_last_val(ares__slist_t *list); + +/*! Take back ownership of Node Value in SkipList, remove from SkipList. + * + * \param[in] node SkipList Node Object + * \return user defined node value + */ +void *ares__slist_node_claim(ares__slist_node_t *node); + +/*! Remove Node from SkipList, calling destructor for Node Value. + * + * \param[in] node SkipList Node Object + */ +void ares__slist_node_destroy(ares__slist_node_t *node); + +/*! Destroy SkipList Object. If there are any nodes, they will be destroyed. + * + * \param[in] list Initialized SkipList Object + */ +void ares__slist_destroy(ares__slist_t *list); + +/*! @} */ + +#endif /* __ARES__SLIST_H */ diff --git a/graal-nodejs/deps/cares/src/lib/ares__sortaddrinfo.c b/graal-nodejs/deps/cares/src/lib/ares__sortaddrinfo.c index 3f050cad00f..78d8891614a 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__sortaddrinfo.c +++ b/graal-nodejs/deps/cares/src/lib/ares__sortaddrinfo.c @@ -6,7 +6,7 @@ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * Copyright (C) 2018 The Android Open Source Project - * Copyright (C) 2019 by Andrew Selivanov + * Copyright (C) 2019 Andrew Selivanov * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +32,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * SPDX-License-Identifier: BSD-3-Clause */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares__timeval.c b/graal-nodejs/deps/cares/src/lib/ares__timeval.c index 94efb7db1e9..5716c53e502 100644 --- a/graal-nodejs/deps/cares/src/lib/ares__timeval.c +++ b/graal-nodejs/deps/cares/src/lib/ares__timeval.c @@ -1,15 +1,27 @@ - -/* Copyright (C) 2008 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 2008 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_android.c b/graal-nodejs/deps/cares/src/lib/ares_android.c index 5b00b8065c5..ec0a33872d6 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_android.c +++ b/graal-nodejs/deps/cares/src/lib/ares_android.c @@ -1,16 +1,27 @@ -/* Copyright (C) 2017 by John Schember +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) John Schember + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #if defined(ANDROID) || defined(__ANDROID__) diff --git a/graal-nodejs/deps/cares/src/lib/ares_android.h b/graal-nodejs/deps/cares/src/lib/ares_android.h index 93fb75f5850..73b8d8ee83c 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_android.h +++ b/graal-nodejs/deps/cares/src/lib/ares_android.h @@ -1,16 +1,27 @@ -/* Copyright (C) 2017 by John Schember +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) John Schember + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #ifndef __ARES_ANDROID_H__ diff --git a/graal-nodejs/deps/cares/src/lib/ares_cancel.c b/graal-nodejs/deps/cares/src/lib/ares_cancel.c index 465cc9e95ee..353624a1116 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_cancel.c +++ b/graal-nodejs/deps/cares/src/lib/ares_cancel.c @@ -1,15 +1,27 @@ - -/* Copyright (C) 2004 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 2004 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -25,39 +37,51 @@ */ void ares_cancel(ares_channel channel) { - struct query *query; - struct list_node list_head_copy; - struct list_node* list_head; - struct list_node* list_node; - int i; - - if (!ares__is_list_empty(&(channel->all_queries))) + if (ares__llist_len(channel->all_queries) > 0) { + ares__llist_node_t *node = NULL; + ares__llist_node_t *next = NULL; + /* Swap list heads, so that only those queries which were present on entry * into this function are cancelled. New queries added by callbacks of * queries being cancelled will not be cancelled themselves. */ - list_head = &(channel->all_queries); - list_head_copy.prev = list_head->prev; - list_head_copy.next = list_head->next; - list_head_copy.prev->next = &list_head_copy; - list_head_copy.next->prev = &list_head_copy; - list_head->prev = list_head; - list_head->next = list_head; - for (list_node = list_head_copy.next; list_node != &list_head_copy; ) - { - query = list_node->data; - list_node = list_node->next; /* since we're deleting the query */ + ares__llist_t *list_copy = channel->all_queries; + channel->all_queries = ares__llist_create(NULL); + + /* Out of memory, this function doesn't return a result code though so we + * can't report to caller */ + if (channel->all_queries == NULL) { + channel->all_queries = list_copy; + return; + } + + node = ares__llist_node_first(list_copy); + while (node != NULL) { + struct query *query; + ares_socket_t fd = ARES_SOCKET_BAD; + + /* Cache next since this node is being deleted */ + next = ares__llist_node_next(node); + + query = ares__llist_node_claim(node); + query->node_all_queries = NULL; + + /* Cache file descriptor for connection so we can clean it up possibly */ + if (query->conn) + fd = query->conn->fd; + + /* NOTE: its possible this may enqueue new queries */ query->callback(query->arg, ARES_ECANCELLED, 0, NULL, 0); ares__free_query(query); + + /* See if the connection should be cleaned up */ + if (fd != ARES_SOCKET_BAD) + ares__check_cleanup_conn(channel, fd); + + node = next; } - } - if (!(channel->flags & ARES_FLAG_STAYOPEN) && ares__is_list_empty(&(channel->all_queries))) - { - if (channel->servers) - { - for (i = 0; i < channel->nservers; i++) - ares__close_sockets(channel, &channel->servers[i]); - } + + ares__llist_destroy(list_copy); } } diff --git a/graal-nodejs/deps/cares/src/lib/ares_config.h.cmake b/graal-nodejs/deps/cares/src/lib/ares_config.h.cmake index 798820a3a68..a33eb9caa6a 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_config.h.cmake +++ b/graal-nodejs/deps/cares/src/lib/ares_config.h.cmake @@ -1,3 +1,7 @@ +/* Copyright (C) The c-ares project and its contributors + * SPDX-License-Identifier: MIT + */ + /* Generated from ares_config.h.cmake */ /* Define if building universal (internal helper macro) */ @@ -123,6 +127,9 @@ /* Define to 1 if you have the getnameinfo function. */ #cmakedefine HAVE_GETNAMEINFO +/* Define to 1 if you have the getrandom function. */ +#cmakedefine HAVE_GETRANDOM + /* Define to 1 if you have the getservbyport_r function. */ #cmakedefine HAVE_GETSERVBYPORT_R diff --git a/graal-nodejs/deps/cares/src/lib/ares_config.h.in b/graal-nodejs/deps/cares/src/lib/ares_config.h.in index 3f6954a74db..2e4a60e627c 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_config.h.in +++ b/graal-nodejs/deps/cares/src/lib/ares_config.h.in @@ -129,6 +129,9 @@ /* Define to 1 if you have the getnameinfo function. */ #undef HAVE_GETNAMEINFO +/* Define to 1 if you have the getrandom function. */ +#undef HAVE_GETRANDOM + /* Define to 1 if you have the getservbyport_r function. */ #undef HAVE_GETSERVBYPORT_R @@ -304,6 +307,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_RANDOM_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_SELECT_H diff --git a/graal-nodejs/deps/cares/src/lib/ares_create_query.c b/graal-nodejs/deps/cares/src/lib/ares_create_query.c index e3d874b4509..21c6be08bdd 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_create_query.c +++ b/graal-nodejs/deps/cares/src/lib/ares_create_query.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_data.c b/graal-nodejs/deps/cares/src/lib/ares_data.c index 69dff06689a..9e22339327b 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_data.c +++ b/graal-nodejs/deps/cares/src/lib/ares_data.c @@ -1,17 +1,27 @@ - -/* Copyright (C) 2009-2013 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 2009 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ diff --git a/graal-nodejs/deps/cares/src/lib/ares_data.h b/graal-nodejs/deps/cares/src/lib/ares_data.h index a682ad54cb9..6965cf2a73d 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_data.h +++ b/graal-nodejs/deps/cares/src/lib/ares_data.h @@ -1,21 +1,30 @@ -#ifndef __ARES_DATA_H -#define __ARES_DATA_H - - -/* Copyright (C) 2009-2013 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 2009 Daniel Stenberg * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef __ARES_DATA_H +#define __ARES_DATA_H typedef enum { ARES_DATATYPE_UNKNOWN = 1, /* unknown data type - introduced in 1.7.0 */ diff --git a/graal-nodejs/deps/cares/src/lib/ares_destroy.c b/graal-nodejs/deps/cares/src/lib/ares_destroy.c index 62c899f82e0..560082fd0cc 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_destroy.c +++ b/graal-nodejs/deps/cares/src/lib/ares_destroy.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2011 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2004 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -44,45 +54,52 @@ void ares_destroy_options(struct ares_options *options) void ares_destroy(ares_channel channel) { - int i; - struct query *query; - struct list_node* list_head; - struct list_node* list_node; + int i; + ares__llist_node_t *node = NULL; if (!channel) return; - list_head = &(channel->all_queries); - for (list_node = list_head->next; list_node != list_head; ) - { - query = list_node->data; - list_node = list_node->next; /* since we're deleting the query */ - query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0); - ares__free_query(query); - } + /* Destroy all queries */ + node = ares__llist_node_first(channel->all_queries); + while (node != NULL) { + ares__llist_node_t *next = ares__llist_node_next(node); + struct query *query = ares__llist_node_claim(node); + + query->node_all_queries = NULL; + query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0); + ares__free_query(query); + + node = next; + } + + #ifndef NDEBUG /* Freeing the query should remove it from all the lists in which it sits, * so all query lists should be empty now. */ - assert(ares__is_list_empty(&(channel->all_queries))); - for (i = 0; i < ARES_QID_TABLE_SIZE; i++) - { - assert(ares__is_list_empty(&(channel->queries_by_qid[i]))); - } - for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) - { - assert(ares__is_list_empty(&(channel->queries_by_timeout[i]))); - } + assert(ares__llist_len(channel->all_queries) == 0); + assert(ares__htable_stvp_num_keys(channel->queries_by_qid) == 0); + assert(ares__slist_len(channel->queries_by_timeout) == 0); #endif ares__destroy_servers_state(channel); +#ifndef NDEBUG + assert(ares__htable_asvp_num_keys(channel->connnode_by_socket) == 0); +#endif + if (channel->domains) { for (i = 0; i < channel->ndomains; i++) ares_free(channel->domains[i]); ares_free(channel->domains); } + ares__llist_destroy(channel->all_queries); + ares__slist_destroy(channel->queries_by_timeout); + ares__htable_stvp_destroy(channel->queries_by_qid); + ares__htable_asvp_destroy(channel->connnode_by_socket); + if(channel->sortlist) ares_free(channel->sortlist); @@ -111,8 +128,10 @@ void ares__destroy_servers_state(ares_channel channel) for (i = 0; i < channel->nservers; i++) { server = &channel->servers[i]; - ares__close_sockets(channel, server); - assert(ares__is_list_empty(&server->queries_to_server)); + ares__close_sockets(server); + ares__llist_destroy(server->connections); + ares__buf_destroy(server->tcp_parser); + ares__buf_destroy(server->tcp_send); } ares_free(channel->servers); channel->servers = NULL; diff --git a/graal-nodejs/deps/cares/src/lib/ares_expand_name.c b/graal-nodejs/deps/cares/src/lib/ares_expand_name.c index ad1c97f9377..21c4e93d85b 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_expand_name.c +++ b/graal-nodejs/deps/cares/src/lib/ares_expand_name.c @@ -1,17 +1,28 @@ - -/* Copyright 1998, 2011 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998, 2011 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_expand_string.c b/graal-nodejs/deps/cares/src/lib/ares_expand_string.c index 03e39299752..2d6daa14975 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_expand_string.c +++ b/graal-nodejs/deps/cares/src/lib/ares_expand_string.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_fds.c b/graal-nodejs/deps/cares/src/lib/ares_fds.c index f405fc047c7..5ee149f9046 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_fds.c +++ b/graal-nodejs/deps/cares/src/lib/ares_fds.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -27,33 +38,32 @@ int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds) int i; /* Are there any active queries? */ - int active_queries = !ares__is_list_empty(&(channel->all_queries)); + size_t active_queries = ares__llist_len(channel->all_queries); nfds = 0; - for (i = 0; i < channel->nservers; i++) - { - server = &channel->servers[i]; + for (i = 0; i < channel->nservers; i++) { + ares__llist_node_t *node; + server = &channel->servers[i]; + + for (node = ares__llist_node_first(server->connections); + node != NULL; + node = ares__llist_node_next(node)) { + struct server_connection *conn = ares__llist_node_val(node); + /* We only need to register interest in UDP sockets if we have * outstanding queries. */ - if (active_queries && server->udp_socket != ARES_SOCKET_BAD) - { - FD_SET(server->udp_socket, read_fds); - if (server->udp_socket >= nfds) - nfds = server->udp_socket + 1; - } - /* We always register for TCP events, because we want to know - * when the other side closes the connection, so we don't waste - * time trying to use a broken connection. - */ - if (server->tcp_socket != ARES_SOCKET_BAD) - { - FD_SET(server->tcp_socket, read_fds); - if (server->qhead) - FD_SET(server->tcp_socket, write_fds); - if (server->tcp_socket >= nfds) - nfds = server->tcp_socket + 1; - } + if (active_queries || conn->is_tcp) { + FD_SET(conn->fd, read_fds); + if (conn->fd >= nfds) + nfds = conn->fd + 1; + } + + if (conn->is_tcp && ares__buf_len(server->tcp_send)) { + FD_SET(conn->fd, write_fds); + } } + } + return (int)nfds; } diff --git a/graal-nodejs/deps/cares/src/lib/ares_free_hostent.c b/graal-nodejs/deps/cares/src/lib/ares_free_hostent.c index ea28ff0e2c1..0d20673163a 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_free_hostent.c +++ b/graal-nodejs/deps/cares/src/lib/ares_free_hostent.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_free_string.c b/graal-nodejs/deps/cares/src/lib/ares_free_string.c index 024992e1c20..39773067bd2 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_free_string.c +++ b/graal-nodejs/deps/cares/src/lib/ares_free_string.c @@ -1,17 +1,28 @@ - -/* Copyright 2000 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 2000 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_freeaddrinfo.c b/graal-nodejs/deps/cares/src/lib/ares_freeaddrinfo.c index ab871363d51..fe458735ee5 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_freeaddrinfo.c +++ b/graal-nodejs/deps/cares/src/lib/ares_freeaddrinfo.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2019 by Andrew Selivanov +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2019 Andrew Selivanov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_getaddrinfo.c b/graal-nodejs/deps/cares/src/lib/ares_getaddrinfo.c index cb494242f28..a3a2add1a2f 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_getaddrinfo.c +++ b/graal-nodejs/deps/cares/src/lib/ares_getaddrinfo.c @@ -1,19 +1,29 @@ - -/* Copyright 1998, 2011, 2013 by the Massachusetts Institute of Technology. - * Copyright (C) 2017 - 2018 by Christian Ammer - * Copyright (C) 2019 by Andrew Selivanov +/* MIT License + * + * Copyright (c) 1998, 2011, 2013 Massachusetts Institute of Technology + * Copyright (c) 2017 Christian Ammer + * Copyright (c) 2019 Andrew Selivanov + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -49,6 +59,7 @@ #include "ares.h" #include "bitncmp.h" #include "ares_private.h" +#include "ares_dns.h" #ifdef WATT32 #undef WIN32 @@ -70,9 +81,12 @@ struct host_query const char *remaining_lookups; /* types of lookup we need to perform ("fb" by default, file and dns respectively) */ struct ares_addrinfo *ai; /* store results between lookups */ + unsigned short qid_a; /* qid for A request */ + unsigned short qid_aaaa; /* qid for AAAA request */ int remaining; /* number of DNS answers waiting for */ int next_domain; /* next search domain to try */ int nodata_cnt; /* Track nodata responses to possibly override final result */ + }; static const struct ares_addrinfo_hints default_hints = { @@ -113,7 +127,7 @@ static int as_is_first(const struct host_query *hquery); static int as_is_only(const struct host_query* hquery); static int next_dns_lookup(struct host_query *hquery); -struct ares_addrinfo_cname *ares__malloc_addrinfo_cname() +static struct ares_addrinfo_cname *ares__malloc_addrinfo_cname(void) { struct ares_addrinfo_cname *cname = ares_malloc(sizeof(struct ares_addrinfo_cname)); if (!cname) @@ -160,7 +174,7 @@ void ares__addrinfo_cat_cnames(struct ares_addrinfo_cname **head, last->next = tail; } -struct ares_addrinfo *ares__malloc_addrinfo() +static struct ares_addrinfo *ares__malloc_addrinfo(void) { struct ares_addrinfo *ai = ares_malloc(sizeof(struct ares_addrinfo)); if (!ai) @@ -170,10 +184,10 @@ struct ares_addrinfo *ares__malloc_addrinfo() return ai; } -struct ares_addrinfo_node *ares__malloc_addrinfo_node() +static struct ares_addrinfo_node *ares__malloc_addrinfo_node(void) { struct ares_addrinfo_node *node = - ares_malloc(sizeof(struct ares_addrinfo_node)); + ares_malloc(sizeof(*node)); if (!node) return NULL; @@ -375,6 +389,7 @@ static void end_hquery(struct host_query *hquery, int status) { struct ares_addrinfo_node sentinel; struct ares_addrinfo_node *next; + if (status == ARES_SUCCESS) { if (!(hquery->hints.ai_flags & ARES_AI_NOSORT) && hquery->ai->nodes) @@ -563,59 +578,68 @@ static void next_lookup(struct host_query *hquery, int status) } } + +static void terminate_retries(struct host_query *hquery, unsigned short qid) +{ + unsigned short term_qid = (qid == hquery->qid_a)?hquery->qid_aaaa:hquery->qid_a; + ares_channel channel = hquery->channel; + struct query *query = NULL; + + /* No other outstanding queries, nothing to do */ + if (!hquery->remaining) + return; + + query = ares__htable_stvp_get_direct(channel->queries_by_qid, term_qid); + if (query == NULL) + return; + + query->no_retries = 1; +} + + static void host_callback(void *arg, int status, int timeouts, unsigned char *abuf, int alen) { struct host_query *hquery = (struct host_query*)arg; int addinfostatus = ARES_SUCCESS; + unsigned short qid = 0; hquery->timeouts += timeouts; hquery->remaining--; - if (status == ARES_SUCCESS) - { - addinfostatus = ares__parse_into_addrinfo(abuf, alen, 1, hquery->port, hquery->ai); + if (status == ARES_SUCCESS) { + addinfostatus = ares__parse_into_addrinfo(abuf, alen, 1, hquery->port, + hquery->ai); + if (addinfostatus == ARES_SUCCESS && alen >= HFIXEDSZ) { + qid = DNS_HEADER_QID(abuf); /* Converts to host byte order */ + terminate_retries(hquery, qid); } + } - if (!hquery->remaining) - { - if (addinfostatus != ARES_SUCCESS && addinfostatus != ARES_ENODATA) - { - /* error in parsing result e.g. no memory */ - if (addinfostatus == ARES_EBADRESP && hquery->ai->nodes) - { - /* We got a bad response from server, but at least one query - * ended with ARES_SUCCESS */ - end_hquery(hquery, ARES_SUCCESS); - } - else - { - end_hquery(hquery, addinfostatus); - } - } - else if (hquery->ai->nodes) - { - /* at least one query ended with ARES_SUCCESS */ - end_hquery(hquery, ARES_SUCCESS); - } - else if (status == ARES_ENOTFOUND || status == ARES_ENODATA || - addinfostatus == ARES_ENODATA) - { - if (status == ARES_ENODATA || addinfostatus == ARES_ENODATA) - hquery->nodata_cnt++; - next_lookup(hquery, hquery->nodata_cnt?ARES_ENODATA:status); - } - else if (status == ARES_EDESTRUCTION) - { - /* NOTE: Could also be ARES_EDESTRUCTION. We need to only call this - * once all queries (there can be multiple for getaddrinfo) are - * terminated. */ - end_hquery(hquery, status); - } - else - { - end_hquery(hquery, status); - } + if (!hquery->remaining) { + if (addinfostatus != ARES_SUCCESS && addinfostatus != ARES_ENODATA) { + /* error in parsing result e.g. no memory */ + if (addinfostatus == ARES_EBADRESP && hquery->ai->nodes) { + /* We got a bad response from server, but at least one query + * ended with ARES_SUCCESS */ + end_hquery(hquery, ARES_SUCCESS); + } else { + end_hquery(hquery, addinfostatus); + } + } else if (hquery->ai->nodes) { + /* at least one query ended with ARES_SUCCESS */ + end_hquery(hquery, ARES_SUCCESS); + } else if (status == ARES_EDESTRUCTION || status == ARES_ECANCELLED) { + /* must make sure we don't do next_lookup() on destroy or cancel */ + end_hquery(hquery, status); + } else if (status == ARES_ENOTFOUND || status == ARES_ENODATA || + addinfostatus == ARES_ENODATA) { + if (status == ARES_ENODATA || addinfostatus == ARES_ENODATA) + hquery->nodata_cnt++; + next_lookup(hquery, hquery->nodata_cnt?ARES_ENODATA:status); + } else { + end_hquery(hquery, status); } + } /* at this point we keep on waiting for the next query to finish */ } @@ -715,7 +739,7 @@ void ares_getaddrinfo(ares_channel channel, } /* Allocate and fill in the host query structure. */ - hquery = ares_malloc(sizeof(struct host_query)); + hquery = ares_malloc(sizeof(*hquery)); if (!hquery) { ares_free(alias_name); @@ -723,7 +747,7 @@ void ares_getaddrinfo(ares_channel channel, callback(arg, ARES_ENOMEM, 0, NULL); return; } - + memset(hquery, 0, sizeof(*hquery)); hquery->name = ares_strdup(name); ares_free(alias_name); if (!hquery->name) @@ -741,11 +765,8 @@ void ares_getaddrinfo(ares_channel channel, hquery->callback = callback; hquery->arg = arg; hquery->remaining_lookups = channel->lookups; - hquery->timeouts = 0; hquery->ai = ai; hquery->next_domain = -1; - hquery->remaining = 0; - hquery->nodata_cnt = 0; /* Start performing lookups according to channel->lookups. */ next_lookup(hquery, ARES_ECONNREFUSED /* initial error code */); @@ -790,20 +811,26 @@ static int next_dns_lookup(struct host_query *hquery) if (s) { + /* NOTE: hquery may be invalidated during the call to ares_query_qid(), + * so should not be referenced after this point */ switch (hquery->hints.ai_family) { case AF_INET: hquery->remaining += 1; - ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery); + ares_query_qid(hquery->channel, s, C_IN, T_A, host_callback, hquery, + &hquery->qid_a); break; case AF_INET6: hquery->remaining += 1; - ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery); + ares_query_qid(hquery->channel, s, C_IN, T_AAAA, host_callback, + hquery, &hquery->qid_aaaa); break; case AF_UNSPEC: hquery->remaining += 2; - ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery); - ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery); + ares_query_qid(hquery->channel, s, C_IN, T_A, host_callback, + hquery, &hquery->qid_a); + ares_query_qid(hquery->channel, s, C_IN, T_AAAA, host_callback, + hquery, &hquery->qid_aaaa); break; default: break; } @@ -825,7 +852,7 @@ static int as_is_first(const struct host_query* hquery) char* p; int ndots = 0; size_t nname = hquery->name?strlen(hquery->name):0; - for (p = hquery->name; *p; p++) + for (p = hquery->name; p && *p; p++) { if (*p == '.') { diff --git a/graal-nodejs/deps/cares/src/lib/ares_getenv.c b/graal-nodejs/deps/cares/src/lib/ares_getenv.c index f6e4dc29526..08601a61e54 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_getenv.c +++ b/graal-nodejs/deps/cares/src/lib/ares_getenv.c @@ -1,18 +1,28 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_getenv.h b/graal-nodejs/deps/cares/src/lib/ares_getenv.h index 6da6cc5081a..d8bd3a2195b 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_getenv.h +++ b/graal-nodejs/deps/cares/src/lib/ares_getenv.h @@ -1,21 +1,31 @@ -#ifndef HEADER_CARES_GETENV_H -#define HEADER_CARES_GETENV_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_GETENV_H +#define HEADER_CARES_GETENV_H #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_gethostbyaddr.c b/graal-nodejs/deps/cares/src/lib/ares_gethostbyaddr.c index c62d230d96e..628813057b5 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_gethostbyaddr.c +++ b/graal-nodejs/deps/cares/src/lib/ares_gethostbyaddr.c @@ -1,18 +1,30 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ + #include "ares_setup.h" #ifdef HAVE_NETINET_IN_H @@ -53,7 +65,7 @@ static void addr_callback(void *arg, int status, int timeouts, static void end_aquery(struct addr_query *aquery, int status, struct hostent *host); static int file_lookup(struct ares_addr *addr, struct hostent **host); -static void ptr_rr_name(char *name, const struct ares_addr *addr); +static void ptr_rr_name(char *name, int name_size, const struct ares_addr *addr); void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, int family, ares_host_callback callback, void *arg) @@ -105,7 +117,7 @@ static void next_lookup(struct addr_query *aquery) switch (*p) { case 'b': - ptr_rr_name(name, &aquery->addr); + ptr_rr_name(name, sizeof(name), &aquery->addr); aquery->remaining_lookups = p + 1; ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback, aquery); @@ -255,7 +267,7 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host) return status; } -static void ptr_rr_name(char *name, const struct ares_addr *addr) +static void ptr_rr_name(char *name, int name_size, const struct ares_addr *addr) { if (addr->family == AF_INET) { @@ -264,20 +276,20 @@ static void ptr_rr_name(char *name, const struct ares_addr *addr) unsigned long a2 = (laddr >> 16UL) & 0xFFUL; unsigned long a3 = (laddr >> 8UL) & 0xFFUL; unsigned long a4 = laddr & 0xFFUL; - sprintf(name, "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1); + snprintf(name, name_size, "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1); } else { unsigned char *bytes = (unsigned char *)&addr->addrV6; /* There are too many arguments to do this in one line using * minimally C89-compliant compilers */ - sprintf(name, + snprintf(name, name_size, "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.", bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4, bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4, bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4, bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4); - sprintf(name+strlen(name), + snprintf(name+strlen(name), name_size-strlen(name), "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa", bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4, bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4, diff --git a/graal-nodejs/deps/cares/src/lib/ares_gethostbyname.c b/graal-nodejs/deps/cares/src/lib/ares_gethostbyname.c index 8c71cc67f3c..343bd7b7332 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_gethostbyname.c +++ b/graal-nodejs/deps/cares/src/lib/ares_gethostbyname.c @@ -1,16 +1,28 @@ -/* Copyright 1998, 2011, 2013 by the Massachusetts Institute of Technology. +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) 1998, 2011, 2013 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_getnameinfo.c b/graal-nodejs/deps/cares/src/lib/ares_getnameinfo.c index 966919ac232..0d97a318bfd 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_getnameinfo.c +++ b/graal-nodejs/deps/cares/src/lib/ares_getnameinfo.c @@ -1,17 +1,27 @@ - -/* Copyright 2005 by Dominick Meglio +/* MIT License + * + * Copyright (c) 2005, 2013 Dominick Meglio + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -327,7 +337,7 @@ static char *lookup_service(unsigned short port, int flags, else { /* get port as a string */ - sprintf(tmpbuf, "%u", (unsigned int)ntohs(port)); + snprintf(tmpbuf, sizeof(tmpbuf), "%u", (unsigned int)ntohs(port)); name = tmpbuf; } name_len = strlen(name); @@ -364,11 +374,11 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, { if (is_scope_long) { - sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); + snprintf(&tmpbuf[1], sizeof(tmpbuf)-1, "%lu", (unsigned long)addr6->sin6_scope_id); } else { - sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); + snprintf(&tmpbuf[1], sizeof(tmpbuf)-1, "%u", (unsigned int)addr6->sin6_scope_id); } } else @@ -377,22 +387,22 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, { if (is_scope_long) { - sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); + snprintf(&tmpbuf[1], sizeof(tmpbuf)-1, "%lu", (unsigned long)addr6->sin6_scope_id); } else { - sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); + snprintf(&tmpbuf[1], sizeof(tmpbuf)-1, "%u", (unsigned int)addr6->sin6_scope_id); } } } #else if (is_scope_long) { - sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); + snprintf(&tmpbuf[1], sizeof(tmpbuf)-1, "%lu", (unsigned long)addr6->sin6_scope_id); } else { - sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); + snprintf(&tmpbuf[1], sizeof(tmpbuf)-1, "%u", (unsigned int)addr6->sin6_scope_id); } (void) flags; #endif diff --git a/graal-nodejs/deps/cares/src/lib/ares_getsock.c b/graal-nodejs/deps/cares/src/lib/ares_getsock.c index 22d344679fa..48c9076a668 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_getsock.c +++ b/graal-nodejs/deps/cares/src/lib/ares_getsock.c @@ -1,15 +1,27 @@ - -/* Copyright (C) 2005 - 2010, Daniel Stenberg +/* MIT License + * + * Copyright (c) 2005 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -28,39 +40,40 @@ int ares_getsock(ares_channel channel, unsigned int setbits = 0xffffffff; /* Are there any active queries? */ - int active_queries = !ares__is_list_empty(&(channel->all_queries)); + size_t active_queries = ares__llist_len(channel->all_queries); + + for (i = 0; i < channel->nservers; i++) { + ares__llist_node_t *node; + server = &channel->servers[i]; + + for (node = ares__llist_node_first(server->connections); + node != NULL; + node = ares__llist_node_next(node)) { + + struct server_connection *conn = ares__llist_node_val(node); + + if (sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM) + break; - for (i = 0; i < channel->nservers; i++) - { - server = &channel->servers[i]; /* We only need to register interest in UDP sockets if we have * outstanding queries. */ - if (active_queries && server->udp_socket != ARES_SOCKET_BAD) - { - if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM) - break; - socks[sockindex] = server->udp_socket; - bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); - sockindex++; - } - /* We always register for TCP events, because we want to know - * when the other side closes the connection, so we don't waste - * time trying to use a broken connection. - */ - if (server->tcp_socket != ARES_SOCKET_BAD) - { - if(sockindex >= numsocks || sockindex >= ARES_GETSOCK_MAXNUM) - break; - socks[sockindex] = server->tcp_socket; - bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); + if (!active_queries && !conn->is_tcp) + continue; + + socks[sockindex] = conn->fd; + + if (active_queries || conn->is_tcp) { + bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex); + } - if (server->qhead && active_queries) - /* then the tcp socket is also writable! */ - bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex); + if (conn->is_tcp && ares__buf_len(server->tcp_send)) { + /* then the tcp socket is also writable! */ + bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex); + } - sockindex++; - } + sockindex++; } + } return bitmap; } diff --git a/graal-nodejs/deps/cares/src/lib/ares_inet_net_pton.h b/graal-nodejs/deps/cares/src/lib/ares_inet_net_pton.h index 90da2cc6514..179d36d972e 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_inet_net_pton.h +++ b/graal-nodejs/deps/cares/src/lib/ares_inet_net_pton.h @@ -1,20 +1,30 @@ -#ifndef HEADER_CARES_INET_NET_PTON_H -#define HEADER_CARES_INET_NET_PTON_H - -/* Copyright (C) 2005-2013 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 2005 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_INET_NET_PTON_H +#define HEADER_CARES_INET_NET_PTON_H #ifdef HAVE_INET_NET_PTON #define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z) diff --git a/graal-nodejs/deps/cares/src/lib/ares_init.c b/graal-nodejs/deps/cares/src/lib/ares_init.c index 0519f43e561..4a671e6ae4e 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_init.c +++ b/graal-nodejs/deps/cares/src/lib/ares_init.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2007-2013 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2007 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -71,7 +81,7 @@ static int init_by_defaults(ares_channel channel); #ifndef WATT32 static int config_nameserver(struct server_state **servers, int *nservers, - char *str); + const char *str); #endif static int set_search(ares_channel channel, const char *str); static int set_options(ares_channel channel, const char *str); @@ -103,24 +113,40 @@ int ares_init(ares_channel *channelptr) return ares_init_options(channelptr, NULL, 0); } +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) + return 1; + if (q1->timeout.tv_sec < q2->timeout.tv_sec) + return -1; + + if (q1->timeout.tv_usec > q2->timeout.tv_usec) + return 1; + if (q1->timeout.tv_usec < q2->timeout.tv_usec) + return -1; + + return 0; +} + int ares_init_options(ares_channel *channelptr, struct ares_options *options, int optmask) { ares_channel channel; - int i; int status = ARES_SUCCESS; - struct timeval now; if (ares_library_initialized() != ARES_SUCCESS) return ARES_ENOTINITIALIZED; /* LCOV_EXCL_LINE: n/a on non-WinSock */ - channel = ares_malloc(sizeof(struct ares_channeldata)); + channel = ares_malloc(sizeof(*channel)); if (!channel) { *channelptr = NULL; return ARES_ENOMEM; } - now = ares__tvnow(); + memset(channel, 0, sizeof(*channel)); /* Set everything to distinguished values so we know they haven't * been set yet. @@ -138,40 +164,43 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, channel->nservers = -1; channel->ndomains = -1; channel->nsort = -1; - channel->tcp_connection_generation = 0; - channel->lookups = NULL; - channel->domains = NULL; - channel->sortlist = NULL; - channel->servers = NULL; - channel->sock_state_cb = NULL; - channel->sock_state_cb_data = NULL; - channel->sock_create_cb = NULL; - channel->sock_create_cb_data = NULL; - channel->sock_config_cb = NULL; - channel->sock_config_cb_data = NULL; - channel->sock_funcs = NULL; - channel->sock_func_cb_data = NULL; - channel->resolvconf_path = NULL; - channel->hosts_path = NULL; - channel->rand_state = NULL; - - channel->last_server = 0; - channel->last_timeout_processed = (time_t)now.tv_sec; - - memset(&channel->local_dev_name, 0, sizeof(channel->local_dev_name)); - channel->local_ip4 = 0; - memset(&channel->local_ip6, 0, sizeof(channel->local_ip6)); + + /* Generate random key */ + + channel->rand_state = ares__init_rand_state(); + if (channel->rand_state == NULL) { + status = ARES_ENOMEM; + DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n", + ares_strerror(status))); + goto done; + } /* Initialize our lists of queries */ - ares__init_list_head(&(channel->all_queries)); - for (i = 0; i < ARES_QID_TABLE_SIZE; i++) - { - ares__init_list_head(&(channel->queries_by_qid[i])); - } - for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++) - { - ares__init_list_head(&(channel->queries_by_timeout[i])); - } + channel->all_queries = ares__llist_create(NULL); + if (channel->all_queries == NULL) { + status = ARES_ENOMEM; + goto done; + } + + channel->queries_by_qid = ares__htable_stvp_create(NULL); + if (channel->queries_by_qid == NULL) { + status = ARES_ENOMEM; + goto done; + } + + channel->queries_by_timeout = ares__slist_create(channel->rand_state, + ares_query_timeout_cmp_cb, + NULL); + if (channel->queries_by_timeout == NULL) { + status = ARES_ENOMEM; + goto done; + } + + channel->connnode_by_socket = ares__htable_asvp_create(NULL); + if (channel->connnode_by_socket == NULL) { + status = ARES_ENOMEM; + goto done; + } /* Initialize configuration by each of the four sources, from highest * precedence to lowest. @@ -204,27 +233,22 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", ares_strerror(status))); - /* Generate random key */ - - if (status == ARES_SUCCESS) { - channel->rand_state = ares__init_rand_state(); - if (channel->rand_state == NULL) { - status = ARES_ENOMEM; - } + /* Trim to one server if ARES_FLAG_PRIMARY is set. */ + if ((channel->flags & ARES_FLAG_PRIMARY) && channel->nservers > 1) + channel->nservers = 1; - if (status == ARES_SUCCESS) - channel->next_id = ares__generate_new_id(channel->rand_state); - else - DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n", - ares_strerror(status))); + status = ares__init_servers_state(channel); + if (status != ARES_SUCCESS) { + goto done; } done: if (status != ARES_SUCCESS) { /* Something failed; clean up memory we may have allocated. */ - if (channel->servers) + if (channel->servers) { ares_free(channel->servers); + } if (channel->ndomains != -1) ares__strsplit_free(channel->domains, channel->ndomains); if (channel->sortlist) @@ -237,16 +261,15 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ares_free(channel->hosts_path); if (channel->rand_state) ares__destroy_rand_state(channel->rand_state); + + ares__htable_stvp_destroy(channel->queries_by_qid); + ares__llist_destroy(channel->all_queries); + ares__slist_destroy(channel->queries_by_timeout); + ares__htable_asvp_destroy(channel->connnode_by_socket); ares_free(channel); return status; } - /* Trim to one server if ARES_FLAG_PRIMARY is set. */ - if ((channel->flags & ARES_FLAG_PRIMARY) && channel->nservers > 1) - channel->nservers = 1; - - ares__init_servers_state(channel); - *channelptr = channel; return ARES_SUCCESS; } @@ -377,6 +400,7 @@ int ares_save_options(ares_channel channel, struct ares_options *options, options->servers = ares_malloc(ipv4_nservers * sizeof(struct in_addr)); if (!options->servers) return ARES_ENOMEM; + for (i = j = 0; i < channel->nservers; i++) { if ((channel->servers[i].addr.family == AF_INET) && @@ -437,6 +461,11 @@ int ares_save_options(ares_channel channel, struct ares_options *options, return ARES_ENOMEM; } + if (channel->udp_max_queries > 0) { + (*optmask) |= ARES_OPT_UDP_MAX_QUERIES; + options->udp_max_queries = channel->udp_max_queries; + } + return ARES_SUCCESS; } @@ -487,9 +516,10 @@ static int init_by_options(ares_channel channel, if (options->nservers > 0) { channel->servers = - ares_malloc(options->nservers * sizeof(struct server_state)); + ares_malloc(options->nservers * sizeof(*channel->servers)); if (!channel->servers) return ARES_ENOMEM; + memset(channel->servers, 0, options->nservers * sizeof(*channel->servers)); for (i = 0; i < options->nservers; i++) { channel->servers[i].addr.family = AF_INET; @@ -561,6 +591,9 @@ static int init_by_options(ares_channel channel, return ARES_ENOMEM; } + if (optmask & ARES_OPT_UDP_MAX_QUERIES) + channel->udp_max_queries = options->udp_max_queries; + channel->optmask = optmask; return ARES_SUCCESS; @@ -683,7 +716,7 @@ typedef struct /* Room enough for the string form of any IPv4 or IPv6 address that * ares_inet_ntop() will create. Based on the existing c-ares practice. */ - char text[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + char text[INET6_ADDRSTRLEN + 8]; /* [%s]:NNNNN */ } Address; /* Sort Address values \a left and \a right by metric, returning the usual @@ -880,6 +913,7 @@ static int get_DNS_Windows(char **outptr) ipaDNSAddr; ipaDNSAddr = ipaDNSAddr->Next) { + char ipaddr[INET6_ADDRSTRLEN] = ""; namesrvr.sa = ipaDNSAddr->Address.lpSockaddr; if (namesrvr.sa->sa_family == AF_INET) @@ -909,10 +943,14 @@ static int get_DNS_Windows(char **outptr) addresses[addressesIndex].orig_idx = addressesIndex; if (!ares_inet_ntop(AF_INET, &namesrvr.sa4->sin_addr, - addresses[addressesIndex].text, - sizeof(addresses[0].text))) { + ipaddr, sizeof(ipaddr))) { continue; } + snprintf(addresses[addressesIndex].text, + sizeof(addresses[addressesIndex].text), + "[%s]:%u", + ipaddr, + ntohs(namesrvr.sa4->sin_port)); ++addressesIndex; } else if (namesrvr.sa->sa_family == AF_INET6) @@ -942,10 +980,14 @@ static int get_DNS_Windows(char **outptr) addresses[addressesIndex].orig_idx = addressesIndex; if (!ares_inet_ntop(AF_INET6, &namesrvr.sa6->sin6_addr, - addresses[addressesIndex].text, - sizeof(addresses[0].text))) { + ipaddr, sizeof(ipaddr))) { continue; } + snprintf(addresses[addressesIndex].text, + sizeof(addresses[addressesIndex].text), + "[%s]:%u", + ipaddr, + ntohs(namesrvr.sa6->sin6_port)); ++addressesIndex; } else { @@ -1159,11 +1201,11 @@ static int init_by_resolv_conf(ares_channel channel) } nservers = count4 + count6; - servers = ares_malloc(nservers * sizeof(struct server_state)); + servers = ares_malloc(nservers * sizeof(*servers)); if (!servers) return ARES_ENOMEM; - memset(servers, 0, nservers * sizeof(struct server_state)); + memset(servers, 0, nservers * sizeof(*servers)); pserver = servers; for (int i = 0; i < count4; ++i, ++pserver) { @@ -1225,10 +1267,10 @@ static int init_by_resolv_conf(ares_channel channel) return ARES_SUCCESS; /* use localhost DNS server */ nservers = i; - servers = ares_malloc(sizeof(struct server_state)); + servers = ares_malloc(sizeof(*servers)); if (!servers) return ARES_ENOMEM; - memset(servers, 0, sizeof(struct server_state)); + memset(servers, 0, sizeof(*servers)); for (i = 0; def_nameservers[i]; i++) { @@ -1301,8 +1343,9 @@ static int init_by_resolv_conf(ares_channel channel) # endif /* HAVE___SYSTEM_PROPERTY_GET */ #elif defined(CARES_USE_LIBRESOLV) struct __res_state res; + int result; memset(&res, 0, sizeof(res)); - int result = res_ninit(&res); + result = res_ninit(&res); if (result == 0 && (res.options & RES_INIT)) { status = ARES_EOF; @@ -1311,18 +1354,28 @@ static int init_by_resolv_conf(ares_channel channel) int nscount = res_getservers(&res, addr, MAXNS); int i; for (i = 0; i < nscount; ++i) { - char str[INET6_ADDRSTRLEN]; + char ipaddr[INET6_ADDRSTRLEN] = ""; + char ipaddr_port[INET6_ADDRSTRLEN + 8]; /* [%s]:NNNNN */ + unsigned short port = 0; int config_status; sa_family_t family = addr[i].sin.sin_family; if (family == AF_INET) { - ares_inet_ntop(family, &addr[i].sin.sin_addr, str, sizeof(str)); + ares_inet_ntop(family, &addr[i].sin.sin_addr, ipaddr, sizeof(ipaddr)); + port = ntohs(addr[i].sin.sin_port); } else if (family == AF_INET6) { - ares_inet_ntop(family, &addr[i].sin6.sin6_addr, str, sizeof(str)); + ares_inet_ntop(family, &addr[i].sin6.sin6_addr, ipaddr, sizeof(ipaddr)); + port = ntohs(addr[i].sin6.sin6_port); } else { continue; } - config_status = config_nameserver(&servers, &nservers, str); + if (port) { + snprintf(ipaddr_port, sizeof(ipaddr_port), "[%s]:%u", ipaddr, port); + } else { + snprintf(ipaddr_port, sizeof(ipaddr_port), "%s", ipaddr); + } + + config_status = config_nameserver(&servers, &nservers, ipaddr_port); if (config_status != ARES_SUCCESS) { status = config_status; break; @@ -1578,11 +1631,12 @@ static int init_by_defaults(ares_channel channel) if (channel->nservers == -1) { /* If nobody specified servers, try a local named. */ - channel->servers = ares_malloc(sizeof(struct server_state)); + channel->servers = ares_malloc(sizeof(*channel->servers)); if (!channel->servers) { rc = ARES_ENOMEM; goto error; } + memset(channel->servers, 0, sizeof(*channel->servers)); channel->servers[0].addr.family = AF_INET; channel->servers[0].addr.addrV4.s_addr = htonl(INADDR_LOOPBACK); channel->servers[0].addr.udp_port = 0; @@ -1676,6 +1730,7 @@ static int init_by_defaults(ares_channel channel) ares_free(channel->servers); channel->servers = NULL; } + channel->nservers = 0; if(channel->domains && channel->domains[0]) ares_free(channel->domains[0]); @@ -1829,8 +1884,112 @@ static int ares_ipv6_server_blacklisted(const unsigned char ipaddr[16]) return 0; } -/* Add the IPv4 or IPv6 nameservers in str (separated by commas) to the - * servers list, updating servers and nservers as required. +/* Parse address and port in these formats, either ipv4 or ipv6 addresses + * are allowed: + * ipaddr + * [ipaddr] + * [ipaddr]:port + * + * If a port is not specified, will set port to 0. + * + * Will fail if an IPv6 nameserver as detected by + * ares_ipv6_server_blacklisted() + * + * Returns an error code on failure, else ARES_SUCCESS + */ +static int parse_dnsaddrport(const char *str, size_t len, + struct ares_addr *host, unsigned short *port) +{ + char ipaddr[INET6_ADDRSTRLEN] = ""; + char ipport[6] = ""; + size_t mylen; + const char *addr_start = NULL; + const char *addr_end = NULL; + const char *port_start = NULL; + const char *port_end = NULL; + + /* Must start with [, hex digit or : */ + if (len == 0 || (*str != '[' && !isxdigit(*str) && *str != ':')) { + return ARES_EBADSTR; + } + + /* If it starts with a bracket, must end with a bracket */ + if (*str == '[') { + const char *ptr; + addr_start = str+1; + ptr = memchr(addr_start, ']', len-1); + if (ptr == NULL) { + return ARES_EBADSTR; + } + addr_end = ptr-1; + + /* Try to pull off port */ + if ((size_t)(ptr - str) < len) { + ptr++; + if (*ptr != ':') { + return ARES_EBADSTR; + } + + /* Missing port number */ + if ((size_t)(ptr - str) == len) { + return ARES_EBADSTR; + } + + port_start = ptr+1; + port_end = str+(len-1); + } + } else { + addr_start = str; + addr_end = str+(len-1); + } + + mylen = (addr_end-addr_start)+1; + /* Larger than buffer with null term */ + if (mylen+1 > sizeof(ipaddr)) { + return ARES_EBADSTR; + } + + memset(ipaddr, 0, sizeof(ipaddr)); + memcpy(ipaddr, addr_start, mylen); + + if (port_start) { + mylen = (port_end-port_start)+1; + /* Larger than buffer with null term */ + if (mylen+1 > sizeof(ipport)) { + return ARES_EBADSTR; + } + memset(ipport, 0, sizeof(ipport)); + memcpy(ipport, port_start, mylen); + } else { + snprintf(ipport, sizeof(ipport), "0"); + } + + /* Convert textual address to binary format. */ + if (ares_inet_pton(AF_INET, ipaddr, &host->addrV4) == 1) { + host->family = AF_INET; + } else if (ares_inet_pton(AF_INET6, ipaddr, &host->addrV6) == 1 + /* Silently skip blacklisted IPv6 servers. */ + && !ares_ipv6_server_blacklisted( + (const unsigned char *)&host->addrV6)) { + host->family = AF_INET6; + } else { + return ARES_EBADSTR; + } + + *port = (unsigned short)atoi(ipport); + return ARES_SUCCESS; +} + +/* Add the IPv4 or IPv6 nameservers in str (separated by commas or spaces) to + * the servers list, updating servers and nservers as required. + * + * If a nameserver is encapsulated in [ ] it may optionally include a port + * suffix, e.g.: + * [127.0.0.1]:59591 + * + * The extended format is required to support OpenBSD's resolv.conf format: + * https://man.openbsd.org/OpenBSD-5.1/resolv.conf.5 + * As well as MacOS libresolv that may include a non-default port number. * * This will silently ignore blacklisted IPv6 nameservers as detected by * ares_ipv6_server_blacklisted(). @@ -1838,16 +1997,18 @@ static int ares_ipv6_server_blacklisted(const unsigned char ipaddr[16]) * Returns an error code on failure, else ARES_SUCCESS. */ static int config_nameserver(struct server_state **servers, int *nservers, - char *str) + const char *str) { struct ares_addr host; struct server_state *newserv; - char *p, *txtaddr; + const char *p, *txtaddr; /* On Windows, there may be more than one nameserver specified in the same * registry key, so we parse input as a space or comma seperated list. */ for (p = str; p;) { + unsigned short port; + /* Skip whitespace and commas. */ while (*p && (ISSPACE(*p) || (*p == ','))) p++; @@ -1861,34 +2022,24 @@ static int config_nameserver(struct server_state **servers, int *nservers, /* Advance past this address. */ while (*p && !ISSPACE(*p) && (*p != ',')) p++; - if (*p) - /* Null terminate this address. */ - *p++ = '\0'; - else - /* Reached end of input, done when this address is processed. */ - p = NULL; - /* Convert textual address to binary format. */ - if (ares_inet_pton(AF_INET, txtaddr, &host.addrV4) == 1) - host.family = AF_INET; - else if (ares_inet_pton(AF_INET6, txtaddr, &host.addrV6) == 1 - /* Silently skip blacklisted IPv6 servers. */ - && !ares_ipv6_server_blacklisted( - (const unsigned char *)&host.addrV6)) - host.family = AF_INET6; - else + if (parse_dnsaddrport(txtaddr, p-txtaddr, &host, &port) != + ARES_SUCCESS) { continue; + } /* Resize servers state array. */ newserv = ares_realloc(*servers, (*nservers + 1) * - sizeof(struct server_state)); + sizeof(*newserv)); if (!newserv) return ARES_ENOMEM; + memset(((unsigned char *)newserv) + ((*nservers) * sizeof(*newserv)), 0, sizeof(*newserv)); + /* Store address data. */ newserv[*nservers].addr.family = host.family; - newserv[*nservers].addr.udp_port = 0; - newserv[*nservers].addr.tcp_port = 0; + newserv[*nservers].addr.udp_port = htons(port); + newserv[*nservers].addr.tcp_port = htons(port); if (host.family == AF_INET) memcpy(&newserv[*nservers].addr.addrV4, &host.addrV4, sizeof(host.addrV4)); @@ -2242,25 +2393,36 @@ int ares_set_sortlist(ares_channel channel, const char *sortstr) return status; } -void ares__init_servers_state(ares_channel channel) +int ares__init_servers_state(ares_channel channel) { struct server_state *server; int i; - for (i = 0; i < channel->nservers; i++) - { - server = &channel->servers[i]; - server->udp_socket = ARES_SOCKET_BAD; - server->tcp_socket = ARES_SOCKET_BAD; - server->tcp_connection_generation = ++channel->tcp_connection_generation; - server->tcp_lenbuf_pos = 0; - server->tcp_buffer_pos = 0; - server->tcp_buffer = NULL; - server->tcp_length = 0; - server->qhead = NULL; - server->qtail = NULL; - ares__init_list_head(&server->queries_to_server); - server->channel = channel; - server->is_broken = 0; + for (i = 0; i < channel->nservers; i++) { + server = &channel->servers[i]; + + /* NOTE: Can't use memset() here because the server addresses have been + * filled in already */ + server->tcp_parser = ares__buf_create(); + if (server->tcp_parser == NULL) + return ARES_ENOMEM; + + server->tcp_send = ares__buf_create(); + if (server->tcp_send == NULL) { + ares__buf_destroy(server->tcp_parser); + return ARES_ENOMEM; } + + server->idx = i; + server->connections = ares__llist_create(NULL); + if (server->connections == NULL) { + ares__buf_destroy(server->tcp_parser); + ares__buf_destroy(server->tcp_send); + return ARES_ENOMEM; + } + + server->tcp_connection_generation = ++channel->tcp_connection_generation; + server->channel = channel; + } + return ARES_SUCCESS; } diff --git a/graal-nodejs/deps/cares/src/lib/ares_iphlpapi.h b/graal-nodejs/deps/cares/src/lib/ares_iphlpapi.h index 343aee3ffbd..31db7d3829a 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_iphlpapi.h +++ b/graal-nodejs/deps/cares/src/lib/ares_iphlpapi.h @@ -1,21 +1,31 @@ -#ifndef HEADER_CARES_IPHLPAPI_H -#define HEADER_CARES_IPHLPAPI_H - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004 - 2011 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2004 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_IPHLPAPI_H +#define HEADER_CARES_IPHLPAPI_H #if defined(USE_WINSOCK) diff --git a/graal-nodejs/deps/cares/src/lib/ares_ipv6.h b/graal-nodejs/deps/cares/src/lib/ares_ipv6.h index fdbc21fe8f9..edb305324bc 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_ipv6.h +++ b/graal-nodejs/deps/cares/src/lib/ares_ipv6.h @@ -1,17 +1,27 @@ - -/* Copyright (C) 2005 by Dominick Meglio +/* MIT License + * + * Copyright (c) 2005 Dominick Meglio + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #ifndef ARES_IPV6_H diff --git a/graal-nodejs/deps/cares/src/lib/ares_library_init.c b/graal-nodejs/deps/cares/src/lib/ares_library_init.c index bbfcbeec178..1cf30f0b0fe 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_library_init.c +++ b/graal-nodejs/deps/cares/src/lib/ares_library_init.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2009 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2004 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_llist.c b/graal-nodejs/deps/cares/src/lib/ares_llist.c deleted file mode 100644 index 36ca84c43e4..00000000000 --- a/graal-nodejs/deps/cares/src/lib/ares_llist.c +++ /dev/null @@ -1,63 +0,0 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#include "ares.h" -#include "ares_private.h" - -/* Routines for managing doubly-linked circular linked lists with a - * dummy head. - */ - -/* Initialize a new head node */ -void ares__init_list_head(struct list_node* head) { - head->prev = head; - head->next = head; - head->data = NULL; -} - -/* Initialize a list node */ -void ares__init_list_node(struct list_node* node, void* d) { - node->prev = NULL; - node->next = NULL; - node->data = d; -} - -/* Returns true iff the given list is empty */ -int ares__is_list_empty(struct list_node* head) { - return ((head->next == head) && (head->prev == head)); -} - -/* Inserts new_node before old_node */ -void ares__insert_in_list(struct list_node* new_node, - struct list_node* old_node) { - new_node->next = old_node; - new_node->prev = old_node->prev; - old_node->prev->next = new_node; - old_node->prev = new_node; -} - -/* Removes the node from the list it's in, if any */ -void ares__remove_from_list(struct list_node* node) { - if (node->next != NULL) { - node->prev->next = node->next; - node->next->prev = node->prev; - node->prev = NULL; - node->next = NULL; - } -} - diff --git a/graal-nodejs/deps/cares/src/lib/ares_llist.h b/graal-nodejs/deps/cares/src/lib/ares_llist.h deleted file mode 100644 index 20f4d1ce426..00000000000 --- a/graal-nodejs/deps/cares/src/lib/ares_llist.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __ARES_LLIST_H -#define __ARES_LLIST_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - - -/* Node definition for circular, doubly-linked list */ -struct list_node { - struct list_node *prev; - struct list_node *next; - void* data; -}; - -void ares__init_list_head(struct list_node* head); - -void ares__init_list_node(struct list_node* node, void* d); - -int ares__is_list_empty(struct list_node* head); - -void ares__insert_in_list(struct list_node* new_node, - struct list_node* old_node); - -void ares__remove_from_list(struct list_node* node); - -#endif /* __ARES_LLIST_H */ diff --git a/graal-nodejs/deps/cares/src/lib/ares_mkquery.c b/graal-nodejs/deps/cares/src/lib/ares_mkquery.c index 5aea914bd0e..da1898e74cd 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_mkquery.c +++ b/graal-nodejs/deps/cares/src/lib/ares_mkquery.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_nowarn.c b/graal-nodejs/deps/cares/src/lib/ares_nowarn.c index f63d9135ecc..65cabb37b29 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_nowarn.c +++ b/graal-nodejs/deps/cares/src/lib/ares_nowarn.c @@ -1,20 +1,29 @@ - -/* Copyright (C) 2010-2013 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 2010 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ - #include "ares_setup.h" #ifdef HAVE_ASSERT_H diff --git a/graal-nodejs/deps/cares/src/lib/ares_nowarn.h b/graal-nodejs/deps/cares/src/lib/ares_nowarn.h index 505e6220981..3f5612dbb91 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_nowarn.h +++ b/graal-nodejs/deps/cares/src/lib/ares_nowarn.h @@ -1,21 +1,30 @@ -#ifndef HEADER_CARES_NOWARN_H -#define HEADER_CARES_NOWARN_H - - -/* Copyright (C) 2010-2012 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 2010 Daniel Stenberg * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_NOWARN_H +#define HEADER_CARES_NOWARN_H long aresx_uztosl(size_t uznum); int aresx_uztosi(size_t uznum); diff --git a/graal-nodejs/deps/cares/src/lib/ares_options.c b/graal-nodejs/deps/cares/src/lib/ares_options.c index de49de46259..78e16bb5d2f 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_options.c +++ b/graal-nodejs/deps/cares/src/lib/ares_options.c @@ -1,21 +1,30 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2008-2013 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2008 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ - #include "ares_setup.h" #ifdef HAVE_ARPA_INET_H @@ -153,7 +162,7 @@ int ares_set_servers(ares_channel channel, if (!channel) return ARES_ENODATA; - if (!ares__is_list_empty(&channel->all_queries)) + if (ares__llist_len(channel->all_queries) != 0) return ARES_ENOTIMP; ares__destroy_servers_state(channel); @@ -166,11 +175,12 @@ int ares_set_servers(ares_channel channel, if (num_srvrs > 0) { /* Allocate storage for servers state */ - channel->servers = ares_malloc(num_srvrs * sizeof(struct server_state)); + channel->servers = ares_malloc(num_srvrs * sizeof(*channel->servers)); if (!channel->servers) { return ARES_ENOMEM; } + memset(channel->servers, 0, num_srvrs * sizeof(*channel->servers)); channel->nservers = num_srvrs; /* Fill servers state address data */ for (i = 0, srvr = servers; srvr; i++, srvr = srvr->next) @@ -205,7 +215,7 @@ int ares_set_servers_ports(ares_channel channel, if (!channel) return ARES_ENODATA; - if (!ares__is_list_empty(&channel->all_queries)) + if (ares__llist_len(channel->all_queries) != 0) return ARES_ENOTIMP; ares__destroy_servers_state(channel); @@ -218,11 +228,12 @@ int ares_set_servers_ports(ares_channel channel, if (num_srvrs > 0) { /* Allocate storage for servers state */ - channel->servers = ares_malloc(num_srvrs * sizeof(struct server_state)); + channel->servers = ares_malloc(num_srvrs * sizeof(*channel->servers)); if (!channel->servers) { return ARES_ENOMEM; } + memset(channel->servers, 0, num_srvrs * sizeof(*channel->servers)); channel->nservers = num_srvrs; /* Fill servers state address data */ for (i = 0, srvr = servers; srvr; i++, srvr = srvr->next) diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_a_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_a_reply.c index ee903c7510e..b50dea3884c 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_a_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_a_reply.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2019 by Andrew Selivanov +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2019 Andrew Selivanov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_aaaa_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_aaaa_reply.c index 091065d3176..7a839829eb5 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_aaaa_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_aaaa_reply.c @@ -1,19 +1,29 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright 2005 Dominick Meglio - * Copyright (C) 2019 by Andrew Selivanov +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2005 Dominick Meglio + * Copyright (c) 2019 Andrew Selivanov + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_caa_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_caa_reply.c index f6d4d3c61f4..f4581c124a2 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_caa_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_caa_reply.c @@ -1,5 +1,37 @@ +/* MIT License + * + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ -/* Copyright 2020 by +/* ============================================================================= + * NOTE: The below copyright is preserved from the original author. In + * October 2023, there were attempts made to contact the author in order + * gain approval for relicensing to the modern MIT license from the + * below 1989 variant, but all contact information for the author is + * no longer valid. + * + * Copyright (c) 2020 * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without @@ -12,6 +44,8 @@ * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" * without express or implied warranty. + * + * ============================================================================= */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_mx_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_mx_reply.c index a497f558738..36dfe3d933b 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_mx_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_mx_reply.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2010 Jeremy Lal +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2010 Jeremy Lal + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_naptr_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_naptr_reply.c index dd984c0fea8..81dfb02a2af 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_naptr_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_naptr_reply.c @@ -1,20 +1,29 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2009 by Jakub Hrozek +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2009 Jakub Hrozek + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ - #include "ares_setup.h" #ifdef HAVE_NETINET_IN_H diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_ns_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_ns_reply.c index 47d12994c96..28083d44c11 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_ns_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_ns_reply.c @@ -1,16 +1,28 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ /* diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_ptr_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_ptr_reply.c index ae78edf1951..0606d35f1e8 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_ptr_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_ptr_reply.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_soa_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_soa_reply.c index 3935eec9db4..f37ba191733 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_soa_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_soa_reply.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2012 Marko Kreen +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2012 Marko Kreen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_srv_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_srv_reply.c index 0d8f4d2098b..0125092c02d 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_srv_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_srv_reply.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2009 by Jakub Hrozek +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2009 Jakub Hrozek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_txt_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_txt_reply.c index 6848a092bbc..083cbf4dff7 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_txt_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_txt_reply.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2009 by Jakub Hrozek +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2009 Jakub Hrozek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_parse_uri_reply.c b/graal-nodejs/deps/cares/src/lib/ares_parse_uri_reply.c index d79b5c4d85c..d5bb7ee45d7 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_parse_uri_reply.c +++ b/graal-nodejs/deps/cares/src/lib/ares_parse_uri_reply.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2009 by Jakub Hrozek +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2009 Jakub Hrozek + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -151,9 +161,6 @@ ares_parse_uri_reply (const unsigned char *abuf, int alen, uri_curr->uri = strncpy(uri_curr->uri, (const char *)vptr, rr_len-4); uri_curr->uri[rr_len-4]='\0'; uri_curr->ttl = rr_ttl; - - if (status != ARES_SUCCESS) - break; } /* Don't lose memory in the next iteration */ diff --git a/graal-nodejs/deps/cares/src/lib/ares_platform.c b/graal-nodejs/deps/cares/src/lib/ares_platform.c index 6c749dccb24..6fcbd49bb8f 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_platform.c +++ b/graal-nodejs/deps/cares/src/lib/ares_platform.c @@ -1,19 +1,28 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004 - 2011 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2004 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_platform.h b/graal-nodejs/deps/cares/src/lib/ares_platform.h index e6885ae5461..44b2c036443 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_platform.h +++ b/graal-nodejs/deps/cares/src/lib/ares_platform.h @@ -1,22 +1,31 @@ -#ifndef HEADER_CARES_PLATFORM_H -#define HEADER_CARES_PLATFORM_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004 - 2011 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2004 Daniel Stenberg * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_PLATFORM_H +#define HEADER_CARES_PLATFORM_H #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_private.h b/graal-nodejs/deps/cares/src/lib/ares_private.h index b6eab8a7d9b..8bd12fc1182 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_private.h +++ b/graal-nodejs/deps/cares/src/lib/ares_private.h @@ -1,22 +1,31 @@ -#ifndef __ARES_PRIVATE_H -#define __ARES_PRIVATE_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2010 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2010 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ +#ifndef __ARES_PRIVATE_H +#define __ARES_PRIVATE_H /* * Define WIN32 when build target is Win32 API @@ -33,12 +42,10 @@ #ifdef WATT32 #include #include -#define writev(s,v,c) writev_s(s,v,c) -#define HAVE_WRITEV 1 #endif -#define DEFAULT_TIMEOUT 5000 /* milliseconds */ -#define DEFAULT_TRIES 4 +#define DEFAULT_TIMEOUT 2000 /* milliseconds */ +#define DEFAULT_TRIES 3 #ifndef INADDR_NONE #define INADDR_NONE 0xffffffff #endif @@ -102,7 +109,15 @@ W32_FUNC const char *_w32_GetHostsFile (void); #endif #include "ares_ipv6.h" -#include "ares_llist.h" + +struct ares_rand_state; +typedef struct ares_rand_state ares_rand_state; + +#include "ares__llist.h" +#include "ares__slist.h" +#include "ares__htable_stvp.h" +#include "ares__htable_asvp.h" +#include "ares__buf.h" #ifndef HAVE_GETENV # include "ares_getenv.h" @@ -122,11 +137,6 @@ W32_FUNC const char *_w32_GetHostsFile (void); # define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n) #endif -#ifndef HAVE_WRITEV -# include "ares_writev.h" -# define writev(s,ptr,cnt) ares_writev(s,ptr,cnt) -#endif - /********* EDNS defines section ******/ #define EDNSPACKETSZ 1280 /* Reasonable UDP payload size, as suggested in RFC2671 */ @@ -148,37 +158,31 @@ struct ares_addr { struct query; -struct send_request { - /* Remaining data to send */ - const unsigned char *data; - size_t len; +struct server_state; - /* The query for which we're sending this data */ - struct query* owner_query; - /* The buffer we're using, if we have our own copy of the packet */ - unsigned char *data_storage; - - /* Next request in queue */ - struct send_request *next; +struct server_connection { + struct server_state *server; + ares_socket_t fd; + int is_tcp; + /* total number of queries run on this connection since it was established */ + size_t total_queries; + /* list of outstanding queries to this connection */ + ares__llist_t *queries_to_conn; }; struct server_state { + size_t idx; /* index for server in ares_channel */ struct ares_addr addr; - ares_socket_t udp_socket; - ares_socket_t tcp_socket; - /* Mini-buffer for reading the length word */ - unsigned char tcp_lenbuf[2]; - int tcp_lenbuf_pos; - int tcp_length; + ares__llist_t *connections; + struct server_connection *tcp_conn; - /* Buffer for reading actual TCP data */ - unsigned char *tcp_buffer; - int tcp_buffer_pos; + /* TCP buffer since multiple responses can come back in one read, or partial + * in a read */ + ares__buf_t *tcp_parser; /* TCP output queue */ - struct send_request *qhead; - struct send_request *qtail; + ares__buf_t *tcp_send; /* Which incarnation of this connection is this? We don't want to * retransmit requests into the very same socket, but if the server @@ -186,34 +190,27 @@ struct server_state { * re-send. */ int tcp_connection_generation; - /* Circular, doubly-linked list of outstanding queries to this server */ - struct list_node queries_to_server; - /* Link back to owning channel */ ares_channel channel; - - /* Is this server broken? We mark connections as broken when a - * request that is queued for sending times out. - */ - int is_broken; }; /* State to represent a DNS query */ struct query { /* Query ID from qbuf, for faster lookup, and current timeout */ - unsigned short qid; + unsigned short qid; /* host byte order */ struct timeval timeout; + ares_channel channel; /* - * Links for the doubly-linked lists in which we insert a query. - * These circular, doubly-linked lists that are hash-bucketed based - * the attributes we care about, help making most important - * operations O(1). + * Node object for each list entry the query belongs to in order to + * make removal operations O(1). */ - struct list_node queries_by_qid; /* hopefully in same cache line as qid */ - struct list_node queries_by_timeout; - struct list_node queries_to_server; - struct list_node all_queries; + ares__slist_node_t *node_queries_by_timeout; + ares__llist_node_t *node_queries_to_conn; + ares__llist_node_t *node_all_queries; + + /* connection handle for validation purposes */ + const struct server_connection *conn; /* Query buf with length at beginning, for TCP transmission */ unsigned char *tcpbuf; @@ -232,6 +229,8 @@ struct query { int using_tcp; int error_status; int timeouts; /* number of timeouts we saw for this request */ + int no_retries; /* do not perform any additional retries, this is set when + * a query is to be canceled */ }; /* Per-server state for a query */ @@ -260,9 +259,6 @@ struct apattern { unsigned short type; }; -struct ares_rand_state; -typedef struct ares_rand_state ares_rand_state; - struct ares_channeldata { /* Configuration data */ int flags; @@ -294,30 +290,28 @@ struct ares_channeldata { struct server_state *servers; int nservers; - /* ID to use for next query */ - unsigned short next_id; /* random state to use when generating new ids */ ares_rand_state *rand_state; /* Generation number to use for the next TCP socket open/close */ int tcp_connection_generation; - /* The time at which we last called process_timeouts(). Uses integer seconds - just to draw the line somewhere. */ - time_t last_timeout_processed; - /* Last server we sent a query to. */ int last_server; - /* Circular, doubly-linked list of queries, bucketed various ways.... */ - /* All active queries in a single list: */ - struct list_node all_queries; + /* All active queries in a single list */ + ares__llist_t *all_queries; /* Queries bucketed by qid, for quickly dispatching DNS responses: */ -#define ARES_QID_TABLE_SIZE 2048 - struct list_node queries_by_qid[ARES_QID_TABLE_SIZE]; + ares__htable_stvp_t *queries_by_qid; + /* Queries bucketed by timeout, for quickly handling timeouts: */ -#define ARES_TIMEOUT_TABLE_SIZE 1024 - struct list_node queries_by_timeout[ARES_TIMEOUT_TABLE_SIZE]; + ares__slist_t *queries_by_timeout; + + /* Map linked list node member for connection to file descriptor. We use + * the node instead of the connection object itself so we can quickly look + * up a connection and remove it if necessary (as otherwise we'd have to + * scan all connections) */ + ares__htable_asvp_t *connnode_by_socket; ares_sock_state_cb sock_state_cb; void *sock_state_cb_data; @@ -336,6 +330,9 @@ struct ares_channeldata { /* Path for hosts file, configurable via ares_options */ char *hosts_path; + + /* Maximum UDP queries per connection allowed */ + int udp_max_queries; }; /* Does the domain end in ".onion" or ".onion."? Case-insensitive. */ @@ -350,15 +347,31 @@ extern void (*ares_free)(void *ptr); int ares__timedout(struct timeval *now, struct timeval *check); -void ares__send_query(ares_channel channel, struct query *query, - struct timeval *now); -void ares__close_sockets(ares_channel channel, struct server_state *server); +/* Returns one of the normal ares status codes like ARES_SUCCESS */ +int ares__send_query(ares_channel channel, struct query *query, + struct timeval *now); + +/* Identical to ares_query, but returns a normal ares return code like + * ARES_SUCCESS, and can be passed the qid by reference which will be + * filled in on ARES_SUCCESS */ +int ares_query_qid(ares_channel channel, const char *name, + int dnsclass, int type, ares_callback callback, + void *arg, unsigned short *qid); +/* Identical to ares_send() except returns normal ares return codes like + * ARES_SUCCESS */ +int ares_send_ex(ares_channel channel, const unsigned char *qbuf, int qlen, + ares_callback callback, void *arg); +void ares__close_connection(struct server_connection *conn); +void ares__close_sockets(struct server_state *server); +void ares__check_cleanup_conn(ares_channel channel, ares_socket_t fd); int ares__get_hostent(FILE *fp, int family, struct hostent **host); int ares__read_line(FILE *fp, char **buf, size_t *bufsize); void ares__free_query(struct query *query); ares_rand_state *ares__init_rand_state(void); 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); int ares__expand_name_validated(const unsigned char *encoded, @@ -368,7 +381,7 @@ int ares__expand_name_validated(const unsigned char *encoded, int ares__expand_name_for_response(const unsigned char *encoded, const unsigned char *abuf, int alen, char **s, long *enclen, int is_hostname); -void ares__init_servers_state(ares_channel channel); +int ares__init_servers_state(ares_channel channel); void ares__destroy_servers_state(ares_channel channel); int ares__parse_qtype_reply(const unsigned char* abuf, int alen, int* qtype); int ares__single_domain(ares_channel channel, const char *name, char **s); @@ -378,16 +391,12 @@ int ares__readaddrinfo(FILE *fp, const char *name, unsigned short port, const struct ares_addrinfo_hints *hints, struct ares_addrinfo *ai); -struct ares_addrinfo *ares__malloc_addrinfo(void); - -struct ares_addrinfo_node *ares__malloc_addrinfo_node(void); void ares__freeaddrinfo_nodes(struct ares_addrinfo_node *ai_node); struct ares_addrinfo_node *ares__append_addrinfo_node(struct ares_addrinfo_node **ai_node); void ares__addrinfo_cat_nodes(struct ares_addrinfo_node **head, struct ares_addrinfo_node *tail); -struct ares_addrinfo_cname *ares__malloc_addrinfo_cname(void); void ares__freeaddrinfo_cnames(struct ares_addrinfo_cname *ai_cname); struct ares_addrinfo_cname *ares__append_addrinfo_cname(struct ares_addrinfo_cname **ai_cname); diff --git a/graal-nodejs/deps/cares/src/lib/ares_process.c b/graal-nodejs/deps/cares/src/lib/ares_process.c index 6cac0a99fdf..2b951a73fc0 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_process.c +++ b/graal-nodejs/deps/cares/src/lib/ares_process.c @@ -1,18 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2017 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) 2010 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -58,32 +68,27 @@ static int try_again(int errnum); static void write_tcp_data(ares_channel channel, fd_set *write_fds, ares_socket_t write_fd, struct timeval *now); -static void read_tcp_data(ares_channel channel, fd_set *read_fds, - ares_socket_t read_fd, struct timeval *now); -static void read_udp_packets(ares_channel channel, fd_set *read_fds, - ares_socket_t read_fd, struct timeval *now); -static void advance_tcp_send_queue(ares_channel channel, int whichserver, - ares_ssize_t num_bytes); +static void read_packets(ares_channel channel, fd_set *read_fds, + ares_socket_t read_fd, struct timeval *now); static void process_timeouts(ares_channel channel, struct timeval *now); -static void process_broken_connections(ares_channel channel, - struct timeval *now); -static void process_answer(ares_channel channel, unsigned char *abuf, - int alen, int whichserver, int tcp, +static void process_answer(ares_channel channel, const unsigned char *abuf, + int alen, struct server_connection *conn, int tcp, struct timeval *now); -static void handle_error(ares_channel channel, int whichserver, - struct timeval *now); +static void handle_error(struct server_connection *conn, struct timeval *now); static void skip_server(ares_channel channel, struct query *query, - int whichserver); -static void next_server(ares_channel channel, struct query *query, + struct server_state *server); +static int next_server(ares_channel channel, struct query *query, struct timeval *now); -static int open_tcp_socket(ares_channel channel, struct server_state *server); -static int open_udp_socket(ares_channel channel, struct server_state *server); +static int open_socket(ares_channel channel, struct server_state *server, + int is_tcp); static int same_questions(const unsigned char *qbuf, int qlen, const unsigned char *abuf, int alen); static int same_address(struct sockaddr *sa, struct ares_addr *aa); static int has_opt_rr(const unsigned char *abuf, int alen); static void end_query(ares_channel channel, struct query *query, int status, - unsigned char *abuf, int alen); + const unsigned char *abuf, int alen); +static ares_ssize_t ares__socket_write(ares_channel channel, ares_socket_t s, + const void * data, size_t len); /* return true if now is exactly check time or later */ int ares__timedout(struct timeval *now, @@ -122,10 +127,8 @@ static void processfds(ares_channel channel, struct timeval now = ares__tvnow(); write_tcp_data(channel, write_fds, write_fd, &now); - read_tcp_data(channel, read_fds, read_fd, &now); - read_udp_packets(channel, read_fds, read_fd, &now); + read_packets(channel, read_fds, read_fd, &now); process_timeouts(channel, &now); - process_broken_connections(channel, &now); } /* Something interesting happened on the wire, or there was a timeout. @@ -174,25 +177,6 @@ static int try_again(int errnum) return 0; } -static ares_ssize_t socket_writev(ares_channel channel, ares_socket_t s, const struct iovec * vec, int len) -{ - if (channel->sock_funcs) - return channel->sock_funcs->asendv(s, vec, len, channel->sock_func_cb_data); - - return writev(s, vec, len); -} - -static ares_ssize_t socket_write(ares_channel channel, ares_socket_t s, const void * data, size_t len) -{ - if (channel->sock_funcs) - { - struct iovec vec; - vec.iov_base = (void*)data; - vec.iov_len = len; - return channel->sock_funcs->asendv(s, &vec, 1, channel->sock_func_cb_data); - } - return swrite(s, data, len); -} /* If any TCP sockets select true for writing, write out queued data * we have for them. @@ -203,134 +187,60 @@ static void write_tcp_data(ares_channel channel, struct timeval *now) { struct server_state *server; - struct send_request *sendreq; - struct iovec *vec; int i; - ares_ssize_t scount; - ares_ssize_t wcount; - size_t n; - /* From writev manpage: An implementation can advertise its limit by defining - IOV_MAX in or at run time via the return value from - sysconf(_SC_IOV_MAX). On modern Linux systems, the limit is 1024. Back in - Linux 2.0 days, this limit was 16. */ -#if defined(IOV_MAX) - const size_t maxn = IOV_MAX; /* FreeBSD */ -#elif defined(_SC_IOV_MAX) - const size_t maxn = sysconf(_SC_IOV_MAX); /* Linux */ -#else - const size_t maxn = 16; /* Safe default */ -#endif if(!write_fds && (write_fd == ARES_SOCKET_BAD)) /* no possible action */ return; - for (i = 0; i < channel->nservers; i++) - { - /* Make sure server has data to send and is selected in write_fds or - write_fd. */ - server = &channel->servers[i]; - if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD || - server->is_broken) - continue; - - if(write_fds) { - if(!FD_ISSET(server->tcp_socket, write_fds)) - continue; - } - else { - if(server->tcp_socket != write_fd) - continue; - } - - if(write_fds) - /* If there's an error and we close this socket, then open - * another with the same fd to talk to another server, then we - * don't want to think that it was the new socket that was - * ready. This is not disastrous, but is likely to result in - * extra system calls and confusion. */ - FD_CLR(server->tcp_socket, write_fds); - - /* Count the number of send queue items. */ - n = 0; - for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) - n++; - - /* Allocate iovecs so we can send all our data at once. */ - vec = ares_malloc(n * sizeof(struct iovec)); - if (vec) - { - /* Fill in the iovecs and send. */ - n = 0; - for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) - { - vec[n].iov_base = (char *) sendreq->data; - vec[n].iov_len = sendreq->len; - n++; - if(n >= maxn) - break; - } - wcount = socket_writev(channel, server->tcp_socket, vec, (int)n); - ares_free(vec); - if (wcount < 0) - { - if (!try_again(SOCKERRNO)) - handle_error(channel, i, now); - continue; - } + for (i = 0; i < channel->nservers; i++) { + const unsigned char *data; + size_t data_len; + ares_ssize_t count; - /* Advance the send queue by as many bytes as we sent. */ - advance_tcp_send_queue(channel, i, wcount); - } - else - { - /* Can't allocate iovecs; just send the first request. */ - sendreq = server->qhead; + /* Make sure server has data to send and is selected in write_fds or + write_fd. */ + server = &channel->servers[i]; + if (ares__buf_len(server->tcp_send) == 0 || server->tcp_conn == NULL) + continue; - scount = socket_write(channel, server->tcp_socket, sendreq->data, sendreq->len); - if (scount < 0) - { - if (!try_again(SOCKERRNO)) - handle_error(channel, i, now); - continue; - } + if (write_fds) { + if (!FD_ISSET(server->tcp_conn->fd, write_fds)) + continue; + } else { + if (server->tcp_conn->fd != write_fd) + continue; + } - /* Advance the send queue by as many bytes as we sent. */ - advance_tcp_send_queue(channel, i, scount); - } + if (write_fds) { + /* If there's an error and we close this socket, then open + * another with the same fd to talk to another server, then we + * don't want to think that it was the new socket that was + * ready. This is not disastrous, but is likely to result in + * extra system calls and confusion. */ + FD_CLR(server->tcp_conn->fd, write_fds); } -} -/* Consume the given number of bytes from the head of the TCP send queue. */ -static void advance_tcp_send_queue(ares_channel channel, int whichserver, - ares_ssize_t num_bytes) -{ - struct send_request *sendreq; - struct server_state *server = &channel->servers[whichserver]; - while (num_bytes > 0) { - sendreq = server->qhead; - if ((size_t)num_bytes >= sendreq->len) { - num_bytes -= sendreq->len; - server->qhead = sendreq->next; - if (sendreq->data_storage) - ares_free(sendreq->data_storage); - ares_free(sendreq); - if (server->qhead == NULL) { - SOCK_STATE_CALLBACK(channel, server->tcp_socket, 1, 0); - server->qtail = NULL; - - /* qhead is NULL so we cannot continue this loop */ - break; + data = ares__buf_peek(server->tcp_send, &data_len); + count = ares__socket_write(channel, server->tcp_conn->fd, data, data_len); + if (count <= 0) { + if (!try_again(SOCKERRNO)) { + handle_error(server->tcp_conn, now); } + continue; } - else { - sendreq->data += num_bytes; - sendreq->len -= num_bytes; - num_bytes = 0; + + /* Strip data written from the buffer */ + ares__buf_consume(server->tcp_send, count); + + /* Notify state callback all data is written */ + if (ares__buf_len(server->tcp_send) == 0) { + SOCK_STATE_CALLBACK(channel, server->tcp_conn->fd, 1, 0); } } } + static ares_ssize_t socket_recvfrom(ares_channel channel, ares_socket_t s, void * data, @@ -339,7 +249,7 @@ static ares_ssize_t socket_recvfrom(ares_channel channel, struct sockaddr *from, ares_socklen_t *from_len) { - if (channel->sock_funcs) + if (channel->sock_funcs && channel->sock_funcs->arecvfrom) return channel->sock_funcs->arecvfrom(s, data, data_len, flags, from, from_len, channel->sock_func_cb_data); @@ -356,122 +266,150 @@ static ares_ssize_t socket_recv(ares_channel channel, void * data, size_t data_len) { - if (channel->sock_funcs) + if (channel->sock_funcs && channel->sock_funcs->arecvfrom) return channel->sock_funcs->arecvfrom(s, data, data_len, 0, 0, 0, channel->sock_func_cb_data); return sread(s, data, data_len); } + /* If any TCP socket selects true for reading, read some data, * allocate a buffer if we finish reading the length word, and process * a packet if we finish reading one. */ -static void read_tcp_data(ares_channel channel, fd_set *read_fds, - ares_socket_t read_fd, struct timeval *now) +static void read_tcp_data(ares_channel channel, struct server_connection *conn, + struct timeval *now) { - struct server_state *server; - int i; - ares_ssize_t count; + ares_ssize_t count; + struct server_state *server = conn->server; + + /* Fetch buffer to store data we are reading */ + size_t ptr_len = 512; + unsigned char *ptr = ares__buf_append_start(server->tcp_parser, + &ptr_len); + + if (ptr == NULL) { + handle_error(conn, now); + return; /* bail out on malloc failure. TODO: make this + function return error codes */ + } - if(!read_fds && (read_fd == ARES_SOCKET_BAD)) - /* no possible action */ + /* Read from socket */ + count = socket_recv(channel, conn->fd, ptr, ptr_len); + if (count <= 0) { + ares__buf_append_finish(server->tcp_parser, 0); + if (!(count == -1 && try_again(SOCKERRNO))) + handle_error(conn, now); return; + } - for (i = 0; i < channel->nservers; i++) - { - /* Make sure the server has a socket and is selected in read_fds. */ - server = &channel->servers[i]; - if (server->tcp_socket == ARES_SOCKET_BAD || server->is_broken) - continue; + /* Record amount of data read */ + ares__buf_append_finish(server->tcp_parser, count); - if(read_fds) { - if(!FD_ISSET(server->tcp_socket, read_fds)) - continue; - } - else { - if(server->tcp_socket != read_fd) - continue; - } + /* Process all queued answers */ + while (1) { + unsigned short dns_len = 0; + const unsigned char *data = NULL; + size_t data_len = 0; - if(read_fds) - /* If there's an error and we close this socket, then open another - * with the same fd to talk to another server, then we don't want to - * think that it was the new socket that was ready. This is not - * disastrous, but is likely to result in extra system calls and - * confusion. */ - FD_CLR(server->tcp_socket, read_fds); + /* Tag so we can roll back */ + ares__buf_tag(server->tcp_parser); - if (server->tcp_lenbuf_pos != 2) - { - /* We haven't yet read a length word, so read that (or - * what's left to read of it). - */ - count = socket_recv(channel, server->tcp_socket, - server->tcp_lenbuf + server->tcp_lenbuf_pos, - 2 - server->tcp_lenbuf_pos); - if (count <= 0) - { - if (!(count == -1 && try_again(SOCKERRNO))) - handle_error(channel, i, now); - continue; - } + /* Read length indicator */ + if (ares__buf_fetch_be16(server->tcp_parser, &dns_len) != ARES_SUCCESS) { + ares__buf_tag_rollback(server->tcp_parser); + return; + } - server->tcp_lenbuf_pos += (int)count; - if (server->tcp_lenbuf_pos == 2) - { - /* We finished reading the length word. Decode the - * length and allocate a buffer for the data. - */ - server->tcp_length = server->tcp_lenbuf[0] << 8 - | server->tcp_lenbuf[1]; - server->tcp_buffer = ares_malloc(server->tcp_length); - if (!server->tcp_buffer) { - handle_error(channel, i, now); - return; /* bail out on malloc failure. TODO: make this - function return error codes */ - } - server->tcp_buffer_pos = 0; - } - } - else - { - /* Read data into the allocated buffer. */ - count = socket_recv(channel, server->tcp_socket, - server->tcp_buffer + server->tcp_buffer_pos, - server->tcp_length - server->tcp_buffer_pos); - if (count <= 0) - { - if (!(count == -1 && try_again(SOCKERRNO))) - handle_error(channel, i, now); - continue; - } + /* Not enough data for a full response yet */ + if (ares__buf_consume(server->tcp_parser, dns_len) != ARES_SUCCESS) { + ares__buf_tag_rollback(server->tcp_parser); + return; + } - server->tcp_buffer_pos += (int)count; - if (server->tcp_buffer_pos == server->tcp_length) - { - /* We finished reading this answer; process it and - * prepare to read another length word. - */ - process_answer(channel, server->tcp_buffer, server->tcp_length, - i, 1, now); - ares_free(server->tcp_buffer); - server->tcp_buffer = NULL; - server->tcp_lenbuf_pos = 0; - server->tcp_buffer_pos = 0; - } - } + /* Can't fail except for misuse */ + data = ares__buf_tag_fetch(server->tcp_parser, &data_len); + if (data == NULL) { + ares__buf_tag_clear(server->tcp_parser); + return; } + + /* Strip off 2 bytes length */ + data += 2; + data_len -= 2; + + /* We finished reading this answer; process it */ + process_answer(channel, data, (int)data_len, conn, 1, now); + + /* Since we processed the answer, clear the tag so space can be reclaimed */ + ares__buf_tag_clear(server->tcp_parser); + } +} + + +static int socket_list_append(ares_socket_t **socketlist, ares_socket_t fd, + size_t *alloc_cnt, size_t *num) +{ + if (*num >= *alloc_cnt) { + /* Grow by powers of 2 */ + size_t new_alloc = (*alloc_cnt) << 1; + ares_socket_t *new_list = ares_realloc(socketlist, + new_alloc * sizeof(*new_list)); + if (new_list == NULL) + return 0; + *alloc_cnt = new_alloc; + *socketlist = new_list; + } + + (*socketlist)[(*num)++] = fd; + return 1; +} + + +static ares_socket_t *channel_socket_list(ares_channel channel, size_t *num) +{ + size_t alloc_cnt = 1 << 4; + int i; + ares_socket_t *out = ares_malloc(alloc_cnt * sizeof(*out)); + + *num = 0; + + if (out == NULL) + return NULL; + + for (i=0; inservers; i++) { + ares__llist_node_t *node; + for (node = ares__llist_node_first(channel->servers[i].connections); + node != NULL; + node = ares__llist_node_next(node)) { + struct server_connection *conn = ares__llist_node_val(node); + + if (conn->fd == ARES_SOCKET_BAD) + continue; + + if (!socket_list_append(&out, conn->fd, &alloc_cnt, num)) + goto fail; + } + } + + return out; + +fail: + ares_free(out); + *num = 0; + return NULL; } /* If any UDP sockets select true for reading, process them. */ -static void read_udp_packets(ares_channel channel, fd_set *read_fds, - ares_socket_t read_fd, struct timeval *now) +static void read_udp_packets_fd(ares_channel channel, + struct server_connection *conn, + struct timeval *now) { - struct server_state *server; - int i; ares_ssize_t read_len; unsigned char buf[MAXENDSSZ + 1]; + ares_socket_t fd = conn->fd; /* Cache for validation */ + #ifdef HAVE_RECVFROM ares_socklen_t fromlen; union { @@ -481,148 +419,188 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds, } from; #endif - if(!read_fds && (read_fd == ARES_SOCKET_BAD)) + /* To reduce event loop overhead, read and process as many + * packets as we can. */ + do { + if (conn->fd == ARES_SOCKET_BAD) { + read_len = -1; + } else { + if (conn->server->addr.family == AF_INET) { + fromlen = sizeof(from.sa4); + } else { + fromlen = sizeof(from.sa6); + } + read_len = socket_recvfrom(channel, conn->fd, (void *)buf, + sizeof(buf), 0, &from.sa, &fromlen); + } + + if (read_len == 0) { + /* UDP is connectionless, so result code of 0 is a 0-length UDP + * packet, and not an indication the connection is closed like on + * tcp */ + continue; + } else if (read_len < 0) { + if (try_again(SOCKERRNO)) + continue; + + handle_error(conn, now); + +#ifdef HAVE_RECVFROM + } else if (!same_address(&from.sa, &conn->server->addr)) { + /* The address the response comes from does not match the address we + * sent the request to. Someone may be attempting to perform a cache + * poisoning attack. */ + continue; +#endif + + } else { + process_answer(channel, buf, (int)read_len, conn, 0, now); + } + /* process_answer may invalidate "conn" and close the file descriptor, so + * check to see if file descriptor is still valid before looping! */ + } while (read_len >= 0 && + ares__htable_asvp_get_direct(channel->connnode_by_socket, fd) != NULL); + +} + + +static void read_packets(ares_channel channel, fd_set *read_fds, + ares_socket_t read_fd, struct timeval *now) +{ + size_t i; + ares_socket_t *socketlist = NULL; + size_t num_sockets = 0; + struct server_connection *conn = NULL; + ares__llist_node_t *node = NULL; + + if (!read_fds && (read_fd == ARES_SOCKET_BAD)) /* no possible action */ return; - for (i = 0; i < channel->nservers; i++) - { - /* Make sure the server has a socket and is selected in read_fds. */ - server = &channel->servers[i]; + /* Single socket specified */ + if (!read_fds) { + node = ares__htable_asvp_get_direct(channel->connnode_by_socket, read_fd); + if (node == NULL) + return; - if (server->udp_socket == ARES_SOCKET_BAD || server->is_broken) - continue; + conn = ares__llist_node_val(node); - if(read_fds) { - if(!FD_ISSET(server->udp_socket, read_fds)) - continue; - } - else { - if(server->udp_socket != read_fd) - continue; - } + if (conn->is_tcp) { + read_tcp_data(channel, conn, now); + } else { + read_udp_packets_fd(channel, conn, now); + } - if(read_fds) - /* If there's an error and we close this socket, then open - * another with the same fd to talk to another server, then we - * don't want to think that it was the new socket that was - * ready. This is not disastrous, but is likely to result in - * extra system calls and confusion. */ - FD_CLR(server->udp_socket, read_fds); - - /* To reduce event loop overhead, read and process as many - * packets as we can. */ - do { - if (server->udp_socket == ARES_SOCKET_BAD) { - read_len = -1; - } else { - if (server->addr.family == AF_INET) { - fromlen = sizeof(from.sa4); - } else { - fromlen = sizeof(from.sa6); - } - read_len = socket_recvfrom(channel, server->udp_socket, (void *)buf, - sizeof(buf), 0, &from.sa, &fromlen); - } + return; + } - if (read_len == 0) { - /* UDP is connectionless, so result code of 0 is a 0-length UDP - * packet, and not an indication the connection is closed like on - * tcp */ - continue; - } else if (read_len < 0) { - if (try_again(SOCKERRNO)) - continue; + /* There is no good way to iterate across an fd_set, instead we must pull a list + * of all known fds, and iterate across that checking against the fd_set. */ + socketlist = channel_socket_list(channel, &num_sockets); - handle_error(channel, i, now); + for (i=0; iaddr)) { - /* The address the response comes from does not match the address we - * sent the request to. Someone may be attempting to perform a cache - * poisoning attack. */ - continue; -#endif + /* If there's an error and we close this socket, then open + * another with the same fd to talk to another server, then we + * don't want to think that it was the new socket that was + * ready. This is not disastrous, but is likely to result in + * extra system calls and confusion. */ + FD_CLR(socketlist[i], read_fds); - } else { - process_answer(channel, buf, (int)read_len, i, 0, now); - } - } while (read_len >= 0); + node = ares__htable_asvp_get_direct(channel->connnode_by_socket, + socketlist[i]); + if (node == NULL) + return; + + conn = ares__llist_node_val(node); + + if (conn->is_tcp) { + read_tcp_data(channel, conn, now); + } else { + read_udp_packets_fd(channel, conn, now); } + } + + ares_free(socketlist); } + /* If any queries have timed out, note the timeout and move them on. */ static void process_timeouts(ares_channel channel, struct timeval *now) { - time_t t; /* the time of the timeouts we're processing */ - struct query *query; - struct list_node* list_head; - struct list_node* list_node; + ares__slist_node_t *node = ares__slist_node_first(channel->queries_by_timeout); + while (node != NULL) { + struct query *query = ares__slist_node_val(node); + /* Node might be removed, cache next */ + ares__slist_node_t *next = ares__slist_node_next(node); + ares_socket_t fd; + + /* Since this is sorted, as soon as we hit a query that isn't timed out, break */ + if (!ares__timedout(now, &query->timeout)) { + break; + } - /* Process all the timeouts that have fired since the last time we processed - * timeouts. If things are going well, then we'll have hundreds/thousands of - * queries that fall into future buckets, and only a handful of requests - * that fall into the "now" bucket, so this should be quite quick. - */ - for (t = channel->last_timeout_processed; t <= now->tv_sec; t++) - { - list_head = &(channel->queries_by_timeout[t % ARES_TIMEOUT_TABLE_SIZE]); - for (list_node = list_head->next; list_node != list_head; ) - { - query = list_node->data; - list_node = list_node->next; /* in case the query gets deleted */ - if (query->timeout.tv_sec && ares__timedout(now, &query->timeout)) - { - query->error_status = ARES_ETIMEOUT; - ++query->timeouts; - next_server(channel, query, now); - } - } - } - channel->last_timeout_processed = now->tv_sec; + query->error_status = ARES_ETIMEOUT; + query->timeouts++; + + + fd = query->conn->fd; + next_server(channel, query, now); + /* A timeout is a special case where we need to possibly cleanup a + * a connection */ + ares__check_cleanup_conn(channel, fd); + + node = next; + } } + /* Handle an answer from a server. */ -static void process_answer(ares_channel channel, unsigned char *abuf, - int alen, int whichserver, int tcp, +static void process_answer(ares_channel channel, const unsigned char *abuf, + int alen, struct server_connection *conn, int tcp, struct timeval *now) { int tc, rcode, packetsz; unsigned short id; struct query *query; - struct list_node* list_head; - struct list_node* list_node; + /* Cache these as once ares__send_query() gets called, it may end up + * invalidating the connection all-together */ + struct server_state *server = conn->server; + ares_socket_t fd = conn->fd; /* If there's no room in the answer for a header, we can't do much * with it. */ - if (alen < HFIXEDSZ) + if (alen < HFIXEDSZ) { return; + } /* Grab the query ID, truncate bit, and response code from the packet. */ - id = DNS_HEADER_QID(abuf); + id = DNS_HEADER_QID(abuf); /* Converts to host byte order */ tc = DNS_HEADER_TC(abuf); rcode = DNS_HEADER_RCODE(abuf); /* Find the query corresponding to this packet. The queries are - * hashed/bucketed by query id, so this lookup should be quick. Note that - * both the query id and the questions must be the same; when the query id - * wraps around we can have multiple outstanding queries with the same query - * id, so we need to check both the id and question. + * hashed/bucketed by query id, so this lookup should be quick. */ - query = NULL; - list_head = &(channel->queries_by_qid[id % ARES_QID_TABLE_SIZE]); - for (list_node = list_head->next; list_node != list_head; - list_node = list_node->next) - { - struct query *q = list_node->data; - if ((q->qid == id) && same_questions(q->qbuf, q->qlen, abuf, alen)) - { - query = q; - break; - } - } - if (!query) + query = ares__htable_stvp_get_direct(channel->queries_by_qid, id); + if (!query) { + return; + } + + /* Both the query id and the questions must be the same. We will drop any + * replies that aren't for the same query as this is considered invalid. */ + if (!same_questions(query->qbuf, query->qlen, abuf, alen)) { return; + } + + /* At this point we know we've received an answer for this query, so we should + * remove it from the connection's queue so we can possibly invalidate the + * connection. Delay cleaning up the connection though as we may enqueue + * something new. */ + ares__llist_node_destroy(query->node_queries_to_conn); + query->node_queries_to_conn = NULL; packetsz = PACKETSZ; /* If we use EDNS and server answers with FORMERR without an OPT RR, the protocol @@ -643,6 +621,7 @@ static void process_answer(ares_channel channel, unsigned char *abuf, query->tcpbuf = ares_realloc(query->tcpbuf, query->tcplen); query->qbuf = query->tcpbuf + 2; ares__send_query(channel, query, now); + ares__check_cleanup_conn(channel, fd); return; } } @@ -658,6 +637,7 @@ static void process_answer(ares_channel channel, unsigned char *abuf, query->using_tcp = 1; ares__send_query(channel, query, now); } + ares__check_cleanup_conn(channel, fd); return; } @@ -674,93 +654,61 @@ static void process_answer(ares_channel channel, unsigned char *abuf, { if (rcode == SERVFAIL || rcode == NOTIMP || rcode == REFUSED) { - skip_server(channel, query, whichserver); - if (query->server == whichserver) + switch (rcode) { + case SERVFAIL: + query->error_status = ARES_ESERVFAIL; + break; + case NOTIMP: + query->error_status = ARES_ENOTIMP; + break; + case REFUSED: + query->error_status = ARES_EREFUSED; + break; + } + skip_server(channel, query, server); + if (query->server == (int)server->idx) /* Is this ever not true? */ next_server(channel, query, now); + ares__check_cleanup_conn(channel, fd); return; } } end_query(channel, query, ARES_SUCCESS, abuf, alen); -} -/* Close all the connections that are no longer usable. */ -static void process_broken_connections(ares_channel channel, - struct timeval *now) -{ - int i; - for (i = 0; i < channel->nservers; i++) - { - struct server_state *server = &channel->servers[i]; - if (server->is_broken) - { - handle_error(channel, i, now); - } - } + ares__check_cleanup_conn(channel, fd); } -/* Swap the contents of two lists */ -static void swap_lists(struct list_node* head_a, - struct list_node* head_b) -{ - int is_a_empty = ares__is_list_empty(head_a); - int is_b_empty = ares__is_list_empty(head_b); - struct list_node old_a = *head_a; - struct list_node old_b = *head_b; - - if (is_a_empty) { - ares__init_list_head(head_b); - } else { - *head_b = old_a; - old_a.next->prev = head_b; - old_a.prev->next = head_b; - } - if (is_b_empty) { - ares__init_list_head(head_a); - } else { - *head_a = old_b; - old_b.next->prev = head_a; - old_b.prev->next = head_a; - } -} -static void handle_error(ares_channel channel, int whichserver, +static void handle_error(struct server_connection *conn, struct timeval *now) { - struct server_state *server; - struct query *query; - struct list_node list_head; - struct list_node* list_node; - - server = &channel->servers[whichserver]; - - /* Reset communications with this server. */ - ares__close_sockets(channel, server); + ares_channel channel = conn->server->channel; + ares__llist_t *list_copy; + ares__llist_node_t *node; + + /* We steal the list from the connection then close the connection, then + * iterate across the list to requeue any inflight queries with the broken + * connection. Destroying the connection prior to requeuing ensures requests + * won't go back to the broken connection */ + list_copy = conn->queries_to_conn; + conn->queries_to_conn = NULL; + ares__close_connection(conn); + + while ((node = ares__llist_node_first(list_copy)) != NULL) { + struct query *query = ares__llist_node_val(node); + + assert(query->server == (int)conn->server->idx); + skip_server(channel, query, conn->server); + /* next_server will remove the current node from the list */ + next_server(channel, query, now); + } - /* Tell all queries talking to this server to move on and not try this - * server again. We steal the current list of queries that were in-flight to - * this server, since when we call next_server this can cause the queries to - * be re-sent to this server, which will re-insert these queries in that - * same server->queries_to_server list. - */ - ares__init_list_head(&list_head); - swap_lists(&list_head, &(server->queries_to_server)); - for (list_node = list_head.next; list_node != &list_head; ) - { - query = list_node->data; - list_node = list_node->next; /* in case the query gets deleted */ - assert(query->server == whichserver); - skip_server(channel, query, whichserver); - next_server(channel, query, now); - } - /* Each query should have removed itself from our temporary list as - * it re-sent itself or finished up... - */ - assert(ares__is_list_empty(&list_head)); + ares__llist_destroy(list_copy); } + static void skip_server(ares_channel channel, struct query *query, - int whichserver) + struct server_state *server) { /* The given server gave us problems with this query, so if we have the * luxury of using other servers, then let's skip the potentially broken @@ -772,165 +720,195 @@ static void skip_server(ares_channel channel, struct query *query, */ if (channel->nservers > 1) { - query->server_info[whichserver].skip_server = 1; + query->server_info[server->idx].skip_server = 1; } } -static void next_server(ares_channel channel, struct query *query, +static int next_server(ares_channel channel, struct query *query, struct timeval *now) { + int status; /* We need to try each server channel->tries times. We have channel->nservers * servers to try. In total, we need to do channel->nservers * channel->tries * attempts. Use query->try to remember how many times we already attempted - * this query. Use modular arithmetic to find the next server to try. */ - while (++(query->try_count) < (channel->nservers * channel->tries)) - { - struct server_state *server; - - /* Move on to the next server. */ - query->server = (query->server + 1) % channel->nservers; - server = &channel->servers[query->server]; - - /* We don't want to use this server if (1) we decided this connection is - * broken, and thus about to be closed, (2) we've decided to skip this - * server because of earlier errors we encountered, or (3) we already - * sent this query over this exact connection. - */ - if (!server->is_broken && - !query->server_info[query->server].skip_server && - !(query->using_tcp && - (query->server_info[query->server].tcp_connection_generation == - server->tcp_connection_generation))) - { - ares__send_query(channel, query, now); - return; - } - - /* You might think that with TCP we only need one try. However, even - * when using TCP, servers can time-out our connection just as we're - * sending a request, or close our connection because they die, or never - * send us a reply because they get wedged or tickle a bug that drops - * our request. - */ + * this query. Use modular arithmetic to find the next server to try. + * A query can be requested be terminated at the next interval by setting + * query->no_retries */ + while (++(query->try_count) < (channel->nservers * channel->tries) && + !query->no_retries) { + struct server_state *server; + + /* Move on to the next server. */ + query->server = (query->server + 1) % channel->nservers; + server = &channel->servers[query->server]; + + /* We don't want to use this server if (1) we've decided to skip this + * server because of earlier errors we encountered, or (2) we already + * sent this query over this exact connection. + */ + if (!query->server_info[query->server].skip_server && + !(query->using_tcp && + (query->server_info[query->server].tcp_connection_generation == + server->tcp_connection_generation))) { + return ares__send_query(channel, query, now); } + /* You might think that with TCP we only need one try. However, even + * when using TCP, servers can time-out our connection just as we're + * sending a request, or close our connection because they die, or never + * send us a reply because they get wedged or tickle a bug that drops + * our request. + */ + } + /* If we are here, all attempts to perform query failed. */ + status = query->error_status; end_query(channel, query, query->error_status, NULL, 0); + return status; } -void ares__send_query(ares_channel channel, struct query *query, +int ares__send_query(ares_channel channel, struct query *query, struct timeval *now) { - struct send_request *sendreq; struct server_state *server; + struct server_connection *conn; int timeplus; + int status; server = &channel->servers[query->server]; - if (query->using_tcp) - { - /* Make sure the TCP socket for this server is set up and queue - * a send request. - */ - if (server->tcp_socket == ARES_SOCKET_BAD) - { - if (open_tcp_socket(channel, server) == -1) - { - skip_server(channel, query, query->server); - next_server(channel, query, now); - return; - } - } - sendreq = ares_malloc(sizeof(struct send_request)); - if (!sendreq) - { - end_query(channel, query, ARES_ENOMEM, NULL, 0); - return; - } - memset(sendreq, 0, sizeof(struct send_request)); - /* To make the common case fast, we avoid copies by using the query's - * tcpbuf for as long as the query is alive. In the rare case where the - * query ends while it's queued for transmission, then we give the - * sendreq its own copy of the request packet and put it in - * sendreq->data_storage. - */ - sendreq->data_storage = NULL; - sendreq->data = query->tcpbuf; - sendreq->len = query->tcplen; - sendreq->owner_query = query; - sendreq->next = NULL; - if (server->qtail) - server->qtail->next = sendreq; - else - { - SOCK_STATE_CALLBACK(channel, server->tcp_socket, 1, 1); - server->qhead = sendreq; - } - server->qtail = sendreq; - query->server_info[query->server].tcp_connection_generation = - server->tcp_connection_generation; + if (query->using_tcp) { + size_t prior_len = 0; + /* Make sure the TCP socket for this server is set up and queue + * a send request. + */ + if (server->tcp_conn == NULL) { + int err = open_socket(channel, server, 1); + switch (err) { + /* Good result, continue on */ + case ARES_SUCCESS: + break; + + /* These conditions are retryable as they are server-specific + * error codes */ + case ARES_ECONNREFUSED: + case ARES_EBADFAMILY: + skip_server(channel, query, server); + return next_server(channel, query, now); + + /* Anything else is not retryable, likely ENOMEM */ + default: + end_query(channel, query, err, NULL, 0); + return err; + } } - else - { - if (server->udp_socket == ARES_SOCKET_BAD) - { - if (open_udp_socket(channel, server) == -1) - { - skip_server(channel, query, query->server); - next_server(channel, query, now); - return; - } - } - if (socket_write(channel, server->udp_socket, query->qbuf, query->qlen) == -1) - { - /* FIXME: Handle EAGAIN here since it likely can happen. */ - skip_server(channel, query, query->server); - next_server(channel, query, now); - return; - } + + conn = server->tcp_conn; + + prior_len = ares__buf_len(server->tcp_send); + + status = ares__buf_append(server->tcp_send, query->tcpbuf, query->tcplen); + if (status != ARES_SUCCESS) { + end_query(channel, query, status, NULL, 0); + return ARES_ENOMEM; } - /* For each trip through the entire server list, double the channel's - * assigned timeout, avoiding overflow. If channel->timeout is negative, - * leave it as-is, even though that should be impossible here. - */ - timeplus = channel->timeout; - { - /* How many times do we want to double it? Presume sane values here. */ - const int shift = query->try_count / channel->nservers; - - /* Is there enough room to shift timeplus left that many times? - * - * To find out, confirm that all of the bits we'll shift away are zero. - * Stop considering a shift if we get to the point where we could shift - * a 1 into the sign bit (i.e. when shift is within two of the bit - * count). - * - * This has the side benefit of leaving negative numbers unchanged. - */ - if(shift <= (int)(sizeof(int) * CHAR_BIT - 1) - && (timeplus >> (sizeof(int) * CHAR_BIT - 1 - shift)) == 0) - { - timeplus <<= shift; + if (prior_len == 0) { + SOCK_STATE_CALLBACK(channel, conn->fd, 1, 1); + } + + query->server_info[query->server].tcp_connection_generation = + server->tcp_connection_generation; + } else { + ares__llist_node_t *node = ares__llist_node_first(server->connections); + + /* Don't use the found connection if we've gone over the maximum number + * of queries. Also, skip over the TCP connection if it is the first in + * the list */ + if (node != NULL) { + conn = ares__llist_node_val(node); + if (conn->is_tcp) { + node = NULL; + } else if (channel->udp_max_queries > 0 && + conn->total_queries >= (size_t)channel->udp_max_queries) { + node = NULL; } } - query->timeout = *now; - timeadd(&query->timeout, timeplus); - /* Keep track of queries bucketed by timeout, so we can process - * timeout events quickly. - */ - ares__remove_from_list(&(query->queries_by_timeout)); - ares__insert_in_list( - &(query->queries_by_timeout), - &(channel->queries_by_timeout[query->timeout.tv_sec % - ARES_TIMEOUT_TABLE_SIZE])); - - /* Keep track of queries bucketed by server, so we can process server - * errors quickly. + if (node == NULL) { + int err = open_socket(channel, server, 0); + switch (err) { + /* Good result, continue on */ + case ARES_SUCCESS: + break; + + /* These conditions are retryable as they are server-specific + * error codes */ + case ARES_ECONNREFUSED: + case ARES_EBADFAMILY: + skip_server(channel, query, server); + return next_server(channel, query, now); + + /* Anything else is not retryable, likely ENOMEM */ + default: + end_query(channel, query, err, NULL, 0); + return err; + } + node = ares__llist_node_first(server->connections); + } + + conn = ares__llist_node_val(node); + if (ares__socket_write(channel, conn->fd, query->qbuf, query->qlen) == -1) { + /* FIXME: Handle EAGAIN here since it likely can happen. */ + skip_server(channel, query, server); + return next_server(channel, query, now); + } + } + + /* For each trip through the entire server list, double the channel's + * assigned timeout, avoiding overflow. If channel->timeout is negative, + * leave it as-is, even though that should be impossible here. + */ + timeplus = channel->timeout; + { + /* How many times do we want to double it? Presume sane values here. */ + const int shift = query->try_count / channel->nservers; + + /* Is there enough room to shift timeplus left that many times? + * + * To find out, confirm that all of the bits we'll shift away are zero. + * Stop considering a shift if we get to the point where we could shift + * a 1 into the sign bit (i.e. when shift is within two of the bit + * count). + * + * This has the side benefit of leaving negative numbers unchanged. */ - ares__remove_from_list(&(query->queries_to_server)); - ares__insert_in_list(&(query->queries_to_server), - &(server->queries_to_server)); + if(shift <= (int)(sizeof(int) * CHAR_BIT - 1) + && (timeplus >> (sizeof(int) * CHAR_BIT - 1 - shift)) == 0) + { + timeplus <<= shift; + } + } + + /* Keep track of queries bucketed by timeout, so we can process + * timeout events quickly. + */ + ares__slist_node_destroy(query->node_queries_by_timeout); + query->timeout = *now; + timeadd(&query->timeout, timeplus); + query->node_queries_by_timeout = ares__slist_insert(channel->queries_by_timeout, query); + if (!query->node_queries_by_timeout) { + end_query(channel, query, ARES_ENOMEM, NULL, 0); + return ARES_ENOMEM; + } + + /* Keep track of queries bucketed by connection, so we can process errors + * quickly. */ + ares__llist_node_destroy(query->node_queries_to_conn); + query->node_queries_to_conn = + ares__llist_insert_last(conn->queries_to_conn, query); + query->conn = conn; + conn->total_queries++; + return ARES_SUCCESS; } /* @@ -1013,7 +991,7 @@ static int configure_socket(ares_socket_t s, int family, ares_channel channel) } local; /* do not set options for user-managed sockets */ - if (channel->sock_funcs) + if (channel->sock_funcs && channel->sock_funcs->asocket) return 0; (void)setsocknonblock(s, TRUE); @@ -1072,7 +1050,8 @@ static int configure_socket(ares_socket_t s, int family, ares_channel channel) return 0; } -static int open_tcp_socket(ares_channel channel, struct server_state *server) +static int open_socket(ares_channel channel, struct server_state *server, + int is_tcp) { ares_socket_t s; int opt; @@ -1082,204 +1061,152 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) struct sockaddr_in6 sa6; } saddr; struct sockaddr *sa; + unsigned short port; + struct server_connection *conn; + ares__llist_node_t *node; - switch (server->addr.family) - { - case AF_INET: - sa = (void *)&saddr.sa4; - salen = sizeof(saddr.sa4); - memset(sa, 0, salen); - saddr.sa4.sin_family = AF_INET; - if (server->addr.tcp_port) { - saddr.sa4.sin_port = aresx_sitous(server->addr.tcp_port); - } else { - saddr.sa4.sin_port = aresx_sitous(channel->tcp_port); - } - memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4, - sizeof(server->addr.addrV4)); - break; - case AF_INET6: - sa = (void *)&saddr.sa6; - salen = sizeof(saddr.sa6); - memset(sa, 0, salen); - saddr.sa6.sin6_family = AF_INET6; - if (server->addr.tcp_port) { - saddr.sa6.sin6_port = aresx_sitous(server->addr.tcp_port); - } else { - saddr.sa6.sin6_port = aresx_sitous(channel->tcp_port); - } - memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6, - sizeof(server->addr.addrV6)); - break; - default: - return -1; /* LCOV_EXCL_LINE */ - } + if (is_tcp) { + port = aresx_sitous(server->addr.tcp_port? + server->addr.tcp_port:channel->tcp_port); + } else { + port = aresx_sitous(server->addr.udp_port? + server->addr.udp_port:channel->udp_port); + } + + switch (server->addr.family) { + case AF_INET: + sa = (void *)&saddr.sa4; + salen = sizeof(saddr.sa4); + memset(sa, 0, salen); + saddr.sa4.sin_family = AF_INET; + saddr.sa4.sin_port = port; + memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4, + sizeof(server->addr.addrV4)); + break; + case AF_INET6: + sa = (void *)&saddr.sa6; + salen = sizeof(saddr.sa6); + memset(sa, 0, salen); + saddr.sa6.sin6_family = AF_INET6; + saddr.sa6.sin6_port = port; + memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6, + sizeof(server->addr.addrV6)); + break; + default: + return ARES_EBADFAMILY; /* LCOV_EXCL_LINE */ + } /* Acquire a socket. */ - s = ares__open_socket(channel, server->addr.family, SOCK_STREAM, 0); + s = ares__open_socket(channel, server->addr.family, + is_tcp?SOCK_STREAM:SOCK_DGRAM, 0); if (s == ARES_SOCKET_BAD) - return -1; + return ARES_ECONNREFUSED; /* Configure it. */ - if (configure_socket(s, server->addr.family, channel) < 0) - { - ares__close_socket(channel, s); - return -1; - } + if (configure_socket(s, server->addr.family, channel) < 0) { + ares__close_socket(channel, s); + return ARES_ECONNREFUSED; + } #ifdef TCP_NODELAY - /* - * Disable the Nagle algorithm (only relevant for TCP sockets, and thus not - * in configure_socket). In general, in DNS lookups we're pretty much - * interested in firing off a single request and then waiting for a reply, - * so batching isn't very interesting. - */ - opt = 1; - if (channel->sock_funcs == 0 - && - setsockopt(s, IPPROTO_TCP, TCP_NODELAY, - (void *)&opt, sizeof(opt)) == -1) - { - ares__close_socket(channel, s); - return -1; + if (is_tcp) { + /* + * Disable the Nagle algorithm (only relevant for TCP sockets, and thus not + * in configure_socket). In general, in DNS lookups we're pretty much + * interested in firing off a single request and then waiting for a reply, + * so batching isn't very interesting. + */ + opt = 1; + if (!channel->sock_funcs || !channel->sock_funcs->asocket) { + if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (void *)&opt, sizeof(opt)) + == -1) { + ares__close_socket(channel, s); + return ARES_ECONNREFUSED; + } } + } #endif - if (channel->sock_config_cb) - { - int err = channel->sock_config_cb(s, SOCK_STREAM, - channel->sock_config_cb_data); - if (err < 0) - { - ares__close_socket(channel, s); - return err; - } + if (channel->sock_config_cb) { + int err = channel->sock_config_cb(s, SOCK_STREAM, + channel->sock_config_cb_data); + if (err < 0) { + ares__close_socket(channel, s); + return ARES_ECONNREFUSED; } + } /* Connect to the server. */ - if (ares__connect_socket(channel, s, sa, salen) == -1) - { - int err = SOCKERRNO; - - if (err != EINPROGRESS && err != EWOULDBLOCK) - { - ares__close_socket(channel, s); - return -1; - } - } + if (ares__connect_socket(channel, s, sa, salen) == -1) { + int err = SOCKERRNO; - if (channel->sock_create_cb) - { - int err = channel->sock_create_cb(s, SOCK_STREAM, - channel->sock_create_cb_data); - if (err < 0) - { - ares__close_socket(channel, s); - return err; - } - } - - SOCK_STATE_CALLBACK(channel, s, 1, 0); - server->tcp_buffer_pos = 0; - server->tcp_socket = s; - server->tcp_connection_generation = ++channel->tcp_connection_generation; - return 0; -} - -static int open_udp_socket(ares_channel channel, struct server_state *server) -{ - ares_socket_t s; - ares_socklen_t salen; - union { - struct sockaddr_in sa4; - struct sockaddr_in6 sa6; - } saddr; - struct sockaddr *sa; - - switch (server->addr.family) - { - case AF_INET: - sa = (void *)&saddr.sa4; - salen = sizeof(saddr.sa4); - memset(sa, 0, salen); - saddr.sa4.sin_family = AF_INET; - if (server->addr.udp_port) { - saddr.sa4.sin_port = aresx_sitous(server->addr.udp_port); - } else { - saddr.sa4.sin_port = aresx_sitous(channel->udp_port); - } - memcpy(&saddr.sa4.sin_addr, &server->addr.addrV4, - sizeof(server->addr.addrV4)); - break; - case AF_INET6: - sa = (void *)&saddr.sa6; - salen = sizeof(saddr.sa6); - memset(sa, 0, salen); - saddr.sa6.sin6_family = AF_INET6; - if (server->addr.udp_port) { - saddr.sa6.sin6_port = aresx_sitous(server->addr.udp_port); - } else { - saddr.sa6.sin6_port = aresx_sitous(channel->udp_port); - } - memcpy(&saddr.sa6.sin6_addr, &server->addr.addrV6, - sizeof(server->addr.addrV6)); - break; - default: - return -1; /* LCOV_EXCL_LINE */ - } - - /* Acquire a socket. */ - s = ares__open_socket(channel, server->addr.family, SOCK_DGRAM, 0); - if (s == ARES_SOCKET_BAD) - return -1; - - /* Set the socket non-blocking. */ - if (configure_socket(s, server->addr.family, channel) < 0) - { - ares__close_socket(channel, s); - return -1; + if (err != EINPROGRESS && err != EWOULDBLOCK) { + ares__close_socket(channel, s); + return ARES_ECONNREFUSED; } + } - if (channel->sock_config_cb) - { - int err = channel->sock_config_cb(s, SOCK_DGRAM, - channel->sock_config_cb_data); - if (err < 0) - { - ares__close_socket(channel, s); - return err; - } + if (channel->sock_create_cb) { + int err = channel->sock_create_cb(s, SOCK_STREAM, + channel->sock_create_cb_data); + if (err < 0) { + ares__close_socket(channel, s); + return ARES_ECONNREFUSED; } + } - /* Connect to the server. */ - if (ares__connect_socket(channel, s, sa, salen) == -1) - { - int err = SOCKERRNO; + conn = ares_malloc(sizeof(*conn)); + if (conn == NULL) { + ares__close_socket(channel, s); + return ARES_ENOMEM; + } + memset(conn, 0, sizeof(*conn)); + conn->fd = s; + conn->server = server; + conn->queries_to_conn = ares__llist_create(NULL); + conn->is_tcp = is_tcp; + if (conn->queries_to_conn == NULL) { + ares__close_socket(channel, s); + ares_free(conn); + return ARES_ENOMEM; + } - if (err != EINPROGRESS && err != EWOULDBLOCK) - { - ares__close_socket(channel, s); - return -1; - } - } + /* TCP connections are thrown to the end as we don't spawn multiple TCP + * connections. UDP connections are put on front where the newest connection + * can be quickly pulled */ + if (is_tcp) { + node = ares__llist_insert_last(server->connections, conn); + } else { + node = ares__llist_insert_first(server->connections, conn); + } + if (node == NULL) { + ares__close_socket(channel, s); + ares__llist_destroy(conn->queries_to_conn); + ares_free(conn); + return ARES_ENOMEM; + } - if (channel->sock_create_cb) - { - int err = channel->sock_create_cb(s, SOCK_DGRAM, - channel->sock_create_cb_data); - if (err < 0) - { - ares__close_socket(channel, s); - return err; - } - } + /* Register globally to quickly map event on file descriptor to connection + * node object */ + if (!ares__htable_asvp_insert(channel->connnode_by_socket, s, node)) { + ares__close_socket(channel, s); + ares__llist_destroy(conn->queries_to_conn); + ares__llist_node_claim(node); + ares_free(conn); + return ARES_ENOMEM; + } SOCK_STATE_CALLBACK(channel, s, 1, 0); - server->udp_socket = s; - return 0; + if (is_tcp) { + server->tcp_connection_generation = ++channel->tcp_connection_generation; + server->tcp_conn = conn; + } + + return ARES_SUCCESS; } + static int same_questions(const unsigned char *qbuf, int qlen, const unsigned char *abuf, int alen) { @@ -1466,83 +1393,37 @@ static int has_opt_rr(const unsigned char *abuf, int alen) return 0; } -static void end_query (ares_channel channel, struct query *query, int status, - unsigned char *abuf, int alen) +static void ares_detach_query(struct query *query) { - int i; + /* Remove the query from all the lists in which it is linked */ + ares__htable_stvp_remove(query->channel->queries_by_qid, query->qid); + ares__slist_node_destroy(query->node_queries_by_timeout); + ares__llist_node_destroy(query->node_queries_to_conn); + ares__llist_node_destroy(query->node_all_queries); + query->node_queries_by_timeout = NULL; + query->node_queries_to_conn = NULL; + query->node_all_queries = NULL; +} - /* First we check to see if this query ended while one of our send - * queues still has pointers to it. - */ - for (i = 0; i < channel->nservers; i++) - { - struct server_state *server = &channel->servers[i]; - struct send_request *sendreq; - for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) - if (sendreq->owner_query == query) - { - sendreq->owner_query = NULL; - assert(sendreq->data_storage == NULL); - if (status == ARES_SUCCESS) - { - /* We got a reply for this query, but this queued sendreq - * points into this soon-to-be-gone query's tcpbuf. Probably - * this means we timed out and queued the query for - * retransmission, then received a response before actually - * retransmitting. This is perfectly fine, so we want to keep - * the connection running smoothly if we can. But in the worst - * case we may have sent only some prefix of the query, with - * some suffix of the query left to send. Also, the buffer may - * be queued on multiple queues. To prevent dangling pointers - * to the query's tcpbuf and handle these cases, we just give - * such sendreqs their own copy of the query packet. - */ - sendreq->data_storage = ares_malloc(sendreq->len); - if (sendreq->data_storage != NULL) - { - memcpy(sendreq->data_storage, sendreq->data, sendreq->len); - sendreq->data = sendreq->data_storage; - } - } - if ((status != ARES_SUCCESS) || (sendreq->data_storage == NULL)) - { - /* We encountered an error (probably a timeout, suggesting the - * DNS server we're talking to is probably unreachable, - * wedged, or severely overloaded) or we couldn't copy the - * request, so mark the connection as broken. When we get to - * process_broken_connections() we'll close the connection and - * try to re-send requests to another server. - */ - server->is_broken = 1; - /* Just to be paranoid, zero out this sendreq... */ - sendreq->data = NULL; - sendreq->len = 0; - } - } - } +static void end_query(ares_channel channel, struct query *query, int status, + const unsigned char *abuf, int alen) +{ + (void)channel; - /* Invoke the callback */ - query->callback(query->arg, status, query->timeouts, abuf, alen); - ares__free_query(query); + ares_detach_query(query); - /* Simple cleanup policy: if no queries are remaining, close all network - * sockets unless STAYOPEN is set. - */ - if (!(channel->flags & ARES_FLAG_STAYOPEN) && - ares__is_list_empty(&(channel->all_queries))) - { - for (i = 0; i < channel->nservers; i++) - ares__close_sockets(channel, &channel->servers[i]); - } + /* Invoke the callback. */ + query->callback(query->arg, status, query->timeouts, + /* due to prior design flaws, abuf isn't meant to be modified, + * but bad prototypes, ugh. Lets cast off constfor compat. */ + (unsigned char *)((void *)((size_t)abuf)), + alen); + ares__free_query(query); } void ares__free_query(struct query *query) { - /* Remove the query from all the lists in which it is linked */ - ares__remove_from_list(&(query->queries_by_qid)); - ares__remove_from_list(&(query->queries_by_timeout)); - ares__remove_from_list(&(query->queries_to_server)); - ares__remove_from_list(&(query->all_queries)); + ares_detach_query(query); /* Zero out some important stuff, to help catch bugs */ query->callback = NULL; query->arg = NULL; @@ -1555,13 +1436,14 @@ void ares__free_query(struct query *query) ares_socket_t ares__open_socket(ares_channel channel, int af, int type, int protocol) { - if (channel->sock_funcs) + if (channel->sock_funcs && channel->sock_funcs->asocket) { return channel->sock_funcs->asocket(af, type, protocol, channel->sock_func_cb_data); - else - return socket(af, type, protocol); + } + + return socket(af, type, protocol); } int ares__connect_socket(ares_channel channel, @@ -1569,19 +1451,41 @@ int ares__connect_socket(ares_channel channel, const struct sockaddr *addr, ares_socklen_t addrlen) { - if (channel->sock_funcs) + if (channel->sock_funcs && channel->sock_funcs->aconnect) { return channel->sock_funcs->aconnect(sockfd, addr, addrlen, channel->sock_func_cb_data); - else - return connect(sockfd, addr, addrlen); + } + + return connect(sockfd, addr, addrlen); } void ares__close_socket(ares_channel channel, ares_socket_t s) { - if (channel->sock_funcs) + if (channel->sock_funcs && channel->sock_funcs->aclose) { channel->sock_funcs->aclose(s, channel->sock_func_cb_data); - else + } else { sclose(s); + } +} + +#ifndef HAVE_WRITEV +/* Structure for scatter/gather I/O. */ +struct iovec +{ + void *iov_base; /* Pointer to data. */ + size_t iov_len; /* Length of data. */ +}; +#endif + +static ares_ssize_t ares__socket_write(ares_channel channel, ares_socket_t s, const void * data, size_t len) +{ + if (channel->sock_funcs && channel->sock_funcs->asendv) { + struct iovec vec; + vec.iov_base = (void*)data; + vec.iov_len = len; + return channel->sock_funcs->asendv(s, &vec, 1, channel->sock_func_cb_data); + } + return swrite(s, data, len); } diff --git a/graal-nodejs/deps/cares/src/lib/ares_query.c b/graal-nodejs/deps/cares/src/lib/ares_query.c index 42323bec553..04521d1c850 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_query.c +++ b/graal-nodejs/deps/cares/src/lib/ares_query.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -33,24 +44,6 @@ struct qquery { static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen); -static struct query* find_query_by_id(ares_channel channel, unsigned short id) -{ - unsigned short qid; - struct list_node* list_head; - struct list_node* list_node; - DNS_HEADER_SET_QID(((unsigned char*)&qid), id); - - /* Find the query corresponding to this packet. */ - list_head = &(channel->queries_by_qid[qid % ARES_QID_TABLE_SIZE]); - for (list_node = list_head->next; list_node != list_head; - list_node = list_node->next) - { - struct query *q = list_node->data; - if (q->qid == qid) - return q; - } - return NULL; -} /* a unique query id is generated using an rc4 key. Since the id may already be used by a running query (as infrequent as it may be), a lookup is @@ -63,47 +56,59 @@ static unsigned short generate_unique_id(ares_channel channel) do { id = ares__generate_new_id(channel->rand_state); - } while (find_query_by_id(channel, id)); + } while (ares__htable_stvp_get(channel->queries_by_qid, id, NULL)); return (unsigned short)id; } -void ares_query(ares_channel channel, const char *name, int dnsclass, - int type, ares_callback callback, void *arg) +int ares_query_qid(ares_channel channel, const char *name, + int dnsclass, int type, ares_callback callback, + void *arg, unsigned short *qid) { struct qquery *qquery; unsigned char *qbuf; int qlen, rd, status; + unsigned short id = generate_unique_id(channel); /* Compose the query. */ rd = !(channel->flags & ARES_FLAG_NORECURSE); - status = ares_create_query(name, dnsclass, type, channel->next_id, rd, &qbuf, + status = ares_create_query(name, dnsclass, type, id, rd, &qbuf, &qlen, (channel->flags & ARES_FLAG_EDNS) ? channel->ednspsz : 0); if (status != ARES_SUCCESS) { if (qbuf != NULL) ares_free(qbuf); callback(arg, status, 0, NULL, 0); - return; + return status; } - channel->next_id = generate_unique_id(channel); - /* Allocate and fill in the query structure. */ qquery = ares_malloc(sizeof(struct qquery)); if (!qquery) { ares_free_string(qbuf); callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; + return ARES_ENOMEM; } qquery->callback = callback; qquery->arg = arg; /* Send it off. qcallback will be called when we get an answer. */ - ares_send(channel, qbuf, qlen, qcallback, qquery); + status = ares_send_ex(channel, qbuf, qlen, qcallback, qquery); ares_free_string(qbuf); + + if (status == ARES_SUCCESS && qid) + *qid = id; + + return status; +} + +void ares_query(ares_channel channel, const char *name, int dnsclass, + int type, ares_callback callback, void *arg) +{ + ares_query_qid(channel, name, dnsclass, type, callback, arg, NULL); } + static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen) { struct qquery *qquery = (struct qquery *) arg; diff --git a/graal-nodejs/deps/cares/src/lib/ares_rand.c b/graal-nodejs/deps/cares/src/lib/ares_rand.c index 766c1e6ea9b..99a5a04cff4 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_rand.c +++ b/graal-nodejs/deps/cares/src/lib/ares_rand.c @@ -1,17 +1,27 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2007-2013 by Daniel Stenberg +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) 2023 Brad House + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -20,12 +30,24 @@ #include "ares_nowarn.h" #include +#if !defined(HAVE_ARC4RANDOM_BUF) && !defined(HAVE_GETRANDOM) && !defined(_WIN32) +# define ARES_NEEDS_RC4 1 +#endif + typedef enum { ARES_RAND_OS = 1, /* OS-provided such as RtlGenRandom or arc4random */ ARES_RAND_FILE = 2, /* OS file-backed random number generator */ +#ifdef ARES_NEEDS_RC4 ARES_RAND_RC4 = 3 /* Internal RC4 based PRNG */ +#endif } ares_rand_backend; + +/* Don't build RC4 code if it goes unused as it will generate dead code + * warnings */ +#ifdef ARES_NEEDS_RC4 +# define ARES_RC4_KEY_LEN 32 /* 256 bits */ + typedef struct ares_rand_rc4 { unsigned char S[256]; @@ -33,30 +55,6 @@ typedef struct ares_rand_rc4 size_t j; } ares_rand_rc4; -struct ares_rand_state -{ - ares_rand_backend type; - union { - FILE *rand_file; - ares_rand_rc4 rc4; - } state; -}; - - -/* Define RtlGenRandom = SystemFunction036. This is in advapi32.dll. There is - * no need to dynamically load this, other software used widely does not. - * http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx - * https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom - */ -#ifdef _WIN32 -BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength); -# ifndef RtlGenRandom -# define RtlGenRandom(a,b) SystemFunction036(a,b) -# endif -#endif - - -#define ARES_RC4_KEY_LEN 32 /* 256 bits */ #ifdef _MSC_VER typedef unsigned __int64 cares_u64; @@ -64,6 +62,7 @@ typedef unsigned __int64 cares_u64; typedef unsigned long long cares_u64; #endif + static unsigned int ares_u32_from_ptr(void *addr) { if (sizeof(void *) == 8) { @@ -130,6 +129,7 @@ static void ares_rc4_init(ares_rand_rc4 *rc4_state) rc4_state->j = 0; } + /* Just outputs the key schedule, no need to XOR with any data since we have none */ static void ares_rc4_prng(ares_rand_rc4 *rc4_state, unsigned char *buf, size_t len) { @@ -150,12 +150,47 @@ static void ares_rc4_prng(ares_rand_rc4 *rc4_state, unsigned char *buf, size_t l rc4_state->j = j; } +#endif /* ARES_NEEDS_RC4 */ + + +struct ares_rand_state +{ + ares_rand_backend type; + union { + FILE *rand_file; +#ifdef ARES_NEEDS_RC4 + ares_rand_rc4 rc4; +#endif + } state; + + /* Since except for RC4, random data will likely result in a syscall, lets + * pre-pull 256 bytes at a time. Every query will pull 2 bytes off this so + * that means we should only need a syscall every 128 queries. 256bytes + * appears to be a sweet spot that may be able to be served without + * interruption */ + unsigned char cache[256]; + size_t cache_remaining; +}; + + +/* Define RtlGenRandom = SystemFunction036. This is in advapi32.dll. There is + * no need to dynamically load this, other software used widely does not. + * http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx + * https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom + */ +#ifdef _WIN32 +BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength); +# ifndef RtlGenRandom +# define RtlGenRandom(a,b) SystemFunction036(a,b) +# endif +#endif + static int ares__init_rand_engine(ares_rand_state *state) { memset(state, 0, sizeof(*state)); -#if defined(HAVE_ARC4RANDOM_BUF) || defined(_WIN32) +#if defined(HAVE_ARC4RANDOM_BUF) || defined(HAVE_GETRANDOM) || defined(_WIN32) state->type = ARES_RAND_OS; return 1; #elif defined(CARES_RANDOM_FILE) @@ -168,15 +203,17 @@ static int ares__init_rand_engine(ares_rand_state *state) /* Fall-Thru on failure to RC4 */ #endif +#ifdef ARES_NEEDS_RC4 state->type = ARES_RAND_RC4; ares_rc4_init(&state->state.rc4); /* Currently cannot fail */ return 1; +#endif } -ares_rand_state *ares__init_rand_state() +ares_rand_state *ares__init_rand_state(void) { ares_rand_state *state = NULL; @@ -204,8 +241,10 @@ static void ares__clear_rand_state(ares_rand_state *state) case ARES_RAND_FILE: fclose(state->state.rand_file); break; +#ifdef ARES_NEEDS_RC4 case ARES_RAND_RC4: break; +#endif } } @@ -227,7 +266,8 @@ void ares__destroy_rand_state(ares_rand_state *state) } -static void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len) +static void ares__rand_bytes_fetch(ares_rand_state *state, unsigned char *buf, + size_t len) { while (1) { @@ -241,6 +281,21 @@ static void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t #elif defined(HAVE_ARC4RANDOM_BUF) arc4random_buf(buf, len); return; +#elif defined(HAVE_GETRANDOM) + while (1) { + size_t n = len - bytes_read; + /* getrandom() on Linux always succeeds and is never + * interrupted by a signal when requesting <= 256 bytes. + */ + ssize_t rv = getrandom(buf + bytes_read, n > 256 ? 256 : n, 0); + if (rv <= 0) + continue; /* Just retry. */ + + bytes_read += rv; + if (bytes_read == len) + return; + } + break; #else /* Shouldn't be possible to be here */ break; @@ -258,9 +313,11 @@ static void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t } break; +#ifdef ARES_NEEDS_RC4 case ARES_RAND_RC4: ares_rc4_prng(&state->state.rc4, buf, len); return; +#endif } /* If we didn't return before we got here, that means we had a critical rand @@ -269,6 +326,30 @@ static void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t } } + +void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len) +{ + /* See if we need to refill the cache to serve the request, but if len is + * excessive, we're not going to update our cache or serve from cache */ + if (len > state->cache_remaining && len < sizeof(state->cache)) { + size_t fetch_size = sizeof(state->cache) - state->cache_remaining; + ares__rand_bytes_fetch(state, state->cache, fetch_size); + state->cache_remaining = sizeof(state->cache); + } + + /* Serve from cache */ + if (len <= state->cache_remaining) { + size_t offset = sizeof(state->cache) - state->cache_remaining; + memcpy(buf, state->cache + offset, len); + state->cache_remaining -= len; + return; + } + + /* Serve direct due to excess size of request */ + ares__rand_bytes_fetch(state, buf, len); +} + + unsigned short ares__generate_new_id(ares_rand_state *state) { unsigned short r=0; diff --git a/graal-nodejs/deps/cares/src/lib/ares_search.c b/graal-nodejs/deps/cares/src/lib/ares_search.c index c4b0424f5ba..d72b4c444e3 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_search.c +++ b/graal-nodejs/deps/cares/src/lib/ares_search.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -221,6 +232,11 @@ int ares__cat_domain(const char *name, const char *domain, char **s) return ARES_ENOMEM; memcpy(*s, name, nlen); (*s)[nlen] = '.'; + if (strcmp(domain, ".") == 0) { + /* Avoid appending the root domain to the separator, which would set *s to + an ill-formed value (ending in two consequtive dots). */ + dlen = 0; + } memcpy(*s + nlen + 1, domain, dlen); (*s)[nlen + 1 + dlen] = 0; return ARES_SUCCESS; diff --git a/graal-nodejs/deps/cares/src/lib/ares_send.c b/graal-nodejs/deps/cares/src/lib/ares_send.c index 542cf45f11a..95077967205 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_send.c +++ b/graal-nodejs/deps/cares/src/lib/ares_send.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -26,8 +37,8 @@ #include "ares_dns.h" #include "ares_private.h" -void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, - ares_callback callback, void *arg) +int ares_send_ex(ares_channel channel, const unsigned char *qbuf, int qlen, + ares_callback callback, void *arg) { struct query *query; int i, packetsz; @@ -37,26 +48,28 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, if (qlen < HFIXEDSZ || qlen >= (1 << 16)) { callback(arg, ARES_EBADQUERY, 0, NULL, 0); - return; + return ARES_EBADQUERY; } if (channel->nservers < 1) { callback(arg, ARES_ESERVFAIL, 0, NULL, 0); - return; + return ARES_ESERVFAIL; } /* Allocate space for query and allocated fields. */ query = ares_malloc(sizeof(struct query)); if (!query) { callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; + return ARES_ENOMEM; } + memset(query, 0, sizeof(*query)); + query->channel = channel; query->tcpbuf = ares_malloc(qlen + 2); if (!query->tcpbuf) { ares_free(query); callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; + return ARES_ENOMEM; } query->server_info = ares_malloc(channel->nservers * sizeof(query->server_info[0])); @@ -65,7 +78,7 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, ares_free(query->tcpbuf); ares_free(query); callback(arg, ARES_ENOMEM, 0, NULL, 0); - return; + return ARES_ENOMEM; } /* Compute the query ID. Start with no timeout. */ @@ -109,21 +122,33 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, query->timeouts = 0; /* Initialize our list nodes. */ - ares__init_list_node(&(query->queries_by_qid), query); - ares__init_list_node(&(query->queries_by_timeout), query); - ares__init_list_node(&(query->queries_to_server), query); - ares__init_list_node(&(query->all_queries), query); + query->node_queries_by_timeout = NULL; + query->node_queries_to_conn = NULL; /* Chain the query into the list of all queries. */ - ares__insert_in_list(&(query->all_queries), &(channel->all_queries)); + query->node_all_queries = ares__llist_insert_last(channel->all_queries, query); + if (query->node_all_queries == NULL) { + callback(arg, ARES_ENOMEM, 0, NULL, 0); + ares__free_query(query); + return ARES_ENOMEM; + } + /* Keep track of queries bucketed by qid, so we can process DNS * responses quickly. */ - ares__insert_in_list( - &(query->queries_by_qid), - &(channel->queries_by_qid[query->qid % ARES_QID_TABLE_SIZE])); + if (!ares__htable_stvp_insert(channel->queries_by_qid, query->qid, query)) { + callback(arg, ARES_ENOMEM, 0, NULL, 0); + ares__free_query(query); + return ARES_ENOMEM; + } /* Perform the first query action. */ now = ares__tvnow(); - ares__send_query(channel, query, &now); + return ares__send_query(channel, query, &now); +} + +void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, + ares_callback callback, void *arg) +{ + ares_send_ex(channel, qbuf, qlen, callback, arg); } diff --git a/graal-nodejs/deps/cares/src/lib/ares_setup.h b/graal-nodejs/deps/cares/src/lib/ares_setup.h index 6ad2cee6a8c..b3cf8088507 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_setup.h +++ b/graal-nodejs/deps/cares/src/lib/ares_setup.h @@ -1,19 +1,30 @@ -#ifndef HEADER_CARES_SETUP_H -#define HEADER_CARES_SETUP_H - - -/* Copyright (C) 2004 - 2012 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 2004 Daniel Stenberg * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_SETUP_H +#define HEADER_CARES_SETUP_H /* * Define WIN32 when build target is Win32 API diff --git a/graal-nodejs/deps/cares/src/lib/ares_strcasecmp.c b/graal-nodejs/deps/cares/src/lib/ares_strcasecmp.c index f9c85e20966..e7fd5274045 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_strcasecmp.c +++ b/graal-nodejs/deps/cares/src/lib/ares_strcasecmp.c @@ -1,18 +1,28 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_strcasecmp.h b/graal-nodejs/deps/cares/src/lib/ares_strcasecmp.h index 57d86f96342..31a66be7179 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_strcasecmp.h +++ b/graal-nodejs/deps/cares/src/lib/ares_strcasecmp.h @@ -1,21 +1,31 @@ -#ifndef HEADER_CARES_STRCASECMP_H -#define HEADER_CARES_STRCASECMP_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_STRCASECMP_H +#define HEADER_CARES_STRCASECMP_H #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_strdup.c b/graal-nodejs/deps/cares/src/lib/ares_strdup.c index 39fc8692e75..db5dd1d84b7 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_strdup.c +++ b/graal-nodejs/deps/cares/src/lib/ares_strdup.c @@ -1,18 +1,28 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_strdup.h b/graal-nodejs/deps/cares/src/lib/ares_strdup.h index 67f2a74f5f1..06e8cdccb5f 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_strdup.h +++ b/graal-nodejs/deps/cares/src/lib/ares_strdup.h @@ -1,21 +1,31 @@ -#ifndef HEADER_CARES_STRDUP_H -#define HEADER_CARES_STRDUP_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_STRDUP_H +#define HEADER_CARES_STRDUP_H #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_strerror.c b/graal-nodejs/deps/cares/src/lib/ares_strerror.c index c3ecbd7b43c..7e301ff94f8 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_strerror.c +++ b/graal-nodejs/deps/cares/src/lib/ares_strerror.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_strsplit.c b/graal-nodejs/deps/cares/src/lib/ares_strsplit.c index d3e90c4a8f6..985a02dbbf9 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_strsplit.c +++ b/graal-nodejs/deps/cares/src/lib/ares_strsplit.c @@ -1,16 +1,27 @@ -/* Copyright (C) 2018 by John Schember +/* MIT License * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Copyright (c) 2018 John Schember + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #if defined(__MVS__) diff --git a/graal-nodejs/deps/cares/src/lib/ares_strsplit.h b/graal-nodejs/deps/cares/src/lib/ares_strsplit.h index 009ee51b7b3..d3c258fec0d 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_strsplit.h +++ b/graal-nodejs/deps/cares/src/lib/ares_strsplit.h @@ -1,21 +1,31 @@ +/* MIT License + * + * Copyright (c) 2018 John Schember + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ #ifndef HEADER_CARES_STRSPLIT_H #define HEADER_CARES_STRSPLIT_H -/* Copyright (C) 2018 by John Schember - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - #include "ares_setup.h" /* Split a string on delms skipping empty or duplicate elements. diff --git a/graal-nodejs/deps/cares/src/lib/ares_timeout.c b/graal-nodejs/deps/cares/src/lib/ares_timeout.c index 293e4af0216..7390ef92635 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_timeout.c +++ b/graal-nodejs/deps/cares/src/lib/ares_timeout.c @@ -1,17 +1,28 @@ - -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * 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: * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -30,59 +41,47 @@ static long timeoffset(struct timeval *now, struct timeval *check) (check->tv_usec - now->tv_usec)/1000; } -/* WARNING: Beware that this is linear in the number of outstanding - * requests! You are probably far better off just calling ares_process() - * once per second, rather than calling ares_timeout() to figure out - * when to next call ares_process(). - */ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, struct timeval *tvbuf) { - struct query *query; - struct list_node* list_head; - struct list_node* list_node; - struct timeval now; - struct timeval nextstop; - long offset, min_offset; + struct query *query; + ares__slist_node_t *node; + struct timeval now; + long offset; - /* No queries, no timeout (and no fetch of the current time). */ - if (ares__is_list_empty(&(channel->all_queries))) - return maxtv; + /* 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 */ + } + + query = ares__slist_node_val(node); - /* Find the minimum timeout for the current set of queries. */ now = ares__tvnow(); - min_offset = -1; - list_head = &(channel->all_queries); - for (list_node = list_head->next; list_node != list_head; - list_node = list_node->next) - { - query = list_node->data; - if (query->timeout.tv_sec == 0) - continue; - offset = timeoffset(&now, &query->timeout); - if (offset < 0) - offset = 0; - if (min_offset == -1 || offset < min_offset) - min_offset = offset; - } + offset = timeoffset(&now, &query->timeout); + if (offset < 0) + offset = 0; + if (offset > (long)INT_MAX) + offset = INT_MAX; + + tvbuf->tv_sec = offset / 1000; + tvbuf->tv_usec = (offset % 1000) * 1000; - /* If we found a minimum timeout and it's sooner than the one specified in - * maxtv (if any), return it. Otherwise go with maxtv. - */ - if (min_offset != -1) - { - int ioffset = (min_offset > (long)INT_MAX) ? INT_MAX : (int)min_offset; + if (maxtv == NULL) + return tvbuf; - nextstop.tv_sec = ioffset/1000; - nextstop.tv_usec = (ioffset%1000)*1000; + /* Return the minimum time between maxtv and tvbuf */ - if (!maxtv || ares__timedout(maxtv, &nextstop)) - { - *tvbuf = nextstop; - return tvbuf; - } - } + if (tvbuf->tv_sec > maxtv->tv_sec) + return maxtv; + if (tvbuf->tv_sec < maxtv->tv_sec) + return tvbuf; + + if (tvbuf->tv_usec > maxtv->tv_usec) + return maxtv; - return maxtv; + return tvbuf; } diff --git a/graal-nodejs/deps/cares/src/lib/ares_version.c b/graal-nodejs/deps/cares/src/lib/ares_version.c index 4f8c42f2c9a..b6a62da86d5 100644 --- a/graal-nodejs/deps/cares/src/lib/ares_version.c +++ b/graal-nodejs/deps/cares/src/lib/ares_version.c @@ -1,4 +1,29 @@ - +/* MIT License + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT + */ #include "ares_setup.h" #include "ares.h" diff --git a/graal-nodejs/deps/cares/src/lib/ares_writev.c b/graal-nodejs/deps/cares/src/lib/ares_writev.c deleted file mode 100644 index e812c09e1c5..00000000000 --- a/graal-nodejs/deps/cares/src/lib/ares_writev.c +++ /dev/null @@ -1,79 +0,0 @@ - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_LIMITS_H -# include -#endif - -#include "ares.h" -#include "ares_private.h" - -#ifndef HAVE_WRITEV -ares_ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt) -{ - char *buffer, *bp; - int i; - size_t bytes = 0; - ares_ssize_t result; - - /* Validate iovcnt */ - if (iovcnt <= 0) - { - SET_ERRNO(EINVAL); - return (-1); - } - - /* Validate and find the sum of the iov_len values in the iov array */ - for (i = 0; i < iovcnt; i++) - { - if (iov[i].iov_len > INT_MAX - bytes) - { - SET_ERRNO(EINVAL); - return (-1); - } - bytes += iov[i].iov_len; - } - - if (bytes == 0) - return (0); - - /* Allocate a temporary buffer to hold the data */ - buffer = ares_malloc(bytes); - if (!buffer) - { - SET_ERRNO(ENOMEM); - return (-1); - } - - /* Copy the data into buffer */ - for (bp = buffer, i = 0; i < iovcnt; ++i) - { - memcpy (bp, iov[i].iov_base, iov[i].iov_len); - bp += iov[i].iov_len; - } - - /* Send buffer contents */ - result = swrite(s, buffer, bytes); - - ares_free(buffer); - - return (result); -} -#endif - diff --git a/graal-nodejs/deps/cares/src/lib/ares_writev.h b/graal-nodejs/deps/cares/src/lib/ares_writev.h deleted file mode 100644 index 65cea8708fc..00000000000 --- a/graal-nodejs/deps/cares/src/lib/ares_writev.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef HEADER_CARES_WRITEV_H -#define HEADER_CARES_WRITEV_H - - -/* Copyright 1998 by the Massachusetts Institute of Technology. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" -#include "ares.h" - -#ifndef HAVE_WRITEV - -/* Structure for scatter/gather I/O. */ -struct iovec -{ - void *iov_base; /* Pointer to data. */ - size_t iov_len; /* Length of data. */ -}; - -extern ares_ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt); - -#endif - -#endif /* HEADER_CARES_WRITEV_H */ diff --git a/graal-nodejs/deps/cares/src/lib/bitncmp.c b/graal-nodejs/deps/cares/src/lib/bitncmp.c index 1468d4923a5..5a5a07f8ac0 100644 --- a/graal-nodejs/deps/cares/src/lib/bitncmp.c +++ b/graal-nodejs/deps/cares/src/lib/bitncmp.c @@ -1,4 +1,3 @@ - /* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996,1999 by Internet Software Consortium. @@ -14,6 +13,8 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #ifndef HAVE_BITNCMP diff --git a/graal-nodejs/deps/cares/src/lib/bitncmp.h b/graal-nodejs/deps/cares/src/lib/bitncmp.h index 7b8d66c1662..8e39eb510c3 100644 --- a/graal-nodejs/deps/cares/src/lib/bitncmp.h +++ b/graal-nodejs/deps/cares/src/lib/bitncmp.h @@ -1,21 +1,30 @@ -#ifndef __ARES_BITNCMP_H -#define __ARES_BITNCMP_H - - -/* Copyright (C) 2005, 2013 by Dominick Meglio +/* MIT License + * + * Copyright (c) 2005 Dominick Meglio * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef __ARES_BITNCMP_H +#define __ARES_BITNCMP_H #ifndef HAVE_BITNCMP int ares__bitncmp(const void *l, const void *r, int n); diff --git a/graal-nodejs/deps/cares/src/lib/cares.rc b/graal-nodejs/deps/cares/src/lib/cares.rc index 6360834deaf..9275b0796bf 100644 --- a/graal-nodejs/deps/cares/src/lib/cares.rc +++ b/graal-nodejs/deps/cares/src/lib/cares.rc @@ -1,17 +1,27 @@ - -/* Copyright (C) 2009-2021 by Daniel Stenberg +/* MIT License + * + * Copyright (c) 2009 Daniel Stenberg + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * SPDX-License-Identifier: MIT */ #include diff --git a/graal-nodejs/deps/cares/src/lib/config-dos.h b/graal-nodejs/deps/cares/src/lib/config-dos.h index b241d69a5c6..50b039f5312 100644 --- a/graal-nodejs/deps/cares/src/lib/config-dos.h +++ b/graal-nodejs/deps/cares/src/lib/config-dos.h @@ -2,9 +2,12 @@ #define HEADER_CONFIG_DOS_H -/* ================================================================ */ -/* ares/config-dos.h - Hand crafted config file for DOS */ -/* ================================================================ */ +/* ================================================================ + * ares/config-dos.h - Hand crafted config file for DOS + * + * Copyright (C) The c-ares project and its contributors + * SPDX-License-Identifier: MIT + * ================================================================ */ #define PACKAGE "c-ares" diff --git a/graal-nodejs/deps/cares/src/lib/config-win32.h b/graal-nodejs/deps/cares/src/lib/config-win32.h index cc8e4430a49..fb13fed4c78 100644 --- a/graal-nodejs/deps/cares/src/lib/config-win32.h +++ b/graal-nodejs/deps/cares/src/lib/config-win32.h @@ -1,18 +1,30 @@ -#ifndef HEADER_CARES_CONFIG_WIN32_H -#define HEADER_CARES_CONFIG_WIN32_H - -/* Copyright (C) 2004 - 2011 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 2004 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef HEADER_CARES_CONFIG_WIN32_H +#define HEADER_CARES_CONFIG_WIN32_H /* ================================================================ */ /* c-ares/config-win32.h - Hand crafted config file for Windows */ diff --git a/graal-nodejs/deps/cares/src/lib/inet_net_pton.c b/graal-nodejs/deps/cares/src/lib/inet_net_pton.c index 7130f0f1e22..d3924c3767e 100644 --- a/graal-nodejs/deps/cares/src/lib/inet_net_pton.c +++ b/graal-nodejs/deps/cares/src/lib/inet_net_pton.c @@ -1,4 +1,3 @@ - /* * Copyright (c) 2012 by Gilles Chehade * Copyright (c) 1996,1999 by Internet Software Consortium. @@ -15,6 +14,8 @@ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/lib/inet_ntop.c b/graal-nodejs/deps/cares/src/lib/inet_ntop.c index 6645c0a4679..246d630647b 100644 --- a/graal-nodejs/deps/cares/src/lib/inet_ntop.c +++ b/graal-nodejs/deps/cares/src/lib/inet_ntop.c @@ -13,6 +13,8 @@ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" @@ -84,7 +86,7 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size) static const char fmt[] = "%u.%u.%u.%u"; char tmp[sizeof("255.255.255.255")]; - if ((size_t)sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) >= size) { + if ((size_t)snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]) >= size) { SET_ERRNO(ENOSPC); return (NULL); } @@ -171,7 +173,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size) tp += strlen(tp); break; } - tp += sprintf(tp, "%x", words[i]); + tp += snprintf(tp, sizeof(tmp)-(tp-tmp), "%x", words[i]); } /* Was it a trailing run of 0x00's? */ if (best.base != -1 && (best.base + best.len) == (NS_IN6ADDRSZ / NS_INT16SZ)) diff --git a/graal-nodejs/deps/cares/src/lib/setup_once.h b/graal-nodejs/deps/cares/src/lib/setup_once.h index a8cfe6beccd..f576797de35 100644 --- a/graal-nodejs/deps/cares/src/lib/setup_once.h +++ b/graal-nodejs/deps/cares/src/lib/setup_once.h @@ -1,19 +1,30 @@ -#ifndef __SETUP_ONCE_H -#define __SETUP_ONCE_H - - -/* Copyright (C) 2004 - 2013 by Daniel Stenberg et al +/* MIT License + * + * Copyright (c) 2004 Daniel Stenberg + * + * 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: * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. M.I.T. makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ +#ifndef __SETUP_ONCE_H +#define __SETUP_ONCE_H /******************************************************************** @@ -91,6 +102,10 @@ # endif #endif +#ifdef HAVE_SYS_RANDOM_H +#include +#endif + #ifdef HAVE_SYS_SOCKET_H #include #endif diff --git a/graal-nodejs/deps/cares/src/lib/windows_port.c b/graal-nodejs/deps/cares/src/lib/windows_port.c index 03acd1c1e2b..5977b8493ea 100644 --- a/graal-nodejs/deps/cares/src/lib/windows_port.c +++ b/graal-nodejs/deps/cares/src/lib/windows_port.c @@ -1,3 +1,11 @@ +/********************************************************************** + * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (C) Daniel Stenberg + * + * SPDX-License-Identifier: MIT + * + */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/tools/CMakeLists.txt b/graal-nodejs/deps/cares/src/tools/CMakeLists.txt index 0c44216fcc4..9ee01b47456 100644 --- a/graal-nodejs/deps/cares/src/tools/CMakeLists.txt +++ b/graal-nodejs/deps/cares/src/tools/CMakeLists.txt @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT IF (CARES_BUILD_TOOLS) # Transform Makefile.inc transform_makefile_inc("Makefile.inc" "${PROJECT_BINARY_DIR}/src/tools/Makefile.inc.cmake") @@ -35,21 +37,4 @@ IF (CARES_BUILD_TOOLS) IF (CARES_INSTALL) INSTALL (TARGETS adig COMPONENT Tools ${TARGETS_INST_DEST}) ENDIF () - - - # Build acountry - ADD_EXECUTABLE (acountry acountry.c ${SAMPLESOURCES}) - TARGET_INCLUDE_DIRECTORIES (acountry - PUBLIC "$" - "$" - "$" - "$" - "$" - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}" - ) - TARGET_COMPILE_DEFINITIONS (acountry PRIVATE HAVE_CONFIG_H=1) - TARGET_LINK_LIBRARIES (acountry PRIVATE ${PROJECT_NAME}) - IF (CARES_INSTALL) - INSTALL (TARGETS acountry COMPONENT Tools ${TARGETS_INST_DEST}) - ENDIF () ENDIF () diff --git a/graal-nodejs/deps/cares/src/tools/Makefile.am b/graal-nodejs/deps/cares/src/tools/Makefile.am index 2ea6376f6a5..8ca33a93e01 100644 --- a/graal-nodejs/deps/cares/src/tools/Makefile.am +++ b/graal-nodejs/deps/cares/src/tools/Makefile.am @@ -1,5 +1,7 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 -PROGS = ahost adig acountry +PROGS = ahost adig EXTRA_DIST = CMakeLists.txt Makefile.inc @@ -32,7 +34,3 @@ ahost_CPPFLAGS = $(AM_CPPFLAGS) adig_SOURCES = adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS) adig_CFLAGS = $(AM_CFLAGS) adig_CPPFLAGS = $(AM_CPPFLAGS) - -acountry_SOURCES = acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS) -acountry_CFLAGS = $(AM_CFLAGS) -acountry_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/graal-nodejs/deps/cares/src/tools/Makefile.in b/graal-nodejs/deps/cares/src/tools/Makefile.in index 9e64462d591..048b1e8b0c1 100644 --- a/graal-nodejs/deps/cares/src/tools/Makefile.in +++ b/graal-nodejs/deps/cares/src/tools/Makefile.in @@ -124,43 +124,31 @@ CONFIG_HEADER = $(top_builddir)/src/lib/ares_config.h \ $(top_builddir)/include/ares_build.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__EXEEXT_1 = ahost$(EXEEXT) adig$(EXEEXT) acountry$(EXEEXT) +am__EXEEXT_1 = ahost$(EXEEXT) adig$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am__dirstamp = $(am__leading_dot)dirstamp -am__objects_1 = acountry-ares_getopt.$(OBJEXT) \ - ../lib/acountry-ares_nowarn.$(OBJEXT) \ - ../lib/acountry-ares_strcasecmp.$(OBJEXT) +am__objects_1 = adig-ares_getopt.$(OBJEXT) \ + ../lib/adig-ares_nowarn.$(OBJEXT) \ + ../lib/adig-ares_strcasecmp.$(OBJEXT) am__objects_2 = -am_acountry_OBJECTS = acountry-acountry.$(OBJEXT) $(am__objects_1) \ +am_adig_OBJECTS = adig-adig.$(OBJEXT) $(am__objects_1) \ $(am__objects_2) -acountry_OBJECTS = $(am_acountry_OBJECTS) -acountry_LDADD = $(LDADD) +adig_OBJECTS = $(am_adig_OBJECTS) +adig_LDADD = $(LDADD) am__DEPENDENCIES_1 = -acountry_DEPENDENCIES = $(top_builddir)/src/lib/libcares.la \ +adig_DEPENDENCIES = $(top_builddir)/src/lib/libcares.la \ $(am__DEPENDENCIES_1) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -acountry_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(acountry_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am__objects_3 = adig-ares_getopt.$(OBJEXT) \ - ../lib/adig-ares_nowarn.$(OBJEXT) \ - ../lib/adig-ares_strcasecmp.$(OBJEXT) -am_adig_OBJECTS = adig-adig.$(OBJEXT) $(am__objects_3) \ - $(am__objects_2) -adig_OBJECTS = $(am_adig_OBJECTS) -adig_LDADD = $(LDADD) -adig_DEPENDENCIES = $(top_builddir)/src/lib/libcares.la \ - $(am__DEPENDENCIES_1) adig_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(adig_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am__objects_4 = ahost-ares_getopt.$(OBJEXT) \ +am__objects_3 = ahost-ares_getopt.$(OBJEXT) \ ../lib/ahost-ares_nowarn.$(OBJEXT) \ ../lib/ahost-ares_strcasecmp.$(OBJEXT) -am_ahost_OBJECTS = ahost-ahost.$(OBJEXT) $(am__objects_4) \ +am_ahost_OBJECTS = ahost-ahost.$(OBJEXT) $(am__objects_3) \ $(am__objects_2) ahost_OBJECTS = $(am_ahost_OBJECTS) ahost_LDADD = $(LDADD) @@ -184,16 +172,12 @@ am__v_at_1 = DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ../lib/$(DEPDIR)/acountry-ares_nowarn.Po \ - ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Po \ - ../lib/$(DEPDIR)/adig-ares_nowarn.Po \ +am__depfiles_remade = ../lib/$(DEPDIR)/adig-ares_nowarn.Po \ ../lib/$(DEPDIR)/adig-ares_strcasecmp.Po \ ../lib/$(DEPDIR)/ahost-ares_nowarn.Po \ ../lib/$(DEPDIR)/ahost-ares_strcasecmp.Po \ - ./$(DEPDIR)/acountry-acountry.Po \ - ./$(DEPDIR)/acountry-ares_getopt.Po ./$(DEPDIR)/adig-adig.Po \ - ./$(DEPDIR)/adig-ares_getopt.Po ./$(DEPDIR)/ahost-ahost.Po \ - ./$(DEPDIR)/ahost-ares_getopt.Po + ./$(DEPDIR)/adig-adig.Po ./$(DEPDIR)/adig-ares_getopt.Po \ + ./$(DEPDIR)/ahost-ahost.Po ./$(DEPDIR)/ahost-ares_getopt.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -213,8 +197,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(acountry_SOURCES) $(adig_SOURCES) $(ahost_SOURCES) -DIST_SOURCES = $(acountry_SOURCES) $(adig_SOURCES) $(ahost_SOURCES) +SOURCES = $(adig_SOURCES) $(ahost_SOURCES) +DIST_SOURCES = $(adig_SOURCES) $(ahost_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -386,8 +370,11 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ + +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT AUTOMAKE_OPTIONS = foreign subdir-objects nostdinc 1.9.6 -PROGS = ahost adig acountry +PROGS = ahost adig EXTRA_DIST = CMakeLists.txt Makefile.inc # Specify our include paths here, and do it relative to $(top_srcdir) and @@ -397,6 +384,9 @@ EXTRA_DIST = CMakeLists.txt Makefile.inc AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_builddir)/src/lib \ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib \ $(am__append_1) + +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT SAMPLESOURCES = ares_getopt.c \ ../lib/ares_nowarn.c \ ../lib/ares_strcasecmp.c @@ -415,9 +405,6 @@ ahost_CPPFLAGS = $(AM_CPPFLAGS) adig_SOURCES = adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS) adig_CFLAGS = $(AM_CFLAGS) adig_CPPFLAGS = $(AM_CPPFLAGS) -acountry_SOURCES = acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS) -acountry_CFLAGS = $(AM_CFLAGS) -acountry_CPPFLAGS = $(AM_CPPFLAGS) all: all-am .SUFFIXES: @@ -467,14 +454,6 @@ clean-noinstPROGRAMS: ../lib/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) ../lib/$(DEPDIR) @: > ../lib/$(DEPDIR)/$(am__dirstamp) -../lib/acountry-ares_nowarn.$(OBJEXT): ../lib/$(am__dirstamp) \ - ../lib/$(DEPDIR)/$(am__dirstamp) -../lib/acountry-ares_strcasecmp.$(OBJEXT): ../lib/$(am__dirstamp) \ - ../lib/$(DEPDIR)/$(am__dirstamp) - -acountry$(EXEEXT): $(acountry_OBJECTS) $(acountry_DEPENDENCIES) $(EXTRA_acountry_DEPENDENCIES) - @rm -f acountry$(EXEEXT) - $(AM_V_CCLD)$(acountry_LINK) $(acountry_OBJECTS) $(acountry_LDADD) $(LIBS) ../lib/adig-ares_nowarn.$(OBJEXT): ../lib/$(am__dirstamp) \ ../lib/$(DEPDIR)/$(am__dirstamp) ../lib/adig-ares_strcasecmp.$(OBJEXT): ../lib/$(am__dirstamp) \ @@ -499,14 +478,10 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/acountry-ares_nowarn.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/acountry-ares_strcasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/adig-ares_nowarn.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/adig-ares_strcasecmp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/ahost-ares_nowarn.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@../lib/$(DEPDIR)/ahost-ares_strcasecmp.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acountry-acountry.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acountry-ares_getopt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adig-adig.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adig-ares_getopt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ahost-ahost.Po@am__quote@ # am--include-marker @@ -542,62 +517,6 @@ am--depfiles: $(am__depfiles_remade) @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -acountry-acountry.o: acountry.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -MT acountry-acountry.o -MD -MP -MF $(DEPDIR)/acountry-acountry.Tpo -c -o acountry-acountry.o `test -f 'acountry.c' || echo '$(srcdir)/'`acountry.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/acountry-acountry.Tpo $(DEPDIR)/acountry-acountry.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='acountry.c' object='acountry-acountry.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -c -o acountry-acountry.o `test -f 'acountry.c' || echo '$(srcdir)/'`acountry.c - -acountry-acountry.obj: acountry.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -MT acountry-acountry.obj -MD -MP -MF $(DEPDIR)/acountry-acountry.Tpo -c -o acountry-acountry.obj `if test -f 'acountry.c'; then $(CYGPATH_W) 'acountry.c'; else $(CYGPATH_W) '$(srcdir)/acountry.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/acountry-acountry.Tpo $(DEPDIR)/acountry-acountry.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='acountry.c' object='acountry-acountry.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -c -o acountry-acountry.obj `if test -f 'acountry.c'; then $(CYGPATH_W) 'acountry.c'; else $(CYGPATH_W) '$(srcdir)/acountry.c'; fi` - -acountry-ares_getopt.o: ares_getopt.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -MT acountry-ares_getopt.o -MD -MP -MF $(DEPDIR)/acountry-ares_getopt.Tpo -c -o acountry-ares_getopt.o `test -f 'ares_getopt.c' || echo '$(srcdir)/'`ares_getopt.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/acountry-ares_getopt.Tpo $(DEPDIR)/acountry-ares_getopt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_getopt.c' object='acountry-ares_getopt.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -c -o acountry-ares_getopt.o `test -f 'ares_getopt.c' || echo '$(srcdir)/'`ares_getopt.c - -acountry-ares_getopt.obj: ares_getopt.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -MT acountry-ares_getopt.obj -MD -MP -MF $(DEPDIR)/acountry-ares_getopt.Tpo -c -o acountry-ares_getopt.obj `if test -f 'ares_getopt.c'; then $(CYGPATH_W) 'ares_getopt.c'; else $(CYGPATH_W) '$(srcdir)/ares_getopt.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/acountry-ares_getopt.Tpo $(DEPDIR)/acountry-ares_getopt.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ares_getopt.c' object='acountry-ares_getopt.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -c -o acountry-ares_getopt.obj `if test -f 'ares_getopt.c'; then $(CYGPATH_W) 'ares_getopt.c'; else $(CYGPATH_W) '$(srcdir)/ares_getopt.c'; fi` - -../lib/acountry-ares_nowarn.o: ../lib/ares_nowarn.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -MT ../lib/acountry-ares_nowarn.o -MD -MP -MF ../lib/$(DEPDIR)/acountry-ares_nowarn.Tpo -c -o ../lib/acountry-ares_nowarn.o `test -f '../lib/ares_nowarn.c' || echo '$(srcdir)/'`../lib/ares_nowarn.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ../lib/$(DEPDIR)/acountry-ares_nowarn.Tpo ../lib/$(DEPDIR)/acountry-ares_nowarn.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../lib/ares_nowarn.c' object='../lib/acountry-ares_nowarn.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -c -o ../lib/acountry-ares_nowarn.o `test -f '../lib/ares_nowarn.c' || echo '$(srcdir)/'`../lib/ares_nowarn.c - -../lib/acountry-ares_nowarn.obj: ../lib/ares_nowarn.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -MT ../lib/acountry-ares_nowarn.obj -MD -MP -MF ../lib/$(DEPDIR)/acountry-ares_nowarn.Tpo -c -o ../lib/acountry-ares_nowarn.obj `if test -f '../lib/ares_nowarn.c'; then $(CYGPATH_W) '../lib/ares_nowarn.c'; else $(CYGPATH_W) '$(srcdir)/../lib/ares_nowarn.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ../lib/$(DEPDIR)/acountry-ares_nowarn.Tpo ../lib/$(DEPDIR)/acountry-ares_nowarn.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../lib/ares_nowarn.c' object='../lib/acountry-ares_nowarn.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -c -o ../lib/acountry-ares_nowarn.obj `if test -f '../lib/ares_nowarn.c'; then $(CYGPATH_W) '../lib/ares_nowarn.c'; else $(CYGPATH_W) '$(srcdir)/../lib/ares_nowarn.c'; fi` - -../lib/acountry-ares_strcasecmp.o: ../lib/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -MT ../lib/acountry-ares_strcasecmp.o -MD -MP -MF ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Tpo -c -o ../lib/acountry-ares_strcasecmp.o `test -f '../lib/ares_strcasecmp.c' || echo '$(srcdir)/'`../lib/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Tpo ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../lib/ares_strcasecmp.c' object='../lib/acountry-ares_strcasecmp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -c -o ../lib/acountry-ares_strcasecmp.o `test -f '../lib/ares_strcasecmp.c' || echo '$(srcdir)/'`../lib/ares_strcasecmp.c - -../lib/acountry-ares_strcasecmp.obj: ../lib/ares_strcasecmp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -MT ../lib/acountry-ares_strcasecmp.obj -MD -MP -MF ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Tpo -c -o ../lib/acountry-ares_strcasecmp.obj `if test -f '../lib/ares_strcasecmp.c'; then $(CYGPATH_W) '../lib/ares_strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/../lib/ares_strcasecmp.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Tpo ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='../lib/ares_strcasecmp.c' object='../lib/acountry-ares_strcasecmp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(acountry_CPPFLAGS) $(CPPFLAGS) $(acountry_CFLAGS) $(CFLAGS) -c -o ../lib/acountry-ares_strcasecmp.obj `if test -f '../lib/ares_strcasecmp.c'; then $(CYGPATH_W) '../lib/ares_strcasecmp.c'; else $(CYGPATH_W) '$(srcdir)/../lib/ares_strcasecmp.c'; fi` - adig-adig.o: adig.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(adig_CPPFLAGS) $(CPPFLAGS) $(adig_CFLAGS) $(CFLAGS) -MT adig-adig.o -MD -MP -MF $(DEPDIR)/adig-adig.Tpo -c -o adig-adig.o `test -f 'adig.c' || echo '$(srcdir)/'`adig.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/adig-adig.Tpo $(DEPDIR)/adig-adig.Po @@ -842,14 +761,10 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am - -rm -f ../lib/$(DEPDIR)/acountry-ares_nowarn.Po - -rm -f ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Po - -rm -f ../lib/$(DEPDIR)/adig-ares_nowarn.Po + -rm -f ../lib/$(DEPDIR)/adig-ares_nowarn.Po -rm -f ../lib/$(DEPDIR)/adig-ares_strcasecmp.Po -rm -f ../lib/$(DEPDIR)/ahost-ares_nowarn.Po -rm -f ../lib/$(DEPDIR)/ahost-ares_strcasecmp.Po - -rm -f ./$(DEPDIR)/acountry-acountry.Po - -rm -f ./$(DEPDIR)/acountry-ares_getopt.Po -rm -f ./$(DEPDIR)/adig-adig.Po -rm -f ./$(DEPDIR)/adig-ares_getopt.Po -rm -f ./$(DEPDIR)/ahost-ahost.Po @@ -899,14 +814,10 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ../lib/$(DEPDIR)/acountry-ares_nowarn.Po - -rm -f ../lib/$(DEPDIR)/acountry-ares_strcasecmp.Po - -rm -f ../lib/$(DEPDIR)/adig-ares_nowarn.Po + -rm -f ../lib/$(DEPDIR)/adig-ares_nowarn.Po -rm -f ../lib/$(DEPDIR)/adig-ares_strcasecmp.Po -rm -f ../lib/$(DEPDIR)/ahost-ares_nowarn.Po -rm -f ../lib/$(DEPDIR)/ahost-ares_strcasecmp.Po - -rm -f ./$(DEPDIR)/acountry-acountry.Po - -rm -f ./$(DEPDIR)/acountry-ares_getopt.Po -rm -f ./$(DEPDIR)/adig-adig.Po -rm -f ./$(DEPDIR)/adig-ares_getopt.Po -rm -f ./$(DEPDIR)/ahost-ahost.Po diff --git a/graal-nodejs/deps/cares/src/tools/Makefile.inc b/graal-nodejs/deps/cares/src/tools/Makefile.inc index 7aea8e5f259..4e3850e0e7d 100644 --- a/graal-nodejs/deps/cares/src/tools/Makefile.inc +++ b/graal-nodejs/deps/cares/src/tools/Makefile.inc @@ -1,3 +1,5 @@ +# Copyright (C) The c-ares project and its contributors +# SPDX-License-Identifier: MIT SAMPLESOURCES = ares_getopt.c \ ../lib/ares_nowarn.c \ ../lib/ares_strcasecmp.c diff --git a/graal-nodejs/deps/cares/src/tools/acountry.c b/graal-nodejs/deps/cares/src/tools/acountry.c deleted file mode 100644 index 00a6e67e138..00000000000 --- a/graal-nodejs/deps/cares/src/tools/acountry.c +++ /dev/null @@ -1,655 +0,0 @@ -/* - * - * IP-address/hostname to country converter. - * - * Problem; you want to know where IP a.b.c.d is located. - * - * Use ares_gethostbyname ("d.c.b.a.zz.countries.nerd.dk") - * and get the CNAME (host->h_name). Result will be: - * CNAME = zz.countries.nerd.dk with address 127.0.x.y (ver 1) or - * CNAME = .zz.countries.nerd.dk with address 127.0.x.y (ver 2) - * - * The 2 letter country code is in and the ISO-3166 country - * number is in x.y (number = x*256 + y). Version 2 of the protocol is missing - * the number. - * - * Ref: http://countries.nerd.dk/more.html - * - * Written by G. Vanem 2006, 2007 - * - * NB! This program may not be big-endian aware. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ - -#include "ares_setup.h" - -#ifdef HAVE_STRINGS_H -#include -#endif - -#if defined(WIN32) && !defined(WATT32) - #include -#else - #include - #include - #include -#endif - -#include "ares.h" -#include "ares_getopt.h" -#include "ares_nowarn.h" - -#ifndef HAVE_STRDUP -# include "ares_strdup.h" -# define strdup(ptr) ares_strdup(ptr) -#endif - -#ifndef HAVE_STRCASECMP -# include "ares_strcasecmp.h" -# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2) -#endif - -#ifndef HAVE_STRNCASECMP -# include "ares_strcasecmp.h" -# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n) -#endif - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -/* By using a double cast, we can get rid of the bogus warning of - * warning: cast from 'const struct sockaddr *' to 'const struct sockaddr_in6 *' increases required alignment from 1 to 4 [-Wcast-align] - */ -#define CARES_INADDR_CAST(type, var) ((type)((void *)var)) - -static const char *usage = "acountry [-?hdv] {host|addr} ...\n"; -static const char nerd_fmt[] = "%u.%u.%u.%u.zz.countries.nerd.dk"; -static const char *nerd_ver1 = nerd_fmt + 14; /* .countries.nerd.dk */ -static const char *nerd_ver2 = nerd_fmt + 11; /* .zz.countries.nerd.dk */ -static int verbose = 0; - -#define TRACE(fmt) do { \ - if (verbose > 0) \ - printf fmt ; \ - } WHILE_FALSE - -static void wait_ares(ares_channel channel); -static void callback(void *arg, int status, int timeouts, struct hostent *host); -static void callback2(void *arg, int status, int timeouts, struct hostent *host); -static void find_country_from_cname(const char *cname, struct in_addr addr); -static void print_help_info_acountry(void); - -static void Abort(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - exit(1); -} - -int main(int argc, char **argv) -{ - ares_channel channel; - int ch, status; - -#if defined(WIN32) && !defined(WATT32) - WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK); - WSADATA wsaData; - WSAStartup(wVersionRequested, &wsaData); -#endif - - status = ares_library_init(ARES_LIB_INIT_ALL); - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status)); - return 1; - } - - while ((ch = ares_getopt(argc, argv, "dvh?")) != -1) - switch (ch) - { - case 'd': -#ifdef WATT32 - dbug_init(); -#endif - break; - case 'v': - verbose++; - break; - case 'h': - print_help_info_acountry(); - break; - case '?': - print_help_info_acountry(); - break; - default: - Abort(usage); - } - - argc -= optind; - argv += optind; - if (argc < 1) - Abort(usage); - - status = ares_init(&channel); - if (status != ARES_SUCCESS) - { - fprintf(stderr, "ares_init: %s\n", ares_strerror(status)); - return 1; - } - - /* Initiate the queries, one per command-line argument. */ - for ( ; *argv; argv++) - { - struct in_addr addr; - char *buf; - - /* If this fails, assume '*argv' is a host-name that - * must be resolved first - */ - if (ares_inet_pton(AF_INET, *argv, &addr) != 1) - { - ares_gethostbyname(channel, *argv, AF_INET, callback2, &addr); - wait_ares(channel); - if (addr.s_addr == INADDR_NONE) - { - printf("Failed to lookup %s\n", *argv); - continue; - } - } - - buf = malloc(100); - sprintf(buf, nerd_fmt, - (unsigned int)(addr.s_addr >> 24), - (unsigned int)((addr.s_addr >> 16) & 255), - (unsigned int)((addr.s_addr >> 8) & 255), - (unsigned int)(addr.s_addr & 255)); - TRACE(("Looking up %s...", buf)); - fflush(stdout); - ares_gethostbyname(channel, buf, AF_INET, callback, buf); - } - - wait_ares(channel); - ares_destroy(channel); - - ares_library_cleanup(); - -#if defined(WIN32) && !defined(WATT32) - WSACleanup(); -#endif - - return 0; -} - -/* - * Wait for the queries to complete. - */ -static void wait_ares(ares_channel channel) -{ - for (;;) - { - struct timeval *tvp, tv; - fd_set read_fds, write_fds; - int nfds; - - FD_ZERO(&read_fds); - FD_ZERO(&write_fds); - nfds = ares_fds(channel, &read_fds, &write_fds); - if (nfds == 0) - break; - tvp = ares_timeout(channel, NULL, &tv); - nfds = select(nfds, &read_fds, &write_fds, NULL, tvp); - if (nfds < 0) - continue; - ares_process(channel, &read_fds, &write_fds); - } -} - -/* - * This is the callback used when we have the IP-address of interest. - * Extract the CNAME and figure out the country-code from it. - */ -static void callback(void *arg, int status, int timeouts, struct hostent *host) -{ - const char *name = (const char*)arg; - const char *cname; - char buf[20]; - - (void)timeouts; - - if (!host || status != ARES_SUCCESS) - { - printf("Failed to lookup %s: %s\n", name, ares_strerror(status)); - free(arg); - return; - } - - TRACE(("\nFound address %s, name %s\n", - ares_inet_ntop(AF_INET,(const char*)host->h_addr,buf,sizeof(buf)), - host->h_name)); - - cname = host->h_name; /* CNAME gets put here */ - if (!cname) - printf("Failed to get CNAME for %s\n", name); - else - find_country_from_cname(cname, *(CARES_INADDR_CAST(struct in_addr *, host->h_addr))); - free(arg); -} - -/* - * This is the callback used to obtain the IP-address of the host of interest. - */ -static void callback2(void *arg, int status, int timeouts, struct hostent *host) -{ - struct in_addr *addr = (struct in_addr*) arg; - - (void)timeouts; - if (!host || status != ARES_SUCCESS) - memset(addr, INADDR_NONE, sizeof(*addr)); - else - memcpy(addr, host->h_addr, sizeof(*addr)); -} - -struct search_list { - int country_number; /* ISO-3166 country number */ - char short_name[3]; /* A2 short country code */ - const char *long_name; /* normal country name */ - }; - -static const struct search_list *list_lookup(int number, const struct search_list *list, int num) -{ - while (num > 0 && list->long_name) - { - if (list->country_number == number) - return (list); - num--; - list++; - } - return (NULL); -} - -/* - * Ref: https://en.wikipedia.org/wiki/ISO_3166-1 - */ -static const struct search_list country_list[] = { - { 4, "af", "Afghanistan" }, - { 248, "ax", "Åland Island" }, - { 8, "al", "Albania" }, - { 12, "dz", "Algeria" }, - { 16, "as", "American Samoa" }, - { 20, "ad", "Andorra" }, - { 24, "ao", "Angola" }, - { 660, "ai", "Anguilla" }, - { 10, "aq", "Antarctica" }, - { 28, "ag", "Antigua & Barbuda" }, - { 32, "ar", "Argentina" }, - { 51, "am", "Armenia" }, - { 533, "aw", "Aruba" }, - { 36, "au", "Australia" }, - { 40, "at", "Austria" }, - { 31, "az", "Azerbaijan" }, - { 44, "bs", "Bahamas" }, - { 48, "bh", "Bahrain" }, - { 50, "bd", "Bangladesh" }, - { 52, "bb", "Barbados" }, - { 112, "by", "Belarus" }, - { 56, "be", "Belgium" }, - { 84, "bz", "Belize" }, - { 204, "bj", "Benin" }, - { 60, "bm", "Bermuda" }, - { 64, "bt", "Bhutan" }, - { 68, "bo", "Bolivia" }, - { 535, "bq", "Bonaire, Sint Eustatius and Saba" }, /* Formerly 'Bonaire' / 'Netherlands Antilles' */ - { 70, "ba", "Bosnia & Herzegovina" }, - { 72, "bw", "Botswana" }, - { 74, "bv", "Bouvet Island" }, - { 76, "br", "Brazil" }, - { 86, "io", "British Indian Ocean Territory" }, - { 96, "bn", "Brunei Darussalam" }, - { 100, "bg", "Bulgaria" }, - { 854, "bf", "Burkina Faso" }, - { 108, "bi", "Burundi" }, - { 116, "kh", "Cambodia" }, - { 120, "cm", "Cameroon" }, - { 124, "ca", "Canada" }, - { 132, "cv", "Cape Verde" }, - { 136, "ky", "Cayman Islands" }, - { 140, "cf", "Central African Republic" }, - { 148, "td", "Chad" }, - { 152, "cl", "Chile" }, - { 156, "cn", "China" }, - { 162, "cx", "Christmas Island" }, - { 166, "cc", "Cocos Islands" }, - { 170, "co", "Colombia" }, - { 174, "km", "Comoros" }, - { 178, "cg", "Congo" }, - { 180, "cd", "Congo" }, - { 184, "ck", "Cook Islands" }, - { 188, "cr", "Costa Rica" }, - { 384, "ci", "Cote d'Ivoire" }, - { 191, "hr", "Croatia" }, - { 192, "cu", "Cuba" }, - { 531, "cw", "Curaçao" }, - { 196, "cy", "Cyprus" }, - { 203, "cz", "Czech Republic" }, - { 208, "dk", "Denmark" }, - { 262, "dj", "Djibouti" }, - { 212, "dm", "Dominica" }, - { 214, "do", "Dominican Republic" }, - { 218, "ec", "Ecuador" }, - { 818, "eg", "Egypt" }, - { 222, "sv", "El Salvador" }, - { 226, "gq", "Equatorial Guinea" }, - { 232, "er", "Eritrea" }, - { 233, "ee", "Estonia" }, - { 748, "sz", "Eswatini" }, /* Formerly Swaziland */ - { 231, "et", "Ethiopia" }, - { 65281, "eu", "European Union" }, /* 127.0.255.1 */ - { 238, "fk", "Falkland Islands" }, - { 234, "fo", "Faroe Islands" }, - { 242, "fj", "Fiji" }, - { 246, "fi", "Finland" }, - { 250, "fr", "France" }, - { 249, "fx", "France, Metropolitan" }, - { 254, "gf", "French Guiana" }, - { 258, "pf", "French Polynesia" }, - { 260, "tf", "French Southern Territories" }, - { 266, "ga", "Gabon" }, - { 270, "gm", "Gambia" }, - { 268, "ge", "Georgia" }, - { 276, "de", "Germany" }, - { 288, "gh", "Ghana" }, - { 292, "gi", "Gibraltar" }, - { 300, "gr", "Greece" }, - { 304, "gl", "Greenland" }, - { 308, "gd", "Grenada" }, - { 312, "gp", "Guadeloupe" }, - { 316, "gu", "Guam" }, - { 320, "gt", "Guatemala" }, - { 831, "gg", "Guernsey" }, - { 324, "gn", "Guinea" }, - { 624, "gw", "Guinea-Bissau" }, - { 328, "gy", "Guyana" }, - { 332, "ht", "Haiti" }, - { 334, "hm", "Heard & Mc Donald Islands" }, - { 336, "va", "Holy See" }, /* Vatican City */ - { 340, "hn", "Honduras" }, - { 344, "hk", "Hong kong" }, - { 348, "hu", "Hungary" }, - { 352, "is", "Iceland" }, - { 356, "in", "India" }, - { 360, "id", "Indonesia" }, - { 364, "ir", "Iran" }, - { 368, "iq", "Iraq" }, - { 372, "ie", "Ireland" }, - { 833, "im", "Isle of Man" }, - { 376, "il", "Israel" }, - { 380, "it", "Italy" }, - { 388, "jm", "Jamaica" }, - { 392, "jp", "Japan" }, - { 832, "je", "Jersey" }, - { 400, "jo", "Jordan" }, - { 398, "kz", "Kazakhstan" }, - { 404, "ke", "Kenya" }, - { 296, "ki", "Kiribati" }, - { 408, "kp", "Korea (north)" }, - { 410, "kr", "Korea (south)" }, - { 0, "xk", "Kosovo" }, /* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 */ - { 414, "kw", "Kuwait" }, - { 417, "kg", "Kyrgyzstan" }, - { 418, "la", "Laos" }, - { 428, "lv", "Latvia" }, - { 422, "lb", "Lebanon" }, - { 426, "ls", "Lesotho" }, - { 430, "lr", "Liberia" }, - { 434, "ly", "Libya" }, - { 438, "li", "Liechtenstein" }, - { 440, "lt", "Lithuania" }, - { 442, "lu", "Luxembourg" }, - { 446, "mo", "Macao" }, - { 450, "mg", "Madagascar" }, - { 454, "mw", "Malawi" }, - { 458, "my", "Malaysia" }, - { 462, "mv", "Maldives" }, - { 466, "ml", "Mali" }, - { 470, "mt", "Malta" }, - { 584, "mh", "Marshall Islands" }, - { 474, "mq", "Martinique" }, - { 478, "mr", "Mauritania" }, - { 480, "mu", "Mauritius" }, - { 175, "yt", "Mayotte" }, - { 484, "mx", "Mexico" }, - { 583, "fm", "Micronesia" }, - { 498, "md", "Moldova" }, - { 492, "mc", "Monaco" }, - { 496, "mn", "Mongolia" }, - { 499, "me", "Montenegro" }, - { 500, "ms", "Montserrat" }, - { 504, "ma", "Morocco" }, - { 508, "mz", "Mozambique" }, - { 104, "mm", "Myanmar" }, - { 516, "na", "Namibia" }, - { 520, "nr", "Nauru" }, - { 524, "np", "Nepal" }, - { 528, "nl", "Netherlands" }, - { 540, "nc", "New Caledonia" }, - { 554, "nz", "New Zealand" }, - { 558, "ni", "Nicaragua" }, - { 562, "ne", "Niger" }, - { 566, "ng", "Nigeria" }, - { 570, "nu", "Niue" }, - { 574, "nf", "Norfolk Island" }, - { 807, "mk", "North Macedonia" }, /* 'Macedonia' until February 2019 */ - { 580, "mp", "Northern Mariana Islands" }, - { 578, "no", "Norway" }, - { 512, "om", "Oman" }, - { 586, "pk", "Pakistan" }, - { 585, "pw", "Palau" }, - { 275, "ps", "Palestinian Territory" }, - { 591, "pa", "Panama" }, - { 598, "pg", "Papua New Guinea" }, - { 600, "py", "Paraguay" }, - { 604, "pe", "Peru" }, - { 608, "ph", "Philippines" }, - { 612, "pn", "Pitcairn" }, - { 616, "pl", "Poland" }, - { 620, "pt", "Portugal" }, - { 630, "pr", "Puerto Rico" }, - { 634, "qa", "Qatar" }, - { 638, "re", "Reunion" }, - { 642, "ro", "Romania" }, - { 643, "ru", "Russian Federation" }, - { 646, "rw", "Rwanda" }, - { 0, "bl", "Saint Barthélemy" }, /* https://en.wikipedia.org/wiki/ISO_3166-2:BL */ - { 659, "kn", "Saint Kitts & Nevis" }, - { 662, "lc", "Saint Lucia" }, - { 663, "mf", "Saint Martin" }, - { 670, "vc", "Saint Vincent" }, - { 882, "ws", "Samoa" }, - { 674, "sm", "San Marino" }, - { 678, "st", "Sao Tome & Principe" }, - { 682, "sa", "Saudi Arabia" }, - { 686, "sn", "Senegal" }, - { 688, "rs", "Serbia" }, - { 690, "sc", "Seychelles" }, - { 694, "sl", "Sierra Leone" }, - { 702, "sg", "Singapore" }, - { 534, "sx", "Sint Maarten" }, - { 703, "sk", "Slovakia" }, - { 705, "si", "Slovenia" }, - { 90, "sb", "Solomon Islands" }, - { 706, "so", "Somalia" }, - { 710, "za", "South Africa" }, - { 239, "gs", "South Georgia & South Sandwich Is." }, - { 728, "ss", "South Sudan" }, - { 724, "es", "Spain" }, - { 144, "lk", "Sri Lanka" }, - { 654, "sh", "St. Helena" }, - { 666, "pm", "St. Pierre & Miquelon" }, - { 736, "sd", "Sudan" }, - { 740, "sr", "Suriname" }, - { 744, "sj", "Svalbard & Jan Mayen Islands" }, - { 752, "se", "Sweden" }, - { 756, "ch", "Switzerland" }, - { 760, "sy", "Syrian Arab Republic" }, - { 158, "tw", "Taiwan" }, - { 762, "tj", "Tajikistan" }, - { 834, "tz", "Tanzania" }, - { 764, "th", "Thailand" }, - { 626, "tl", "Timor-Leste" }, - { 768, "tg", "Togo" }, - { 772, "tk", "Tokelau" }, - { 776, "to", "Tonga" }, - { 780, "tt", "Trinidad & Tobago" }, - { 788, "tn", "Tunisia" }, - { 792, "tr", "Turkey" }, - { 795, "tm", "Turkmenistan" }, - { 796, "tc", "Turks & Caicos Islands" }, - { 798, "tv", "Tuvalu" }, - { 800, "ug", "Uganda" }, - { 804, "ua", "Ukraine" }, - { 784, "ae", "United Arab Emirates" }, - { 826, "gb", "United Kingdom" }, - { 840, "us", "United States" }, - { 581, "um", "United States Minor Outlying Islands" }, - { 858, "uy", "Uruguay" }, - { 860, "uz", "Uzbekistan" }, - { 548, "vu", "Vanuatu" }, - { 862, "ve", "Venezuela" }, - { 704, "vn", "Vietnam" }, - { 92, "vg", "Virgin Islands (British)" }, - { 850, "vi", "Virgin Islands (US)" }, - { 876, "wf", "Wallis & Futuna Islands" }, - { 732, "eh", "Western Sahara" }, - { 887, "ye", "Yemen" }, - { 894, "zm", "Zambia" }, - { 716, "zw", "Zimbabwe" } - }; - -/* - * Check if start of 'str' is simply an IPv4 address. - */ -#define BYTE_OK(x) ((x) >= 0 && (x) <= 255) - -static int is_addr(char *str, char **end) -{ - int a0, a1, a2, a3, num, rc = 0, length = 0; - - num = sscanf(str,"%3d.%3d.%3d.%3d%n",&a0,&a1,&a2,&a3,&length); - if( (num == 4) && - BYTE_OK(a0) && BYTE_OK(a1) && BYTE_OK(a2) && BYTE_OK(a3) && - length >= (3+4)) - { - rc = 1; - *end = str + length; - } - return rc; -} - -/* - * Find the country-code and name from the CNAME. E.g.: - * version 1: CNAME = zzno.countries.nerd.dk with address 127.0.2.66 - * yields ccode_A" = "no" and cnumber 578 (2.66). - * version 2: CNAME = .zz.countries.nerd.dk with address 127.0.2.66 - * yields cnumber 578 (2.66). ccode_A is ""; - */ -static void find_country_from_cname(const char *cname, struct in_addr addr) -{ - const struct search_list *country; - char ccode_A2[3], *ccopy, *dot_4; - int cnumber, z0, z1, ver_1, ver_2; - unsigned long ip; - - ip = ntohl(addr.s_addr); - z0 = TOLOWER(cname[0]); - z1 = TOLOWER(cname[1]); - ccopy = strdup(cname); - dot_4 = NULL; - - ver_1 = (z0 == 'z' && z1 == 'z' && !strcasecmp(cname+4,nerd_ver1)); - ver_2 = (is_addr(ccopy,&dot_4) && !strcasecmp(dot_4,nerd_ver2)); - - if (ver_1) - { - const char *dot = strchr(cname, '.'); - if (dot != cname+4) - { - printf("Unexpected CNAME %s (ver_1)\n", cname); - free(ccopy); - return; - } - } - else if (ver_2) - { - z0 = TOLOWER(dot_4[1]); - z1 = TOLOWER(dot_4[2]); - if (z0 != 'z' && z1 != 'z') - { - printf("Unexpected CNAME %s (ver_2)\n", cname); - free(ccopy); - return; - } - } - else - { - printf("Unexpected CNAME %s (ver?)\n", cname); - free(ccopy); - return; - } - - if (ver_1) - { - ccode_A2[0] = (char)TOLOWER(cname[2]); - ccode_A2[1] = (char)TOLOWER(cname[3]); - ccode_A2[2] = '\0'; - } - else - ccode_A2[0] = '\0'; - - cnumber = ip & 0xFFFF; - - TRACE(("Found country-code `%s', number %d\n", - ver_1 ? ccode_A2 : "", cnumber)); - - country = list_lookup(cnumber, country_list, - sizeof(country_list) / sizeof(country_list[0])); - if (!country) - printf("Name for country-number %d not found.\n", cnumber); - else - { - if (ver_1) - { - if ((country->short_name[0] != ccode_A2[0]) || - (country->short_name[1] != ccode_A2[1]) || - (country->short_name[2] != ccode_A2[2])) - printf("short-name mismatch; %s vs %s\n", - country->short_name, ccode_A2); - } - printf("%s (%s), number %d.\n", - country->long_name, country->short_name, cnumber); - } - free(ccopy); -} - -/* Information from the man page. Formatting taken from man -h */ -static void print_help_info_acountry(void) { - printf("acountry, version %s\n\n", ARES_VERSION_STR); - printf("usage: acountry [-hdv] host|addr ...\n\n" - " h : Display this help and exit.\n" - " d : Print some extra debugging output.\n" - " v : Be more verbose. Print extra information.\n\n"); - exit(0); -} diff --git a/graal-nodejs/deps/cares/src/tools/adig.c b/graal-nodejs/deps/cares/src/tools/adig.c index cf5bd4d3f2f..28d55ac351e 100644 --- a/graal-nodejs/deps/cares/src/tools/adig.c +++ b/graal-nodejs/deps/cares/src/tools/adig.c @@ -1,17 +1,28 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/tools/ahost.c b/graal-nodejs/deps/cares/src/tools/ahost.c index 8ac2106698b..f8a39eb4630 100644 --- a/graal-nodejs/deps/cares/src/tools/ahost.c +++ b/graal-nodejs/deps/cares/src/tools/ahost.c @@ -1,17 +1,28 @@ -/* Copyright 1998 by the Massachusetts Institute of Technology. +/* MIT License * + * Copyright (c) 1998 Massachusetts Institute of Technology + * Copyright (c) The c-ares project and its contributors * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation, and that the name of M.I.T. not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * SPDX-License-Identifier: MIT */ #include "ares_setup.h" diff --git a/graal-nodejs/deps/cares/src/tools/ares_getopt.c b/graal-nodejs/deps/cares/src/tools/ares_getopt.c index 1e02d086866..f7154398aea 100644 --- a/graal-nodejs/deps/cares/src/tools/ares_getopt.c +++ b/graal-nodejs/deps/cares/src/tools/ares_getopt.c @@ -36,6 +36,8 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. + * + * SPDX-License-Identifier: BSD-3-Clause */ /* #if !defined(lint) diff --git a/graal-nodejs/deps/cares/src/tools/ares_getopt.h b/graal-nodejs/deps/cares/src/tools/ares_getopt.h index 63acb3b4232..7f06e7e09a8 100644 --- a/graal-nodejs/deps/cares/src/tools/ares_getopt.h +++ b/graal-nodejs/deps/cares/src/tools/ares_getopt.h @@ -28,6 +28,8 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. + * + * SPDX-License-Identifier: BSD-3-Clause */ diff --git a/graal-nodejs/doc/contributing/maintaining/maintaining-dependencies.md b/graal-nodejs/doc/contributing/maintaining/maintaining-dependencies.md index dbebd2c3666..90ed71eb028 100644 --- a/graal-nodejs/doc/contributing/maintaining/maintaining-dependencies.md +++ b/graal-nodejs/doc/contributing/maintaining/maintaining-dependencies.md @@ -12,7 +12,7 @@ This a list of all the dependencies: * [ada 2.7.2][] * [base64][] * [brotli][] -* [c-ares][] +* [c-ares 1.20.0][] * [cjs-module-lexer][] * [corepack][] * [googletest][] @@ -165,7 +165,7 @@ length-delimited strings. The [brotli](https://github.com/google/brotli) dependency is used for the homonym generic-purpose lossless compression algorithm. -### c-ares +### c-ares 1.20.0 The [c-ares](https://github.com/c-ares/c-ares) is a C library for asynchronous DNS requests. @@ -315,7 +315,7 @@ performance improvements not currently available in standard zlib. [ada 2.7.2]: #ada-272 [base64]: #base64 [brotli]: #brotli -[c-ares]: #c-ares +[c-ares 1.20.0]: #c-ares-1200 [cjs-module-lexer]: #cjs-module-lexer [corepack]: #corepack [dependency-update-action]: ../../../.github/workflows/tools.yml