diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-17 23:09:13 +0300 |
---|---|---|
committer | shadchin <shadchin@yandex-team.ru> | 2022-02-17 23:09:13 +0300 |
commit | 1e12ad07b2ad2362e06100f7f32e772e628bef66 (patch) | |
tree | 9981af0beb469cfef0d3d1658040f6bbf4206313 | |
parent | 55c6ad7179b9300375e9a16a3956dc706fcb560b (diff) | |
download | ydb-1e12ad07b2ad2362e06100f7f32e772e628bef66.tar.gz |
Update c-ares from 0.16.1 to 0.17.2
MAKEAYAMLHAPPY-12345
ref:6a83ac3af883b2fc963128b7993f0a467b0000cb
-rw-r--r-- | contrib/libs/c-ares/.yandex_meta/devtools.copyrights.report | 237 | ||||
-rw-r--r-- | contrib/libs/c-ares/.yandex_meta/devtools.licenses.report | 173 | ||||
-rw-r--r-- | contrib/libs/c-ares/.yandex_meta/licenses.list.txt | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/CHANGES | 723 | ||||
-rw-r--r-- | contrib/libs/c-ares/CONTRIBUTING.md | 15 | ||||
-rw-r--r-- | contrib/libs/c-ares/INSTALL.md | 6 | ||||
-rw-r--r-- | contrib/libs/c-ares/README.msvc | 44 | ||||
-rw-r--r-- | contrib/libs/c-ares/RELEASE-NOTES | 93 | ||||
-rw-r--r-- | contrib/libs/c-ares/RELEASE-PROCEDURE.md | 53 | ||||
-rw-r--r-- | contrib/libs/c-ares/SECURITY.md | 100 | ||||
-rw-r--r-- | contrib/libs/c-ares/acountry/ya.make | 14 | ||||
-rw-r--r-- | contrib/libs/c-ares/adig/ya.make | 14 | ||||
-rw-r--r-- | contrib/libs/c-ares/ahost/ya.make | 14 | ||||
-rw-r--r-- | contrib/libs/c-ares/ares_build.h | 211 | ||||
-rw-r--r-- | contrib/libs/c-ares/config-dos.h | 108 | ||||
-rw-r--r-- | contrib/libs/c-ares/include/ares.h (renamed from contrib/libs/c-ares/ares.h) | 15 | ||||
-rw-r--r-- | contrib/libs/c-ares/include/ares_build.h | 115 | ||||
-rw-r--r-- | contrib/libs/c-ares/include/ares_dns.h (renamed from contrib/libs/c-ares/ares_dns.h) | 9 | ||||
-rw-r--r-- | contrib/libs/c-ares/include/ares_rules.h (renamed from contrib/libs/c-ares/ares_rules.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/include/ares_version.h (renamed from contrib/libs/c-ares/ares_version.h) | 6 | ||||
-rw-r--r-- | contrib/libs/c-ares/nameser.h | 211 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares__close_sockets.c (renamed from contrib/libs/c-ares/ares__close_sockets.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares__get_hostent.c (renamed from contrib/libs/c-ares/ares__get_hostent.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares__parse_into_addrinfo.c (renamed from contrib/libs/c-ares/ares__parse_into_addrinfo.c) | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares__read_line.c (renamed from contrib/libs/c-ares/ares__read_line.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares__readaddrinfo.c (renamed from contrib/libs/c-ares/ares__readaddrinfo.c) | 8 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares__sortaddrinfo.c (renamed from contrib/libs/c-ares/ares__sortaddrinfo.c) | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares__timeval.c (renamed from contrib/libs/c-ares/ares__timeval.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_android.c (renamed from contrib/libs/c-ares/ares_android.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_android.h (renamed from contrib/libs/c-ares/ares_android.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_cancel.c (renamed from contrib/libs/c-ares/ares_cancel.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_config-android.h | 6 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_config-linux.h (renamed from contrib/libs/c-ares/ares_config.h) | 101 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_config-osx.h | 5 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_config.h | 9 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_create_query.c (renamed from contrib/libs/c-ares/ares_create_query.c) | 17 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_data.c (renamed from contrib/libs/c-ares/ares_data.c) | 18 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_data.h (renamed from contrib/libs/c-ares/ares_data.h) | 2 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_destroy.c (renamed from contrib/libs/c-ares/ares_destroy.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_expand_name.c (renamed from contrib/libs/c-ares/ares_expand_name.c) | 137 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_expand_string.c (renamed from contrib/libs/c-ares/ares_expand_string.c) | 7 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_fds.c (renamed from contrib/libs/c-ares/ares_fds.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_free_hostent.c (renamed from contrib/libs/c-ares/ares_free_hostent.c) | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_free_string.c (renamed from contrib/libs/c-ares/ares_free_string.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_freeaddrinfo.c (renamed from contrib/libs/c-ares/ares_freeaddrinfo.c) | 2 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_getaddrinfo.c (renamed from contrib/libs/c-ares/ares_getaddrinfo.c) | 35 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_getenv.c (renamed from contrib/libs/c-ares/ares_getenv.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_getenv.h (renamed from contrib/libs/c-ares/ares_getenv.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_gethostbyaddr.c (renamed from contrib/libs/c-ares/ares_gethostbyaddr.c) | 11 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_gethostbyname.c (renamed from contrib/libs/c-ares/ares_gethostbyname.c) | 25 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_getnameinfo.c (renamed from contrib/libs/c-ares/ares_getnameinfo.c) | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_getsock.c (renamed from contrib/libs/c-ares/ares_getsock.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_inet_net_pton.h (renamed from contrib/libs/c-ares/ares_inet_net_pton.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_init.c (renamed from contrib/libs/c-ares/ares_init.c) | 104 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_iphlpapi.h (renamed from contrib/libs/c-ares/ares_iphlpapi.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_ipv6.h (renamed from contrib/libs/c-ares/ares_ipv6.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_library_init.c (renamed from contrib/libs/c-ares/ares_library_init.c) | 9 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_library_init.h (renamed from contrib/libs/c-ares/ares_library_init.h) | 2 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_llist.c (renamed from contrib/libs/c-ares/ares_llist.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_llist.h (renamed from contrib/libs/c-ares/ares_llist.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_mkquery.c (renamed from contrib/libs/c-ares/ares_mkquery.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_nameser.h | 482 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_nowarn.c (renamed from contrib/libs/c-ares/ares_nowarn.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_nowarn.h (renamed from contrib/libs/c-ares/ares_nowarn.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_options.c (renamed from contrib/libs/c-ares/ares_options.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_a_reply.c (renamed from contrib/libs/c-ares/ares_parse_a_reply.c) | 17 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_aaaa_reply.c (renamed from contrib/libs/c-ares/ares_parse_aaaa_reply.c) | 17 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_caa_reply.c | 199 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_mx_reply.c (renamed from contrib/libs/c-ares/ares_parse_mx_reply.c) | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_naptr_reply.c (renamed from contrib/libs/c-ares/ares_parse_naptr_reply.c) | 15 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_ns_reply.c (renamed from contrib/libs/c-ares/ares_parse_ns_reply.c) | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_ptr_reply.c (renamed from contrib/libs/c-ares/ares_parse_ptr_reply.c) | 99 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_soa_reply.c (renamed from contrib/libs/c-ares/ares_parse_soa_reply.c) | 27 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_srv_reply.c (renamed from contrib/libs/c-ares/ares_parse_srv_reply.c) | 15 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_parse_txt_reply.c (renamed from contrib/libs/c-ares/ares_parse_txt_reply.c) | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_platform.c (renamed from contrib/libs/c-ares/ares_platform.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_platform.h (renamed from contrib/libs/c-ares/ares_platform.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_private.h (renamed from contrib/libs/c-ares/ares_private.h) | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_process.c (renamed from contrib/libs/c-ares/ares_process.c) | 97 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_query.c (renamed from contrib/libs/c-ares/ares_query.c) | 12 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_search.c (renamed from contrib/libs/c-ares/ares_search.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_send.c (renamed from contrib/libs/c-ares/ares_send.c) | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_setup.h (renamed from contrib/libs/c-ares/ares_setup.h) | 5 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_strcasecmp.c (renamed from contrib/libs/c-ares/ares_strcasecmp.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_strcasecmp.h (renamed from contrib/libs/c-ares/ares_strcasecmp.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_strdup.c (renamed from contrib/libs/c-ares/ares_strdup.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_strdup.h (renamed from contrib/libs/c-ares/ares_strdup.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_strerror.c (renamed from contrib/libs/c-ares/ares_strerror.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_strsplit.c (renamed from contrib/libs/c-ares/ares_strsplit.c) | 4 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_strsplit.h (renamed from contrib/libs/c-ares/ares_strsplit.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_timeout.c (renamed from contrib/libs/c-ares/ares_timeout.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_version.c (renamed from contrib/libs/c-ares/ares_version.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_writev.c (renamed from contrib/libs/c-ares/ares_writev.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/ares_writev.h (renamed from contrib/libs/c-ares/ares_writev.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/atomic.cpp (renamed from contrib/libs/c-ares/atomic.cpp) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/atomic.h (renamed from contrib/libs/c-ares/atomic.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/bitncmp.c (renamed from contrib/libs/c-ares/bitncmp.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/bitncmp.h (renamed from contrib/libs/c-ares/bitncmp.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/config-win32.h (renamed from contrib/libs/c-ares/config-win32.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/inet_net_pton.c (renamed from contrib/libs/c-ares/inet_net_pton.c) | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/inet_ntop.c (renamed from contrib/libs/c-ares/inet_ntop.c) | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/setup_once.h (renamed from contrib/libs/c-ares/setup_once.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/lib/windows_port.c (renamed from contrib/libs/c-ares/windows_port.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/tools/acountry.c (renamed from contrib/libs/c-ares/acountry.c) | 46 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/tools/adig.c (renamed from contrib/libs/c-ares/adig.c) | 217 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/tools/ahost.c (renamed from contrib/libs/c-ares/ahost.c) | 27 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/tools/ares_getopt.c (renamed from contrib/libs/c-ares/ares_getopt.c) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/src/tools/ares_getopt.h (renamed from contrib/libs/c-ares/ares_getopt.h) | 0 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/README.md | 153 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-live.cc | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-misc.cc | 32 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-mock-ai.cc | 262 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-mock.cc | 332 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-a.cc | 32 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-aaaa.cc | 20 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-caa.cc | 113 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-mx.cc | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-naptr.cc | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-ns.cc | 18 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-ptr.cc | 26 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-soa-any.cc | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-soa.cc | 16 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-srv.cc | 24 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse-txt.cc | 18 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test-parse.cc | 5 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test.cc | 54 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ares-test.h | 10 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/dns-proto-test.cc | 8 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/dns-proto.cc | 184 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/dns-proto.h | 60 | ||||
-rw-r--r-- | contrib/libs/c-ares/test/ya.make | 11 | ||||
-rw-r--r-- | contrib/libs/c-ares/ya.make | 135 | ||||
-rw-r--r-- | contrib/libs/curl/ya.make | 2 | ||||
-rw-r--r-- | contrib/libs/grpc/grpc/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/actors/dnscachelib/dnscache.cpp | 2 | ||||
-rw-r--r-- | library/cpp/actors/dnscachelib/dnscache.h | 2 | ||||
-rw-r--r-- | library/cpp/actors/dnsresolver/ut/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/actors/dnsresolver/ya.make | 2 |
138 files changed, 3534 insertions, 2137 deletions
diff --git a/contrib/libs/c-ares/.yandex_meta/devtools.copyrights.report b/contrib/libs/c-ares/.yandex_meta/devtools.copyrights.report index 6bdabafb4e..5c5423f831 100644 --- a/contrib/libs/c-ares/.yandex_meta/devtools.copyrights.report +++ b/contrib/libs/c-ares/.yandex_meta/devtools.copyrights.report @@ -38,7 +38,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares__timeval.c [2:2] + src/lib/ares__timeval.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 10b55a7cc97df49af59c0048d4bde011 BELONGS ya.make @@ -49,7 +49,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - setup_once.h [5:5] + src/lib/setup_once.h [5:5] KEEP COPYRIGHT_SERVICE_LABEL 11cb9c51a7d25a6cf94b8ab8e8b0ebca BELONGS ya.make @@ -60,7 +60,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_cancel.c [2:2] + src/lib/ares_cancel.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 169a51bc2a181587c3cadfcf8c1d7365 BELONGS ya.make @@ -72,8 +72,8 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - bitncmp.c [3:4] - inet_net_pton.c [3:4] + src/lib/bitncmp.c [3:4] + src/lib/inet_net_pton.c [3:4] KEEP COPYRIGHT_SERVICE_LABEL 197bc139b0875c9ed5c9a13d6b10277d BELONGS ya.make @@ -85,7 +85,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_parse_soa_reply.c [2:3] + src/lib/ares_parse_soa_reply.c [2:3] KEEP COPYRIGHT_SERVICE_LABEL 1df92f5df82e664143819a7cb7c5f4f9 BELONGS ya.make @@ -96,8 +96,8 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_strsplit.c [1:1] - ares_strsplit.h [4:4] + src/lib/ares_strsplit.c [1:1] + src/lib/ares_strsplit.h [4:4] KEEP COPYRIGHT_SERVICE_LABEL 2137ea611b92d236da2a5d451d33b93c BELONGS ya.make @@ -109,8 +109,8 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares.h [2:3] - ares_init.c [2:3] + include/ares.h [2:3] + src/lib/ares_init.c [2:3] KEEP COPYRIGHT_SERVICE_LABEL 262113e46b31087a933d5d22436ca7d9 BELONGS ya.make @@ -121,64 +121,64 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_nowarn.c [2:2] + src/lib/ares_nowarn.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 273212e34b861a3a897a3b3d79010d78 BELONGS ya.make License text: - /* Copyright 1998 by the Massachusetts Institute of Technology. + Copyright 1998 by the Massachusetts Institute of Technology. Scancode info: Original SPDX id: COPYRIGHT_SERVICE_LABEL Score : 100.00 Match type : COPYRIGHT Files with this license: LICENSE.md [6:6] - adig.c [1:1] - ahost.c [1:1] - ares.h [2:3] - ares__close_sockets.c [2:2] - ares__read_line.c [2:2] - ares_create_query.c [2:2] - ares_destroy.c [2:3] - ares_expand_string.c [2:2] - ares_fds.c [2:2] - ares_free_hostent.c [2:2] - ares_freeaddrinfo.c [2:3] - ares_getenv.c [3:3] - ares_getenv.h [5:5] - ares_gethostbyaddr.c [2:2] - ares_init.c [2:3] - ares_iphlpapi.h [4:5] - ares_library_init.c [2:3] - ares_library_init.h [5:6] - ares_llist.c [2:2] - ares_llist.h [5:5] - ares_mkquery.c [2:2] - ares_options.c [2:3] - ares_parse_a_reply.c [2:3] - ares_parse_aaaa_reply.c [2:4] - ares_parse_mx_reply.c [2:3] - ares_parse_naptr_reply.c [2:3] - ares_parse_ns_reply.c [1:1] - ares_parse_ptr_reply.c [2:2] - ares_parse_soa_reply.c [2:3] - ares_parse_srv_reply.c [2:3] - ares_parse_txt_reply.c [2:3] - ares_platform.c [3:4] - ares_platform.h [5:6] - ares_private.h [5:6] - ares_process.c [2:3] - ares_query.c [2:2] - ares_search.c [2:2] - ares_send.c [2:2] - ares_strcasecmp.c [3:3] - ares_strcasecmp.h [5:5] - ares_strdup.c [3:3] - ares_strdup.h [5:5] - ares_strerror.c [2:2] - ares_timeout.c [2:2] - ares_writev.c [3:3] - ares_writev.h [5:5] + include/ares.h [2:3] + src/lib/ares__close_sockets.c [2:2] + src/lib/ares__read_line.c [2:2] + src/lib/ares_create_query.c [2:2] + src/lib/ares_destroy.c [2:3] + src/lib/ares_expand_string.c [2:2] + src/lib/ares_fds.c [2:2] + src/lib/ares_free_hostent.c [2:2] + src/lib/ares_freeaddrinfo.c [2:3] + src/lib/ares_getenv.c [3:3] + src/lib/ares_getenv.h [5:5] + src/lib/ares_gethostbyaddr.c [2:2] + src/lib/ares_init.c [2:3] + src/lib/ares_iphlpapi.h [4:5] + src/lib/ares_library_init.c [2:3] + src/lib/ares_library_init.h [5:6] + src/lib/ares_llist.c [2:2] + src/lib/ares_llist.h [5:5] + src/lib/ares_mkquery.c [2:2] + src/lib/ares_options.c [2:3] + src/lib/ares_parse_a_reply.c [2:3] + src/lib/ares_parse_aaaa_reply.c [2:4] + src/lib/ares_parse_mx_reply.c [2:3] + src/lib/ares_parse_naptr_reply.c [2:3] + src/lib/ares_parse_ns_reply.c [1:1] + src/lib/ares_parse_ptr_reply.c [2:2] + src/lib/ares_parse_soa_reply.c [2:3] + src/lib/ares_parse_srv_reply.c [2:3] + src/lib/ares_parse_txt_reply.c [2:3] + src/lib/ares_platform.c [3:4] + src/lib/ares_platform.h [5:6] + src/lib/ares_private.h [5:6] + src/lib/ares_process.c [2:3] + src/lib/ares_query.c [2:2] + src/lib/ares_search.c [2:2] + src/lib/ares_send.c [2:2] + src/lib/ares_strcasecmp.c [3:3] + src/lib/ares_strcasecmp.h [5:5] + src/lib/ares_strdup.c [3:3] + src/lib/ares_strdup.h [5:5] + src/lib/ares_strerror.c [2:2] + src/lib/ares_timeout.c [2:2] + src/lib/ares_writev.c [3:3] + src/lib/ares_writev.h [5:5] + src/tools/adig.c [1:1] + src/tools/ahost.c [1:1] KEEP COPYRIGHT_SERVICE_LABEL 3509a10f633c37ef3ea5b58e8e1f63cd BELONGS ya.make @@ -189,19 +189,8 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_android.c [1:1] - ares_android.h [1:1] - -KEEP COPYRIGHT_SERVICE_LABEL 36e0c20612ef44672b8c101f54c9621f -BELONGS ya.make - License text: - /* Copyright (C) 2009 - 2013 by Daniel Stenberg et al - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - ares_build.h [5:5] + src/lib/ares_android.c [1:1] + src/lib/ares_android.h [1:1] KEEP COPYRIGHT_SERVICE_LABEL 5004d990e89284bd48e9ce9bb40b3a5b BELONGS ya.make @@ -226,7 +215,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_options.c [2:3] + src/lib/ares_options.c [2:3] KEEP COPYRIGHT_SERVICE_LABEL 53434b80510655ef693d399872a7c5bd BELONGS ya.make @@ -237,7 +226,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_setup.h [5:5] + src/lib/ares_setup.h [5:5] KEEP COPYRIGHT_SERVICE_LABEL 5f067d54fe1e500a2cb713d2e2287b9b BELONGS ya.make @@ -248,7 +237,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_ipv6.h [2:2] + src/lib/ares_ipv6.h [2:2] KEEP COPYRIGHT_SERVICE_LABEL 5f90192afbbac5ac79d2247d1086821d BELONGS ya.make @@ -259,7 +248,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_getsock.c [2:2] + src/lib/ares_getsock.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 6cfebc210ef2316327cd15d9ca411fb8 BELONGS ya.make @@ -270,7 +259,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_free_string.c [2:2] + src/lib/ares_free_string.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 6f8dc4ed13eb3fa6c0c49d4470aa3de0 BELONGS ya.make @@ -281,8 +270,8 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_data.c [2:2] - ares_data.h [3:3] + src/lib/ares_data.c [2:2] + src/lib/ares_data.h [3:3] KEEP COPYRIGHT_SERVICE_LABEL 772d70e950c69b1a32c0a0047f47ee2d BELONGS ya.make @@ -296,7 +285,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares__sortaddrinfo.c [7:10] + src/lib/ares__sortaddrinfo.c [7:10] KEEP COPYRIGHT_SERVICE_LABEL 78db66be56803e72faf0c0319b5841bb BELONGS ya.make @@ -310,7 +299,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares__sortaddrinfo.c [7:10] + src/lib/ares__sortaddrinfo.c [7:10] KEEP COPYRIGHT_SERVICE_LABEL 818af009e3d88bab8f05d07b4c25e8cf BELONGS ya.make @@ -321,13 +310,13 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares__parse_into_addrinfo.c [1:1] - ares__readaddrinfo.c [1:1] - ares__sortaddrinfo.c [7:10] - ares_freeaddrinfo.c [2:3] - ares_getaddrinfo.c [2:4] - ares_parse_a_reply.c [2:3] - ares_parse_aaaa_reply.c [2:4] + src/lib/ares__parse_into_addrinfo.c [1:1] + src/lib/ares__readaddrinfo.c [1:1] + src/lib/ares__sortaddrinfo.c [7:10] + src/lib/ares_freeaddrinfo.c [2:3] + src/lib/ares_getaddrinfo.c [2:4] + src/lib/ares_parse_a_reply.c [2:3] + src/lib/ares_parse_aaaa_reply.c [2:4] KEEP COPYRIGHT_SERVICE_LABEL 858a33312b71a39ee1b37595088bfefd BELONGS ya.make @@ -339,8 +328,19 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_getopt.c [13:14] - ares_getopt.h [5:6] + src/tools/ares_getopt.c [13:14] + src/tools/ares_getopt.h [5:6] + +KEEP COPYRIGHT_SERVICE_LABEL 869b4b829d2af0ddc238ecbd234fa264 +BELONGS ya.make + License text: + /* Copyright 2020 by <danny.sonnenschein@platynum.ch> + Scancode info: + Original SPDX id: COPYRIGHT_SERVICE_LABEL + Score : 100.00 + Match type : COPYRIGHT + Files with this license: + src/lib/ares_parse_caa_reply.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 8ae1c43ff019af5b271d587918d91bbf BELONGS ya.make @@ -351,7 +351,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_getnameinfo.c [2:2] + src/lib/ares_getnameinfo.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL 9a9a1a42112fccd2a848bb7f21bef0d9 BELONGS ya.make @@ -362,7 +362,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_inet_net_pton.h [4:4] + src/lib/ares_inet_net_pton.h [4:4] KEEP COPYRIGHT_SERVICE_LABEL a3b944a0c944a5828d7421d9404d38f7 BELONGS ya.make @@ -373,7 +373,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_nowarn.h [5:5] + src/lib/ares_nowarn.h [5:5] KEEP COPYRIGHT_SERVICE_LABEL a568c02a238334a6de16619a72ac7ff7 BELONGS ya.make @@ -385,7 +385,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_private.h [5:6] + src/lib/ares_private.h [5:6] KEEP COPYRIGHT_SERVICE_LABEL afb0570805cf884116abf4b791a0efe7 BELONGS ya.make @@ -397,7 +397,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_library_init.c [2:3] + src/lib/ares_library_init.c [2:3] KEEP COPYRIGHT_SERVICE_LABEL b0401879c04c8b03acc6e1099d200e3f BELONGS ya.make @@ -409,10 +409,10 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_iphlpapi.h [4:5] - ares_platform.c [3:4] - ares_platform.h [5:6] - config-win32.h [4:4] + src/lib/ares_iphlpapi.h [4:5] + src/lib/ares_platform.c [3:4] + src/lib/ares_platform.h [5:6] + src/lib/config-win32.h [4:4] KEEP COPYRIGHT_SERVICE_LABEL b0ba0e82ac2b1e74adc884bf65ffb51a BELONGS ya.make @@ -424,7 +424,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - inet_ntop.c [2:3] + src/lib/inet_ntop.c [2:3] KEEP COPYRIGHT_SERVICE_LABEL b6e3440218c70084f1def8f904dffe48 BELONGS ya.make @@ -437,7 +437,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_getaddrinfo.c [2:4] + src/lib/ares_getaddrinfo.c [2:4] KEEP COPYRIGHT_SERVICE_LABEL b9d942504b76ee4af145da2bda5c940a BELONGS ya.make @@ -449,9 +449,9 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_parse_naptr_reply.c [2:3] - ares_parse_srv_reply.c [2:3] - ares_parse_txt_reply.c [2:3] + src/lib/ares_parse_naptr_reply.c [2:3] + src/lib/ares_parse_srv_reply.c [2:3] + src/lib/ares_parse_txt_reply.c [2:3] KEEP COPYRIGHT_SERVICE_LABEL bcc03fa52028dbfcb64258cda21f5729 BELONGS ya.make @@ -464,8 +464,8 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_getaddrinfo.c [2:4] - ares_gethostbyname.c [2:2] + src/lib/ares_getaddrinfo.c [2:4] + src/lib/ares_gethostbyname.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL c77c02a30f970451b71b72c5c8d97a70 BELONGS ya.make @@ -477,9 +477,9 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - bitncmp.c [3:4] - inet_net_pton.c [3:4] - inet_ntop.c [2:3] + src/lib/bitncmp.c [3:4] + src/lib/inet_net_pton.c [3:4] + src/lib/inet_ntop.c [2:3] KEEP COPYRIGHT_SERVICE_LABEL d7e79df2fb60fa6a9086795cf0689476 BELONGS ya.make @@ -491,7 +491,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_process.c [2:3] + src/lib/ares_process.c [2:3] KEEP COPYRIGHT_SERVICE_LABEL dc76a81a0c03b8441f73046ca98ec618 BELONGS ya.make @@ -502,9 +502,9 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares__get_hostent.c [2:2] - ares_dns.h [4:4] - ares_expand_name.c [2:2] + include/ares_dns.h [4:4] + src/lib/ares__get_hostent.c [2:2] + src/lib/ares_expand_name.c [2:2] KEEP COPYRIGHT_SERVICE_LABEL e19b1fdec502261b9ee3ba3c783dff6a BELONGS ya.make @@ -515,7 +515,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - bitncmp.h [5:5] + src/lib/bitncmp.h [5:5] KEEP COPYRIGHT_SERVICE_LABEL e59ec63e75bc26555dd9975fa20bc106 BELONGS ya.make @@ -527,8 +527,8 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_destroy.c [2:3] - ares_library_init.h [5:6] + src/lib/ares_destroy.c [2:3] + src/lib/ares_library_init.h [5:6] KEEP COPYRIGHT_SERVICE_LABEL f45f5e8d185e83841a63b09b70acd62e BELONGS ya.make @@ -541,7 +541,7 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_parse_aaaa_reply.c [2:4] + src/lib/ares_parse_aaaa_reply.c [2:4] KEEP COPYRIGHT_SERVICE_LABEL fa370f4b5a3cba203c6d792417971cd0 BELONGS ya.make @@ -552,7 +552,8 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_rules.h [5:5] + include/ares_build.h [6:6] + include/ares_rules.h [5:5] KEEP COPYRIGHT_SERVICE_LABEL ff854425f10eb762ddab3947b08deada BELONGS ya.make @@ -564,4 +565,4 @@ BELONGS ya.make Score : 100.00 Match type : COPYRIGHT Files with this license: - ares_parse_mx_reply.c [2:3] + src/lib/ares_parse_mx_reply.c [2:3] diff --git a/contrib/libs/c-ares/.yandex_meta/devtools.licenses.report b/contrib/libs/c-ares/.yandex_meta/devtools.licenses.report index 4d51de6f86..56cfa84078 100644 --- a/contrib/libs/c-ares/.yandex_meta/devtools.licenses.report +++ b/contrib/libs/c-ares/.yandex_meta/devtools.licenses.report @@ -38,9 +38,9 @@ BELONGS ya.make Match type : TEXT Links : http://fedoraproject.org/wiki/Licensing:MIT#Old_Style_with_legal_disclaimer_2, https://spdx.org/licenses/ISC, https://www.isc.org/software/license Files with this license: - bitncmp.c [6:16] - inet_net_pton.c [6:16] - inet_ntop.c [5:15] + src/lib/bitncmp.c [6:16] + src/lib/inet_net_pton.c [6:16] + src/lib/inet_ntop.c [5:15] KEEP NTP 53568816d1ddf46f15453c6991d855a9 BELONGS ya.make @@ -51,73 +51,74 @@ BELONGS ya.make Match type : TEXT Links : http://fedoraproject.org/wiki/Licensing:MIT#Old_Style_.28no_advertising_without_permission.29, https://spdx.org/licenses/NTP Files with this license: - acountry.c [22:32] - adig.c [4:14] - ahost.c [4:14] - ares.h [5:15] - ares__close_sockets.c [4:14] - ares__get_hostent.c [4:14] - ares__parse_into_addrinfo.c [3:13] - ares__read_line.c [4:14] - ares__readaddrinfo.c [3:13] - ares_android.c [3:13] - ares_android.h [3:13] - ares_create_query.c [4:14] - ares_data.c [4:14] - ares_data.h [5:15] - ares_destroy.c [5:15] - ares_dns.h [6:16] - ares_expand_name.c [4:14] - ares_expand_string.c [4:14] - ares_fds.c [4:14] - ares_free_hostent.c [4:14] - ares_free_string.c [4:14] - ares_freeaddrinfo.c [5:15] - ares_getaddrinfo.c [6:16] - ares_getenv.c [5:15] - ares_getenv.h [7:17] - ares_gethostbyaddr.c [4:14] - ares_gethostbyname.c [4:14] - ares_getnameinfo.c [4:14] - ares_inet_net_pton.h [6:16] - ares_init.c [5:15] - ares_iphlpapi.h [7:17] - ares_ipv6.h [4:14] - ares_library_init.c [5:15] - ares_library_init.h [8:18] - ares_llist.c [4:14] - ares_llist.h [7:17] - ares_mkquery.c [4:14] - ares_nowarn.c [4:14] - ares_nowarn.h [7:17] - ares_options.c [5:15] - ares_parse_a_reply.c [5:15] - ares_parse_aaaa_reply.c [6:16] - ares_parse_mx_reply.c [5:15] - ares_parse_naptr_reply.c [5:15] - ares_parse_ns_reply.c [3:13] - ares_parse_ptr_reply.c [4:14] - ares_parse_soa_reply.c [5:15] - ares_parse_srv_reply.c [5:15] - ares_parse_txt_reply.c [5:15] - ares_platform.c [6:16] - ares_platform.h [8:18] - ares_private.h [8:18] - ares_process.c [5:15] - ares_query.c [4:14] - ares_search.c [4:14] - ares_send.c [4:14] - ares_strcasecmp.c [5:15] - ares_strcasecmp.h [7:17] - ares_strdup.c [5:15] - ares_strdup.h [7:17] - ares_strerror.c [4:14] - ares_strsplit.c [3:13] - ares_strsplit.h [6:16] - ares_timeout.c [4:14] - ares_writev.c [5:15] - ares_writev.h [7:17] - bitncmp.h [7:17] + include/ares.h [5:15] + include/ares_dns.h [6:16] + src/lib/ares__close_sockets.c [4:14] + src/lib/ares__get_hostent.c [4:14] + src/lib/ares__parse_into_addrinfo.c [3:13] + src/lib/ares__read_line.c [4:14] + src/lib/ares__readaddrinfo.c [3:13] + src/lib/ares_android.c [3:13] + src/lib/ares_android.h [3:13] + src/lib/ares_create_query.c [4:14] + src/lib/ares_data.c [4:14] + src/lib/ares_data.h [5:15] + src/lib/ares_destroy.c [5:15] + src/lib/ares_expand_name.c [4:14] + src/lib/ares_expand_string.c [4:14] + src/lib/ares_fds.c [4:14] + src/lib/ares_free_hostent.c [4:14] + src/lib/ares_free_string.c [4:14] + src/lib/ares_freeaddrinfo.c [5:15] + src/lib/ares_getaddrinfo.c [6:16] + src/lib/ares_getenv.c [5:15] + src/lib/ares_getenv.h [7:17] + src/lib/ares_gethostbyaddr.c [4:14] + src/lib/ares_gethostbyname.c [4:14] + src/lib/ares_getnameinfo.c [4:14] + src/lib/ares_inet_net_pton.h [6:16] + src/lib/ares_init.c [5:15] + src/lib/ares_iphlpapi.h [7:17] + src/lib/ares_ipv6.h [4:14] + src/lib/ares_library_init.c [5:15] + src/lib/ares_library_init.h [8:18] + src/lib/ares_llist.c [4:14] + src/lib/ares_llist.h [7:17] + src/lib/ares_mkquery.c [4:14] + src/lib/ares_nowarn.c [4:14] + src/lib/ares_nowarn.h [7:17] + src/lib/ares_options.c [5:15] + src/lib/ares_parse_a_reply.c [5:15] + src/lib/ares_parse_aaaa_reply.c [6:16] + src/lib/ares_parse_caa_reply.c [4:14] + src/lib/ares_parse_mx_reply.c [5:15] + src/lib/ares_parse_naptr_reply.c [5:15] + src/lib/ares_parse_ns_reply.c [3:13] + src/lib/ares_parse_ptr_reply.c [4:14] + src/lib/ares_parse_soa_reply.c [5:15] + src/lib/ares_parse_srv_reply.c [5:15] + src/lib/ares_parse_txt_reply.c [5:15] + src/lib/ares_platform.c [6:16] + src/lib/ares_platform.h [8:18] + src/lib/ares_private.h [8:18] + src/lib/ares_process.c [5:15] + src/lib/ares_query.c [4:14] + src/lib/ares_search.c [4:14] + src/lib/ares_send.c [4:14] + src/lib/ares_strcasecmp.c [5:15] + src/lib/ares_strcasecmp.h [7:17] + src/lib/ares_strdup.c [5:15] + src/lib/ares_strdup.h [7:17] + src/lib/ares_strerror.c [4:14] + src/lib/ares_strsplit.c [3:13] + src/lib/ares_strsplit.h [6:16] + src/lib/ares_timeout.c [4:14] + src/lib/ares_writev.c [5:15] + src/lib/ares_writev.h [7:17] + src/lib/bitncmp.h [7:17] + src/tools/acountry.c [22:32] + src/tools/adig.c [4:14] + src/tools/ahost.c [4:14] KEEP BSD-3-Clause 6899d7bb10667745c38e41e3f295c45d BELONGS ya.make @@ -129,21 +130,21 @@ BELONGS ya.make Match type : REFERENCE Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause Files with this license: - ares_getopt.c [4:4] + src/tools/ares_getopt.c [4:4] Scancode info: Original SPDX id: BSD-3-Clause Score : 99.00 Match type : REFERENCE Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause Files with this license: - ares_getopt.c [4:4] + src/tools/ares_getopt.c [4:4] Scancode info: Original SPDX id: LicenseRef-scancode-unknown Score : 11.00 Match type : REFERENCE Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown.LICENSE Files with this license: - ares_getopt.c [4:4] + src/tools/ares_getopt.c [4:4] KEEP NTP 8fab855584c6999b237d25f7252d2d73 BELONGS ya.make @@ -154,14 +155,14 @@ BELONGS ya.make Match type : TEXT Links : http://fedoraproject.org/wiki/Licensing:MIT#Old_Style_.28no_advertising_without_permission.29, https://spdx.org/licenses/NTP Files with this license: - ares__timeval.c [4:12] - ares_build.h [7:15] - ares_cancel.c [4:12] - ares_getsock.c [4:12] - ares_rules.h [7:15] - ares_setup.h [7:15] - config-win32.h [6:14] - setup_once.h [7:15] + include/ares_build.h [8:16] + include/ares_rules.h [7:15] + src/lib/ares__timeval.c [4:12] + src/lib/ares_cancel.c [4:12] + src/lib/ares_getsock.c [4:12] + src/lib/ares_setup.h [7:15] + src/lib/config-win32.h [6:14] + src/lib/setup_once.h [7:15] KEEP MIT 94890220f883df92236a2e64421f8224 BELONGS ya.make @@ -173,7 +174,7 @@ BELONGS ya.make Match type : REFERENCE Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT Files with this license: - CHANGES [1622:1622] + CHANGES [2148:2148] KEEP BSD-3-Clause 9d018aaf6e89baa34c9bc9407e762114 BELONGS ya.make @@ -185,7 +186,7 @@ BELONGS ya.make Match type : REFERENCE Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause Files with this license: - ares__sortaddrinfo.c [3:3] + src/lib/ares__sortaddrinfo.c [3:3] KEEP BSD-3-Clause 9f9f74951499b982d601e33ab0c03bed BELONGS ya.make @@ -196,7 +197,7 @@ BELONGS ya.make Match type : TEXT Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause Files with this license: - ares__sortaddrinfo.c [12:34] + src/lib/ares__sortaddrinfo.c [12:34] KEEP BSD-3-Clause cd98e0ba1ce0a730d60166f40b0e63b5 BELONGS ya.make @@ -207,8 +208,8 @@ BELONGS ya.make Match type : TEXT Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause Files with this license: - ares_getopt.c [16:38] - ares_getopt.h [8:30] + src/tools/ares_getopt.c [16:38] + src/tools/ares_getopt.h [8:30] KEEP MIT e8dcd3bdf4ebf29fb653dc583ef61bee BELONGS ya.make diff --git a/contrib/libs/c-ares/.yandex_meta/licenses.list.txt b/contrib/libs/c-ares/.yandex_meta/licenses.list.txt index 6868726612..801ca0f670 100644 --- a/contrib/libs/c-ares/.yandex_meta/licenses.list.txt +++ b/contrib/libs/c-ares/.yandex_meta/licenses.list.txt @@ -113,10 +113,6 @@ ====================COPYRIGHT==================== -/* Copyright (C) 2009 - 2013 by Daniel Stenberg et al - - -====================COPYRIGHT==================== /* Copyright (C) 2009 by Daniel Stenberg et al @@ -146,10 +142,6 @@ ====================COPYRIGHT==================== /* Copyright 1998 by the Massachusetts Institute of Technology. - - -====================COPYRIGHT==================== -/* Copyright 1998 by the Massachusetts Institute of Technology. * Copyright (C) 2004 - 2011 by Daniel Stenberg et al @@ -223,10 +215,18 @@ ====================COPYRIGHT==================== +/* Copyright 2020 by <danny.sonnenschein@platynum.ch> + + +====================COPYRIGHT==================== Copyright (c) 2007 - 2018, Daniel Stenberg with many contributors, see AUTHORS file. +====================COPYRIGHT==================== +Copyright 1998 by the Massachusetts Institute of Technology. + + ====================File: AUTHORS==================== c-ares is based on ares, and these are the people that have worked on it since the fork was made: diff --git a/contrib/libs/c-ares/CHANGES b/contrib/libs/c-ares/CHANGES index f6652caaa0..b8d832c9b5 100644 --- a/contrib/libs/c-ares/CHANGES +++ b/contrib/libs/c-ares/CHANGES @@ -1,5 +1,531 @@ Changelog for the c-ares project. Generated with git2changes.pl +Version 1.17.2 (24 Jul 2021) + +bradh352 (24 Jul 2021) +- fix typo + +- prep for 1.17.2 release + +GitHub (30 Jun 2021) +- [jeanpierrecartal brought this change] + + Replace strdup() with ares_strdup() (#408) + + strdup() is used in src/lib/ares_parse_a_reply.c and src/lib/ares_parse_aaaa_reply.c whereas allocated memory is freed using ares_free(). + + Bug: 407 + Fix By: Jean-pierre Cartal (@jeanpierrecartal) + +- [Brad House brought this change] + + Validate hostnames in DNS responses and discard from malicious servers (#406) + + To prevent possible users having XSS issues due to intentionally malformed DNS replies, validate hostnames returned in responses and return EBADRESP if they are not valid. + + It is not clear what legitimate issues this may cause at this point. + + Bug Reported By: philipp.jeitner@sit.fraunhofer.de + Fix By: Brad House (@bradh352) + +bradh352 (11 Jun 2021) +- ares_expand_name(): fix formatting and handling of root name response + + Fixes issue introduced in prior commit with formatting and handling + of parsing a root name response which should not be escaped. + + Fix By: Brad House + +- ares_expand_name() should escape more characters + + RFC1035 5.1 specifies some reserved characters and escaping sequences + that are allowed to be specified. Expand the list of reserved characters + and also escape non-printable characters using the \DDD format as + specified in the RFC. + + Bug Reported By: philipp.jeitner@sit.fraunhofer.de + Fix By: Brad House (@bradh352) + +GitHub (15 Apr 2021) +- [HALX99 brought this change] + + Fix can't get dns server on macos and ios (#401) + + If DNS configuration didn't include search domains on MacOS (or iOS) it would throw an error instead of ignoring. + + Fix By: @halx99 + +- [catalinh-bd brought this change] + + Bugfix/crash in ares sortaddrinfo (#400) + + The bug was generated because there was no check for the number + of items in the list and invalid memory was accesed when the list + was empty. There is a check for null after calling malloc but on + some systems it always returns a valid address for size equals 0. + Relates To: #392, 0903dcecabca283d0fa771632892dc7592b7a66d + + Fix By: @catalinh-bd + +bradh352 (2 Mar 2021) +- Null deref if ares_getaddrinfo() is terminated with ares_destroy() + + ares_freeaddrinfo() was not checking for a Null ptr during cleanup of + an aborted query. + + Once that was resolved it uncovered another possible issue with + multiple simultaneous underlying queries being outstanding and + possibly prematurely cleaning up the handle. + + Reported By: Michael Kourlas + Fix By: Brad House (@bradh352) + +GitHub (18 Feb 2021) +- [Brad House brought this change] + + CMake: RANDOM_FILE not defined #397 + + RANDOM_FILE was never defined by cmake, causing RC4 key generation to use the less secure rand() method. + + Also, due to clashes with chain-building from other projects (e.g. curl) that may define RANDOM_FILE, this was renamed to CARES_RANDOM_FILE. + + This is the proposed change for #396 + + Fix By: Brad House (@bradh352) + +- [Anton Danielsson brought this change] + + CMake: fix Make install for iOS/MacOS (#395) + + INSTALL TARGETS were missing the BUNDLE DESTINATION + + Fix By: Anton Danielsson (@anton-danielsson) + +- [František Dvořák brought this change] + + Fix build with autotools out of source tree (#394) + + Add missing include directory, which fixes the build with autotools in separated build directory. + + Fix By: František Dvořák (@valtri) + +bradh352 (15 Jan 2021) +- fuzzing: HAVE_CONFIG_H may not be defined so cannot include ares_setup.h. Its not needed even though we include ares_nameser.h + +- remove redundant header checks + +- properly detect netinet/tcp.h on openbsd + +- more portability updates + +- renamed nameser.h to ares_nameser.h requires Makefile.inc update for distributed files + +- more portability updates + +- remove bad files + +- portability updates for test cases + +- Portability Updates for arpa/nameser.h (#388) + + There is too much inconsistency between platforms for arpa/nameser.h and arpa/nameser_compat.h for the way the current files are structured. Still load the respective system files but make our private nameser.h more forgiving. + + Fixes: #388 + Fix By: Brad House (@bradh352) + +- ares_parse_ptr_reply() handle NULL for addr/addr_len. Fixes #392 + + NodeJS passes NULL for addr and 0 for addrlen parameters to ares_parse_ptr_reply(). On systems where malloc(0) returned NULL, this would cause the function to return ARES_ENOMEM, but the cleanup wasn't handled properly and would crash. + + This patche fixes that bug, and also hardens ares_free_hostent() to not leak memory during cleanup. + + Fixes: #392 + Fix By: Brad House (@bradh352) + +- Define behavior of malloc(0) + + Some systems may return either NULL or a valid pointer on malloc(0). c-ares should never call malloc(0) so lets return NULL so we're more likely to find an issue if it were to occur. + +GitHub (24 Dec 2020) +- [dhrumilrana brought this change] + + z/OS: port (#390) + + Port c-ares to z/OS. + + Fix By: Dhrumil Rana (@dhrumilrana) + +- [vburdo brought this change] + + Use unbuffered stdio for /dev/urandom to read only requested data (#391) + + Buffered fread() reads 4096 bytes which is completely unnecessary and potentially may cause problems. + I discovered this on private linux configuration where custom /dev/urandom implementation has poor performance. + + Fix By: @vburdo + +- [Jay Freeman (saurik) brought this change] + + This relative header #include needs to use quotes. (#386) + + Fix By: Jay Freeman (@saurik) + +bradh352 (23 Nov 2020) +- Win32: Fix tools build with autotools static library + When c-ares is being built as static on Win32, CARES_STATICLIB must + be defined, but it wasn't being pulled in for the tools. + + Fixes: #384 + Fix By: Brad House (@bradh352) + +- Loosen requirements for static c-ares library when building tests + + It appears that when building tests, it would hardcode enabling building + of the c-ares static library. This was probably due to Windows limitations + in symbol visibility. + + This change will use the static library if it exists for tests, always. + Otherwise, it will only forcibly enable static libraries for tests on + Windows. + + Fixes: #380 + Fix By: Brad House (@bradh352) + +- Remove legacy comment about ahost/acountry/adig targets + +- Distribute fuzzinput/fuzznames for fuzz tests + + The fuzz test files were not being distributed. This doesn't appear to be + a regression, it looks like they have never been distributed. + + Fixes: #379 + Fix By: Brad House (@bradh352) + +Version 1.17.1 (19 Nov 2020) + +GitHub (19 Nov 2020) +- [Brad House brought this change] + + Travis: add iOS target built with CMake (#378) + + Issue #377 suggested that CMake builds for iOS with c-ares were broken. This PR adds an automatic Travis build for iOS CMake. + + Fix By: Brad House (@bradh352) + +bradh352 (18 Nov 2020) +- fix build + +GitHub (18 Nov 2020) +- [Fabrice Fontaine brought this change] + + External projects were using non-public header ares_dns.h, make public again (#376) + + It appears some outside projects were relying on macros in ares_dns.h, even though it doesn't appear that header was ever meant to be public. That said, we don't want to break external integrators so we should distribute this header again. + + Fix By: Fabrice Fontaine (@ffontaine) + +bradh352 (17 Nov 2020) +- note that so versioning has moved to configure.ac + +- note about 1.17.1 + +- fix sed gone wrong + +GitHub (17 Nov 2020) +- [Daniel Stenberg brought this change] + + autotools cleanup (#372) + + * remove: install-sh mkinstalldirs + + They're generated when needed, no need to store in it. + + * buildconf: remove custom logic with autoreconf + + Fix By: Daniel Stenberg (@bagder) + +bradh352 (17 Nov 2020) +- attempt to fix 1.17.0 release distribution issues + +Version 1.17.0 (16 Nov 2020) + +bradh352 (16 Nov 2020) +- 1.17.0 release prep + +- ares_getaddrinfo(): duplicate hints ai_socktype and ai_protocol into output + + ai_socktype and ai_protocol were ignored from the hints input. They are now + duplicated into the output as expected. Currently no sanity checks on + proper values are taking place. + + Fixes: #317 + Fix By: Brad House (@bradh352) + +- ares_parse_{a,aaaa}_reply could return larger *naddrttls than passed in + + If there are more ttls returned than the maximum provided by the requestor, then + the *naddrttls response would be larger than the actual number of elements in + the addrttls array. + + This bug could lead to invalid memory accesses in applications using c-ares. + + This behavior appeared to break with PR #257 + + Fixes: #371 + Reported By: Momtchil Momtchev (@mmomtchev) + Fix By: Brad House (@bradh352) + +GitHub (5 Nov 2020) +- [Dustin Lundquist brought this change] + + docs: ares_set_local_ip4() uses host byte order (#368) + + Properly document brain-dead behavior of ares_set_local_ip4() using host byte order instead of expected network byte order. + + Fix By: Dustin Lundquist <d.lundquist@tempered.io> + +- [Łukasz Marszał brought this change] + + empty hquery->name could lead to invalid memory access (#367) + + If hquery->name is empty (=="\0"), &hquery->name[strlen(hquery->name)-1] would point to "random" place in memory. This is causing some of my address sanitizer tests to fail. + + Fix By: Łukasz Marszał (@lmarszal) + +bradh352 (28 Sep 2020) +- Fix OSSFuzz reported issue in CAA reply parsing + + OSS-Fuzz is reporting a use-of-uninitialized-value: + https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=26012 + + Reported By: David Drysdale (@daviddrysdale) + +GitHub (26 Sep 2020) +- [David Hotham brought this change] + + fuzz CAA parsing (#363) + + Add fuzz support for CAA parsing + + Fix By: David Hotham (@dimbleby) + +- [Daniela Sonnenschein brought this change] + + Allow parsing of CAA Resource Record (#360) + + CAA (Certification Authority Authorization) was introduced in RFC 6844. + This has been obsoleted by RFC 8659. This commit added the possibility + to query CAA resource records with adig and adds a parser for CAA + records, that can be used in conjunction with ares_query(3). + + Closes Bug: #292 + Fix By: Daniela Sonnenschein (@lxdicted) + +Daniel Stenberg (17 Sep 2020) +- docs: remove the html and pdf make targets + + They're rarely used in our daily work flow and mostly just add friction, + + Closes #362 + +bradh352 (14 Sep 2020) +- ares_process needs to always include nameser.h as it has compat + +- Define T_OPT if system doesn't provide it + +GitHub (12 Sep 2020) +- [Gisle Vanem brought this change] + + Change the mailman links (#358) + + Links when wrapping become misleading. Insert newline to prevent wrapping. + + Fix By: Gisle Vanem (@gvanem) + +- [Gisle Vanem brought this change] + + [adig] Update man-page for the '-x' option (#357) + + Fix By: Gisle Vanem (@gvanem) + +- [Gisle Vanem brought this change] + + [adig] add '-x' option. (#356) + + Added a 'dig-style' '-x' option. Also support '-xx' for a + IPv6 bit-string PTR query. + + Fix By: Gisle Vanem (@gvanem) + +bradh352 (12 Sep 2020) +- fix indentation + +- ns_t_opt -> T_OPT + +GitHub (12 Sep 2020) +- [Gisle Vanem brought this change] + + Fixes for Watt-32 on djgpp + Windows (#355) + + No longer any relation to libcurl since '<libcurl-root>/packages/DOS/common.dj' is dropped. + This Makefile.dj has been tested on Win-10 only (using the Windows hosted djgpp cross compiler). + + Fix By: Gisle Vanem (@gvanem) + +- [Gisle Vanem brought this change] + + Fixes for Watt-32 on Windows and MSDOS (#354) + + Move the prototype to 'ares_private.h'. + + Fix By: Gisle Vanem (@gvanem) + +bradh352 (11 Sep 2020) +- update path for include + +- remove stale information + +- remove stale information + +Brad House (9 Sep 2020) +- silence compiler warnings + +- Remove stale msvc files from makefile + +GitHub (9 Sep 2020) +- [Brad House brought this change] + + Reorganize source tree (#349) + + Originally started by Daniel Stenberg (@bagder) with #123, this patch reorganizes the c-ares source tree to have a more modern layout. It also fixes out of tree builds for autotools, and automatically builds the tests if tests are enabled. All tests are passing which tests each of the supported build systems (autotools, cmake, nmake, mingw gmake). There may be some edge cases that will have to be caught later on for things I'm not aware of. + + Fix By: Brad House (@bradh352) + +Brad House (1 Sep 2020) +- remove CURLDEBUG as per #82 + +GitHub (1 Sep 2020) +- [Erik Lax brought this change] + + Detect remote DNS server does not support EDNS as per RFC 6891 (#244) + + EDNS retry should be based on FORMERR returned without an OPT RR record as per https://tools.ietf.org/html/rfc6891#section-7 rather than just treating any unexpected error condition as a reason to disable EDNS on the channel. + + Fix By: Erik Lax (@eriklax) + +Brad House (27 Aug 2020) +- Fix for #345, don't use 'true' use 1 + +GitHub (27 Aug 2020) +- [Seraphime Kirkovski brought this change] + + ares_gethostbyname: Fix AF_UNSPEC support when using an ip address (#204) + + fake_hostent() was not supporting AF_UNSPEC, so when an ip address was specified when using AF_UNSPEC it would attempt to do a DNS lookup rather than returning a fake hostent using the ip address. + + Fix By: Seraphime Kirkovski (@Seraphime) + +- [apenn-msft brought this change] + + Tests should use dynamic system-assigned ports rather than static port (#346) + + The c-ares test suite was hardcoded to use port 5300 (and possibly 5301, 5302) for the test suite. Especially in containers, there may be no guarantee these ports are available and cause tests to fail when they could otherwise succeed. Instead, request the system to assign a port to use dynamically. This is now the default. To override, the test suite still takes the "-p <port>" option as it always has and will honor that. + + Fix By: Anthony Penniston (@apenn-msft) + +Brad House (25 Aug 2020) +- Unset members of the addr struct contain garbage values (#343) + + When generating the ares_sockaddr data by getaddrinfo() it was only filling + in certain members while leaving others uninitialized. This left garbage + data if a user tried to use the unset values. memset() the ares_sockaddr + to 0 prior to filling in the values to prevent this. + + Reported By: @SmorkalovG + Fix By: Brad House (@bradh352) + +GitHub (24 Aug 2020) +- [Jonathan Maye-Hobbs brought this change] + + FQDN with trailing period should be queried first with larger ndot value (#345) + + If a query is performed for dynamodb.us-east-1.amazonaws.com. with ndots=5, it was attempting to search the search domains rather than just attempting the FQDN that was passed it. This patch now at least attempts the FQDN first. + + We may need to determine if we should abort any further searching, however as is probably intended. + + Fix by: Jonathan Maye-Hobbs (@wheelpharoah) + +- [Gisle Vanem brought this change] + + Update acountry.c country code list (#341) + + Updated country_list[]: + * 2-letter ISO-3166 country-codes. + * Add, rename some names + codes in accordance with latest table at https://en.wikipedia.org/wiki/ISO_3166-1. + + Fix By: Gisle Vanem (@gvanem) + +- [Bulat Gaifullin brought this change] + + Test case should honor flag HAVE_WRITEV rather than WIN32 (#344) + + Test cases where not honoring the HAVE_WRITEV flag but instead using WIN32 to determine if WRITEV was available or not. This patch fixes that. + + Fix By: Bulat Gaifullin (@bgaifullin) + +Brad House (18 Jul 2020) +- Ensure c89 support + + A couple of for loops in Mac-specific code were using integer declarations + inside a for loop. Move the declaration to the top of the preceding + code block to retain c89 compliance. + + Reported By: Jeffrey Walton + +GitHub (2 Jul 2020) +- [Fionn Fitzmaurice brought this change] + + Avoid buffer overflow in RC4 loop comparison (#336) + + The rc4 function iterates over a buffer of size buffer_len who's maximum + value is INT_MAX with a counter of type short that is not guaranteed to + have maximum size INT_MAX. + + In circumstances where short is narrower than int and where buffer_len + is larger than the maximum value of a short, it may be possible to loop + infinitely as counter will overflow and never be greater than or equal + to buffer_len. + + The solution is to make the comparison be between types of equal width. + This commit defines counter as an int. + + Fix By: Fionn Fitzmaurice (@fionn) + +- [anonymoushelpishere brought this change] + + Updated help information for adig, acountry, and ahost. (#334) + + Provide more descriptive help information for various utilities. + + Fix By: @anonymoushelpishere + +- [lutianxiong brought this change] + + avoid read-heap-buffer-overflow (#332) + + Fix invalid read in ares_parse_soa_reply.c found during fuzzing + + Fixes Bug: #333 + Fix By: lutianxiong (@ltx2018) + +- [Ivan Baidakou brought this change] + + Fix: sizeof(sizeof(addr.saX)) -> sizeof(addr.saX) in readaddrinfo (#331) + + Looks like a sed-gone-wrong, a sizeof inside of a sizeof. + + Fix By: Ivan Baidakou (@basiliscos) + Version 1.16.1 (11 May 2020) Brad House (11 May 2020) @@ -4524,200 +5050,3 @@ Yang Tse (21 Jun 2009) - Refactor how libraries are checked for connect() function, and check for connect() as it is done for other functions. - -Gisle Vanem (20 Jun 2009) -- Remove unneeded defines. - -- Use select_s() and not select(). - -Yang Tse (19 Jun 2009) -- sclose() function-like macro definition used to close a socket, - now solely based on HAVE_CLOSESOCKET and HAVE_CLOSESOCKET_CAMEL - config file preprocessor definitions. - -- add CloseSocket camel case function check - -- check for socket() and closesocket() as it is done for other functions - -- Remove HAVE_CONFIG_H definition from here, - CFLAGS from common.dj already defines it. - -- initial step towards decoupling c-ares from libcurl for DOS - -- don't ignore these subdirs, they must be removed first - -- Remove DEBUGBUILD symbol definition, is not required for programs using the library. - -- DEBUGBUILD symbol definition for debug builds - -- ignore some subdirs - -- fix comment - -- Try to make more clear that --enable-curldebug has nothing to do with --enable-debug for this library. - -- Revert last change, it is inappropriate. - -Gisle Vanem (12 Jun 2009) -- Replace CURLDEBUG with DEBUGBUILD. - -Yang Tse (11 Jun 2009) -- when running automake copy missing files instead of symlinking them - -- Adjusted to take in account that... - - With the curl memory tracking feature decoupled from the debug build feature, - CURLDEBUG and DEBUGBUILD preprocessor symbol definitions are used as follows: - - CURLDEBUG used for curl debug memory tracking specific code (--enable-curldebug) - - DEBUGBUILD used for debug enabled specific code (--enable-debug) - -- c-ares' --enable-debug --enable-curldebug decoupling follow-up - -- mention last changes - -- Remove buildconf.bat from release and daily snapshot archives. - - buildconf.bat is only for CVS tree builds. - -- Ensure that buildconf.bat does nothing unless it is used with a CVS checkout. - -- CVS-INFO file only present in CVS tree, never in release nor daily snapshot - archives. Used as a sentinel file in buildconf.bat to differentiate CVS builds. - -Gisle Vanem (8 Jun 2009) -- Update comment about "ML". Removed "-D_USE_32BIT_TIME_T" (not a requirement). - -Yang Tse (8 Jun 2009) -- just comment it out - -- For debugging purposes... - - Disable the '-export-symbols-regex' to discard this as the origin - of link failures related with shared libraries and non-GNU linkers. - -- c-ares Makefile.am back to using $(top_builddir) for *_LDADD - -- c-ares' -no-undefined and --enable-curldebug adjustments - -- Use relative path to built c-ares tree libtool library - -- John E. Malmberg noticed that the configure script was failing to detect the - timeval struct on VMS when building with _XOPEN_SOURCE_EXTENDED undefined due - to definition taking place in socket.h instead of time.h - -- Fix compiler warning: out of bound access - -- fix compilation on AIX - -- c-ares' --enable-curldebug adjustments - -- Remove temporarily introduced memory leak. - -- Temporarily introduce a memory leak to verify curl debug memory tracking works. - -- Allow curl debug memory tracking when building a shared library on - systems which support external, undefined, symbols in shared libraries. - -Daniel Stenberg (26 May 2009) -- language fix - -Yang Tse (26 May 2009) -- Make ares_init(), ares_dup() and ares_init_options() return ARES_ENOTINITIALIZED - if library initialization has not been performed calling ares_library_init(). - -- c-ares's --enable-curldebug configure option decoupled from c-ares's --enable-debug - -- Prevent copying 'sourced' manpages for build targets that don't use them. - -Daniel Stenberg (23 May 2009) -- minor edits - -Yang Tse (21 May 2009) -- Include .pdf versions of c-ares man pages in distribution tarball. - -- Allow generation of .html and .pdf versions of c-ares man pages. - -Gisle Vanem (21 May 2009) -- $(OBJ_DIR)/ares_getopt.o must be cleaned explicitly. - -Yang Tse (20 May 2009) -- Mention last changes - -- Initial ares_library_cleanup(3) man page - -- Update man page - -- Update man page - -- Initial ares_library_init(3) man page attempt - -- Force revision update, to force CVS to update the $Id date string format - -- Add same copyright notice as other c-ares files - -- Fix case - -- Remove run-time requirement for advapi32.dll since - c-ares can work even with no advapi32.dll at all. - -- Intentionally avoid checking if the address of SystemFunction036, a.k.a. - RtlGenRandom, has been located or not. This function is only available on - WinXP and later. When unavailable c-ares uses portable rand() function. - -- - Provide in external interface preprocessor symbol definitions for - CARES_HAVE_ARES_LIBRARY_INIT and CARES_HAVE_ARES_LIBRARY_CLEANUP - to ease the use of new capabilities. - - - Move ares_version() prototype to ares.h - -- Introduction of ares_library_init() and ares_library_cleanup() - -- Introduction of ares_library_init() and ares_library_cleanup() - -- remove outdated comment - -- Fix preprocessor conditional expression - -- fiX *__SOCKLEN_T definitions for remaining targets - -- *__SOCKLEN_T definitions for OS400 already fixed - -- fIX *__SOCKLEN_T definitions for SYMBIAN32 and VMS targets - -Daniel Stenberg (11 May 2009) -- - Gregor Jasny made c-ares link with libtool 's -export-symbols-regex option to - only expose functions starting with ares_. - -Yang Tse (11 May 2009) -- Remove experimental check. Currently there's no need for it. - -- Fix an m4 overquoting triggering a spurious 'AS_TR_CPP' symbol definition - attempt in generated config.h - -- Proper naming for the experimental compiler test and moved to *-compilers.m4 - -- Moved *_CHECK_COMPILER_HALT_ON_ERROR and *_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE to *-compilers.m4 along with other *_CHECK_COMPILER_* - -- fIX *__SOCKLEN_T definitions for OS400 and generic GCC targets - -- fIX *__SOCKLEN_T definitions for MVS and 370 targets - -- fIX *__SOCKLEN_T definitions for several Windows target tool-chains - -- HP-UX's X/Open network library requirement check follow-up - -- HP-UX's X/Open network library requirement check follow-up - -- Use build-time configured ares_socklen_t instead of socklen_t - -- David McCreedy's "TPF-platform specific changes to various files" patch follow-up - -Daniel Stenberg (1 May 2009) -- s/libcurl/c-ares - -- version number typo fix - -Yang Tse (1 May 2009) -- David McCreedy's "TPF-platform specific changes to various files" patch diff --git a/contrib/libs/c-ares/CONTRIBUTING.md b/contrib/libs/c-ares/CONTRIBUTING.md new file mode 100644 index 0000000000..539c45d1da --- /dev/null +++ b/contrib/libs/c-ares/CONTRIBUTING.md @@ -0,0 +1,15 @@ +Contributing to c-ares +====================== + +To contribute patches to c-ares, please generate a GitHub pull request +and follow these guidelines: + + - Check that the Travis builds are green for your pull request. + - Please update the test suite to add a test case for any new functionality. + - Build the library with `./configure --enable-debug --enable-maintainer-mode` and + ensure there are no new warnings. + +To improve the chances of the c-ares maintainers responding to your request: + + - Also send an email to the mailing list at `c-ares@cool.haxx.se` describing your change. + - To follow any associated discussion, please subscribe to the [mailing list](http://cool.haxx.se/mailman/listinfo/c-ares). diff --git a/contrib/libs/c-ares/INSTALL.md b/contrib/libs/c-ares/INSTALL.md index cbf1fc8f9b..f042cdc995 100644 --- a/contrib/libs/c-ares/INSTALL.md +++ b/contrib/libs/c-ares/INSTALL.md @@ -39,7 +39,6 @@ unpacked the source archive): ./configure make - make ahost adig acountry (optional) make install You probably need to be root when doing the last command. @@ -334,11 +333,6 @@ provided that you installed Visual C/C++ 6 in the default directory. Further details in [README.msvc](README.msvc) -### MSVC IDEs - -Details in [README.msvc](README.msvc) - - ### Important static c-ares usage note When building an application that uses the static c-ares library, you must diff --git a/contrib/libs/c-ares/README.msvc b/contrib/libs/c-ares/README.msvc index 4ff8700cb8..396f497db4 100644 --- a/contrib/libs/c-ares/README.msvc +++ b/contrib/libs/c-ares/README.msvc @@ -1,6 +1,6 @@ - ___ __ _ _ __ ___ ___ + ___ __ _ _ __ ___ ___ / __| ___ / _` | '__/ _ \/ __| | (_ |___| (_| | | | __/\__ \ \___| \__,_|_| \___||___/ @@ -64,46 +64,6 @@ to c-ares source folder where Makefile.msvc file is located. - How to build using Visual Studio 6 IDE - -------------------------------------- - - A VC++ 6.0 reference workspace (vc6aws.dsw) is available within the 'vc' - folder to allow proper building of the library and sample programs. - - 1) Open the vc6aws.dsw workspace with MSVC6's IDE. - 2) Select 'Build' from top menu. - 3) Select 'Batch Build' from dropdown menu. - 4) Make sure that the sixteen project configurations are 'checked'. - 5) Click on the 'Build' button. - 6) Once the sixteen project configurations are built you are done. - - Dynamic and static c-ares libraries are built in debug and release flavours, - and can be located each one in its own subdirectory, dll-debug, dll-release, - lib-debug and lib-release, all of them below the 'vc\cares' subdirectory. - - In the same way four executable versions of each sample program are built, - each using its respective library. The resulting sample executables are - located in its own subdirectory, dll-debug, dll-release, lib-debug and - lib-release, below the 'vc\acountry', 'vc\adig' and 'vc\ahost'folders. - - These reference VC++ 6.0 configurations are generated using the dynamic CRT. - - - How to build using Visual Studio 2003 or newer IDE - -------------------------------------------------- - - First you have to convert the VC++ 6.0 reference workspace and project files - to the Visual Studio IDE version you are using, following next steps: - - 1) Open vc\vc6aws.dsw with VS20XX. - 2) Allow VS20XX to update all projects and workspaces. - 3) Save ALL and close VS20XX. - 4) Open vc\vc6aws.sln with VS20XX. - 5) Select batch build, check 'all' projects and click 'build' button. - - Same comments relative to generated files and folders as done above for - Visual Studio 6 IDE apply here. - Relationship between c-ares library file names and versions ----------------------------------------------------------- @@ -139,4 +99,4 @@ Have Fun! - + diff --git a/contrib/libs/c-ares/RELEASE-NOTES b/contrib/libs/c-ares/RELEASE-NOTES index 7a9d75fe78..adb9b945d8 100644 --- a/contrib/libs/c-ares/RELEASE-NOTES +++ b/contrib/libs/c-ares/RELEASE-NOTES @@ -1,30 +1,83 @@ -c-ares version 1.16.1 +c-ares version 1.17.2 + +This is a security and bugfix release. It addresses a few security related +issues along with various bugfixes mostly related to portability. Security: - o Prevent possible use-after-free and double-free in ares_getaddrinfo() if - ares_destroy() is called prior to ares_getaddrinfo() completing. Reported - by Jann Horn at Google Project Zero. + o NodeJS passes NULL for addr and 0 for addrlen to ares_parse_ptr_reply() on + systems where malloc(0) returns NULL. This would cause a crash. [8] + o When building c-ares with CMake, the RANDOM_FILE would not be set and + therefore downgrade to the less secure random number generator [12] + o If ares_getaddrinfo() was terminated by an ares_destroy(), it would cause + a crash [13] + o Crash in sortaddrinfo() if the list size equals 0 due to an unexpected + DNS response [14] + o Expand number of escaped characters in DNS replies as per RFC1035 5.1 to + prevent spoofing [16], [17] + o Perform validation on hostnames to prevent possible XSS due to applications + not performing valiation themselves [18] Changes: - o Allow TXT records on CHAOS qclass. Used for retriving things like - version.bind, version.server, authoris.bind, hostname.bind, and id.server. - [3] + o Use non-blocking /dev/urandom for random data to prevent early startup + performance issues [5] + o z/OS port [6] + o ares_malloc(0) is now defined behavior (returns NULL) rather than + system-specific to catch edge cases [7] Bug fixes: - o Fix Windows Unicode incompatibilities with ares_getaddrinfo() [1] - o Silence false cast-align compiler warnings due to valid casts of - struct sockaddr to struct sockaddr_in and struct sockaddr_in6. - o MacOS should use libresolv for retrieving DNS servers, like iOS - o CMake build system should populate the INCLUDE_DIRECTORIES property of - installed targets [2] - o Correct macros in use for the ares_getaddrinfo.3 man page + o Fuzz testing files were not distributed with official archives [1] + o Building tests should not force building of static libraries except on + Windows [2] + o Windows builds of the tools would fail if built as static due to a missing + CARES_STATICLIB definition [3] + o Relative headers must use double quotes to prevent pulling in a system + library [4] + o Fix OpenBSD building by implementing portability updates for including + arpa/nameser.h [9] + o Fix building out-of-tree for autotools [10] + o Make install on MacOS/iOS with CMake was missing the bundle destination so + libraries weren't actually installed [11] + o Fix retrieving DNS server configuration on MacOS and iOS if the configuration + did not include search domains [15] + o ares_parse_a_reply and ares_parse_aaa_reply were erroneously using strdup() + instead of ares_strdup() [19] + Thanks go to these friendly people for their efforts and contributions: - Brad House (@bradh352), Daniel Stenberg (@bagder), Dmitry Igrishin (@dmitigr), - Jann Horn, Shelly Vohr, Teemu R (@rytilahti) - (6 contributors) + Anton Danielsson (@anton-danielsson) + Brad House (@bradh352) + Daniel Stenberg (@bagder) + Dhrumil Rana (@dhrumilrana) + František Dvořák (@valtri) + @halx99 + Jay Freeman (@saurik) + Jean-pierre Cartal (@jeanpierrecartal) + Michael Kourlas + Philipp Jeitner + @vburdo +(11 contributors) References to bug reports and discussions on issues: - [1] = https://github.com/c-ares/c-ares/pull/328 - [2] = https://github.com/c-ares/c-ares/pull/323 - [3] = https://github.com/c-ares/c-ares/pull/321 + [1] = https://github.com/c-ares/c-ares/issues/379 + [2] = https://github.com/c-ares/c-ares/issues/380 + [3] = https://github.com/c-ares/c-ares/issues/384 + [4] = https://github.com/c-ares/c-ares/pull/386 + [5] = https://github.com/c-ares/c-ares/pull/391 + [6] = https://github.com/c-ares/c-ares/pull/390 + [7] = https://github.com/c-ares/c-ares/commit/485fb66 + [8] = https://github.com/c-ares/c-ares/issues/392 + [9] = https://github.com/c-ares/c-ares/issues/388 + [10] = https://github.com/c-ares/c-ares/pull/394 + [11] = https://github.com/c-ares/c-ares/pull/395 + [12] = https://github.com/c-ares/c-ares/pull/397 + [13] = https://github.com/c-ares/c-ares/commit/df94703 + [14] = https://github.com/c-ares/c-ares/pull/400 + [15] = https://github.com/c-ares/c-ares/pull/401 + [16] = https://github.com/c-ares/c-ares/commit/362f91d + [17] = https://github.com/c-ares/c-ares/commit/44c009b + [18] = https://github.com/c-ares/c-ares/commit/c9b6c60 + [19] = https://github.com/c-ares/c-ares/pull/408 + + + + diff --git a/contrib/libs/c-ares/RELEASE-PROCEDURE.md b/contrib/libs/c-ares/RELEASE-PROCEDURE.md deleted file mode 100644 index b2fe58639b..0000000000 --- a/contrib/libs/c-ares/RELEASE-PROCEDURE.md +++ /dev/null @@ -1,53 +0,0 @@ -c-ares release procedure - how to do a release -============================================== - -in the source code repo ------------------------ - -- edit `RELEASE-NOTES` to be accurate - -- edit `Makefile.am`'s `CARES_VERSION_INFO`, and `CMakeLists.txt`'s - `CARES_LIB_VERSIONINFO` set to the same value to denote the current shared - object versioning. - -- make sure all relevant changes are committed on the master branch - -- tag the git repo in this style: `git tag -a cares-1_14_0` -a annotates the - tag and we use underscores instead of dots in the version number. - -- run "./maketgz 1.14.0" to build the release tarball. It is important that - you run this on a machine with the correct set of autotools etc installed - as this is what then will be shipped and used by most users on *nix like - systems. - -- push the git commits and the new tag - -- gpg sign the tarball - -- upload the resulting files to https://c-ares.haxx.se/download/ - -- update `ares_version.h` for the next version - -in the c-ares-www repo ----------------------- - -- edit `index.t` (version number and date), - -- edit `changelog.t` (add the new release in there) - -- commit all local changes - -- tag the repo with the same tag as used for the source repo - -- push the git commits and the new tag - -inform ------- - -- send an email to the c-ares mailing list. Insert the RELEASE-NOTES into the - mail. - -celebrate ---------- - -- suitable beverage intake is encouraged for the festivities diff --git a/contrib/libs/c-ares/SECURITY.md b/contrib/libs/c-ares/SECURITY.md new file mode 100644 index 0000000000..3f2a457aff --- /dev/null +++ b/contrib/libs/c-ares/SECURITY.md @@ -0,0 +1,100 @@ +c-ares security +=============== + +This document is intended to provide guidance on how security vulnerabilities +should be handled in the c-ares project. + +Publishing Information +---------------------- + +All known and public c-ares vulnerabilities will be listed on [the c-ares web +site](https://c-ares.haxx.se/vulns.html). + +Security vulnerabilities should not be entered in the project's public bug +tracker unless the necessary configuration is in place to limit access to the +issue to only the reporter and the project's security team. + +Vulnerability Handling +---------------------- + +The typical process for handling a new security vulnerability is as follows. + +No information should be made public about a vulnerability until it is +formally announced at the end of this process. That means, for example that a +bug tracker entry must NOT be created to track the issue since that will make +the issue public and it should not be discussed on the project's public +mailing list. Also messages associated with any commits should not make any +reference to the security nature of the commit if done prior to the public +announcement. + +- The person discovering the issue, the reporter, reports the vulnerability + privately to `c-ares-security@haxx.se`. That's an email alias that reaches a + handful of selected and trusted people. + +- Messages that do not relate to the reporting or managing of an undisclosed + security vulnerability in c-ares are ignored and no further action is + required. + +- A person in the security team sends an e-mail to the original reporter to + acknowledge the report. + +- The security team investigates the report and either rejects it or accepts + it. + +- If the report is rejected, the team writes to the reporter to explain why. + +- If the report is accepted, the team writes to the reporter to let him/her + know it is accepted and that they are working on a fix. + +- The security team discusses the problem, works out a fix, considers the + impact of the problem and suggests a release schedule. This discussion + should involve the reporter as much as possible. + +- The release of the information should be "as soon as possible" and is most + often synced with an upcoming release that contains the fix. If the + reporter, or anyone else, thinks the next planned release is too far away + then a separate earlier release for security reasons should be considered. + +- Write a security advisory draft about the problem that explains what the + problem is, its impact, which versions it affects, solutions or + workarounds, when the release is out and make sure to credit all + contributors properly. + +- Request a CVE number from + [distros@openwall](http://oss-security.openwall.org/wiki/mailing-lists/distros) + when also informing and preparing them for the upcoming public security + vulnerability announcement - attach the advisory draft for information. Note + that 'distros' won't accept an embargo longer than 19 days. + +- Update the "security advisory" with the CVE number. + +- The security team commits the fix in a private branch. The commit message + should ideally contain the CVE number. This fix is usually also distributed + to the 'distros' mailing list to allow them to use the fix prior to the + public announcement. + +- At the day of the next release, the private branch is merged into the master + branch and pushed. Once pushed, the information is accessible to the public + and the actual release should follow suit immediately afterwards. + +- The project team creates a release that includes the fix. + +- The project team announces the release and the vulnerability to the world in + the same manner we always announce releases. It gets sent to the c-ares + mailing list and the oss-security mailing list. + +- The security web page on the web site should get the new vulnerability + mentioned. + +C-ARES-SECURITY (at haxx dot se) +-------------------------------- + +Who is on this list? There are a couple of criteria you must meet, and then we +might ask you to join the list or you can ask to join it. It really isn't very +formal. We basically only require that you have a long-term presence in the +c-ares project and you have shown an understanding for the project and its way +of working. You must've been around for a good while and you should have no +plans in vanishing in the near future. + +We do not make the list of partipants public mostly because it tends to vary +somewhat over time and a list somewhere will only risk getting outdated. diff --git a/contrib/libs/c-ares/acountry/ya.make b/contrib/libs/c-ares/acountry/ya.make index 58b533d30c..28e8cd4b8d 100644 --- a/contrib/libs/c-ares/acountry/ya.make +++ b/contrib/libs/c-ares/acountry/ya.make @@ -2,7 +2,12 @@ PROGRAM(acountry) -OWNER(max42 g:cpp-contrib) +WITHOUT_LICENSE_TEXTS() + +OWNER( + max42 + g:cpp-contrib +) LICENSE(MIT) @@ -11,7 +16,8 @@ PEERDIR( ) ADDINCL( - contrib/libs/c-ares + contrib/libs/c-ares/include + contrib/libs/c-ares/src/lib ) NO_COMPILER_WARNINGS() @@ -20,7 +26,7 @@ CFLAGS( -DHAVE_CONFIG_H ) -SRCDIR(contrib/libs/c-ares) +SRCDIR(contrib/libs/c-ares/src) IF (NOT DLL_FOR) CFLAGS( @@ -29,7 +35,7 @@ IF (NOT DLL_FOR) ENDIF() SRCS( - acountry.c + tools/acountry.c ) END() diff --git a/contrib/libs/c-ares/adig/ya.make b/contrib/libs/c-ares/adig/ya.make index 1c8404ebee..429941933e 100644 --- a/contrib/libs/c-ares/adig/ya.make +++ b/contrib/libs/c-ares/adig/ya.make @@ -2,7 +2,12 @@ PROGRAM(adig) -OWNER(max42 g:cpp-contrib) +WITHOUT_LICENSE_TEXTS() + +OWNER( + max42 + g:cpp-contrib +) LICENSE(MIT) @@ -11,7 +16,8 @@ PEERDIR( ) ADDINCL( - contrib/libs/c-ares + contrib/libs/c-ares/include + contrib/libs/c-ares/src/lib ) NO_COMPILER_WARNINGS() @@ -20,7 +26,7 @@ CFLAGS( -DHAVE_CONFIG_H ) -SRCDIR(contrib/libs/c-ares) +SRCDIR(contrib/libs/c-ares/src) IF (NOT DLL_FOR) CFLAGS( @@ -29,7 +35,7 @@ IF (NOT DLL_FOR) ENDIF() SRCS( - adig.c + tools/adig.c ) END() diff --git a/contrib/libs/c-ares/ahost/ya.make b/contrib/libs/c-ares/ahost/ya.make index 299e3f211c..f02924564f 100644 --- a/contrib/libs/c-ares/ahost/ya.make +++ b/contrib/libs/c-ares/ahost/ya.make @@ -2,7 +2,12 @@ PROGRAM(ahost) -OWNER(max42 g:cpp-contrib) +WITHOUT_LICENSE_TEXTS() + +OWNER( + max42 + g:cpp-contrib +) LICENSE(MIT) @@ -11,7 +16,8 @@ PEERDIR( ) ADDINCL( - contrib/libs/c-ares + contrib/libs/c-ares/include + contrib/libs/c-ares/src/lib ) NO_COMPILER_WARNINGS() @@ -20,7 +26,7 @@ CFLAGS( -DHAVE_CONFIG_H ) -SRCDIR(contrib/libs/c-ares) +SRCDIR(contrib/libs/c-ares/src) IF (NOT DLL_FOR) CFLAGS( @@ -29,7 +35,7 @@ IF (NOT DLL_FOR) ENDIF() SRCS( - ahost.c + tools/ahost.c ) END() diff --git a/contrib/libs/c-ares/ares_build.h b/contrib/libs/c-ares/ares_build.h deleted file mode 100644 index e0a2ed784b..0000000000 --- a/contrib/libs/c-ares/ares_build.h +++ /dev/null @@ -1,211 +0,0 @@ -#ifndef __CARES_BUILD_H -#define __CARES_BUILD_H - - -/* Copyright (C) 2009 - 2013 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 */ -/* ================================================================ */ - -/* - * NOTE 1: - * ------- - * - * See file ares_build.h.in, run configure, and forget that this file - * exists it is only used for non-configure systems. - * But you can keep reading if you want ;-) - * - */ - -/* ================================================================ */ -/* NOTES FOR NON-CONFIGURE SYSTEMS */ -/* ================================================================ */ - -/* - * NOTE 1: - * ------- - * - * Nothing in this file is intended to be modified or adjusted by the - * c-ares library user nor by the c-ares library builder. - * - * If you think that something actually needs to be changed, adjusted - * or fixed in this file, then, report it on the c-ares development - * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/ - * - * Try to keep one section per platform, compiler and architecture, - * otherwise, if an existing section is reused for a different one and - * later on the original is adjusted, probably the piggybacking one can - * be adversely changed. - * - * In order to differentiate between platforms/compilers/architectures - * use only compiler built in predefined preprocessor symbols. - * - * This header file shall only export symbols which are 'cares' or 'CARES' - * prefixed, otherwise public name space would be polluted. - * - * NOTE 2: - * ------- - * - * Right now you might be staring at file ares_build.h.dist or ares_build.h, - * this is due to the following reason: file ares_build.h.dist is renamed - * to ares_build.h when the c-ares source code distribution archive file is - * created. - * - * File ares_build.h.dist is not included in the distribution archive. - * File ares_build.h is not present in the git tree. - * - * The distributed ares_build.h file is only intended to be used on systems - * which can not run the also distributed configure script. - * - * On systems capable of running the configure script, the configure process - * will overwrite the distributed ares_build.h file with one that is suitable - * and specific to the library being configured and built, which is generated - * from the ares_build.h.in template file. - * - * If you check out from git on a non-configure platform, you must run the - * appropriate buildconf* script to set up ares_build.h and other local files. - * - */ - -/* ================================================================ */ -/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ -/* ================================================================ */ - -#ifdef CARES_TYPEOF_ARES_SOCKLEN_T -# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" - Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined -#endif - -/* ================================================================ */ -/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */ -/* ================================================================ */ - -#if defined(__DJGPP__) || defined(__GO32__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__SALFORDC__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__BORLANDC__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__TURBOC__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__WATCOMC__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__POCC__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__LCC__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__SYMBIAN32__) -# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int - -#elif defined(__MWERKS__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(_WIN32_WCE) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__MINGW32__) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -#elif defined(__VMS) -# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int - -#elif defined(__OS400__) -# if defined(__ILEC400__) -# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t -# define CARES_PULL_SYS_TYPES_H 1 -# define CARES_PULL_SYS_SOCKET_H 1 -# endif - -#elif defined(__MVS__) -# if defined(__IBMC__) || defined(__IBMCPP__) -# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t -# define CARES_PULL_SYS_TYPES_H 1 -# define CARES_PULL_SYS_SOCKET_H 1 -# endif - -#elif defined(__370__) -# if defined(__IBMC__) || defined(__IBMCPP__) -# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t -# define CARES_PULL_SYS_TYPES_H 1 -# define CARES_PULL_SYS_SOCKET_H 1 -# endif - -#elif defined(TPF) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -/* ===================================== */ -/* KEEP MSVC THE PENULTIMATE ENTRY */ -/* ===================================== */ - -#elif defined(_MSC_VER) -# define CARES_TYPEOF_ARES_SOCKLEN_T int - -/* ===================================== */ -/* KEEP GENERIC GCC THE LAST ENTRY */ -/* ===================================== */ - -#elif defined(__GNUC__) -# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t -# define CARES_PULL_SYS_TYPES_H 1 -# define CARES_PULL_SYS_SOCKET_H 1 - -#else -# error "Unknown non-configure build target!" - Error Compilation_aborted_Unknown_non_configure_build_target -#endif - -/* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file */ -/* sys/types.h is required here to properly make type definitions below. */ -#ifdef CARES_PULL_SYS_TYPES_H -# include <sys/types.h> -#endif - -/* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file */ -/* sys/socket.h is required here to properly make type definitions below. */ -#ifdef CARES_PULL_SYS_SOCKET_H -#ifdef _WIN32 -# include <ws2tcpip.h> -#else -# include <sys/socket.h> -#endif -#endif - -/* Data type definition of ares_socklen_t. */ - -#ifdef CARES_TYPEOF_ARES_SOCKLEN_T - typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; -#endif - -/* Data type definition of ares_ssize_t. */ -#ifdef _WIN32 -# ifdef _WIN64 -# define CARES_TYPEOF_ARES_SSIZE_T __int64 -# else -# define CARES_TYPEOF_ARES_SSIZE_T long -# endif -#else -# define CARES_TYPEOF_ARES_SSIZE_T ssize_t -#endif - -typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; - -#endif /* __CARES_BUILD_H */ diff --git a/contrib/libs/c-ares/config-dos.h b/contrib/libs/c-ares/config-dos.h deleted file mode 100644 index 114db511c6..0000000000 --- a/contrib/libs/c-ares/config-dos.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef HEADER_CONFIG_DOS_H -#define HEADER_CONFIG_DOS_H - - -/* ================================================================ */ -/* ares/config-dos.h - Hand crafted config file for DOS */ -/* ================================================================ */ - -#define PACKAGE "c-ares" - -#define HAVE_ERRNO_H 1 -#define HAVE_GETENV 1 -#define HAVE_GETTIMEOFDAY 1 -#define HAVE_IOCTLSOCKET 1 -#define HAVE_IOCTLSOCKET_FIONBIO 1 -#define HAVE_LIMITS_H 1 -#define HAVE_NET_IF_H 1 -#define HAVE_RECV 1 -#define HAVE_RECVFROM 1 -#define HAVE_SEND 1 -#define HAVE_STRDUP 1 -#define HAVE_STRICMP 1 -#define HAVE_STRUCT_IN6_ADDR 1 -#define HAVE_STRUCT_TIMEVAL 1 -#define HAVE_SYS_IOCTL_H 1 -#define HAVE_SYS_SOCKET_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_TIME_H 1 -#define HAVE_UNISTD_H 1 - -#define NEED_MALLOC_H 1 - -#define RETSIGTYPE void -#define TIME_WITH_SYS_TIME 1 - -/* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */ - -#define SEND_TYPE_ARG1 int -#define SEND_QUAL_ARG2 const -#define SEND_TYPE_ARG2 void * -#define SEND_TYPE_ARG3 int -#define SEND_TYPE_ARG4 int -#define SEND_TYPE_RETV int - -#define RECV_TYPE_ARG1 int -#define RECV_TYPE_ARG2 void * -#define RECV_TYPE_ARG3 int -#define RECV_TYPE_ARG4 int -#define RECV_TYPE_RETV int - -#define RECVFROM_TYPE_ARG1 int -#define RECVFROM_TYPE_ARG2 void -#define RECVFROM_TYPE_ARG3 int -#define RECVFROM_TYPE_ARG4 int -#define RECVFROM_TYPE_ARG5 struct sockaddr -#define RECVFROM_TYPE_ARG6 int -#define RECVFROM_TYPE_RETV int -#define RECVFROM_TYPE_ARG2_IS_VOID 1 - -#define BSD - -/* Target HAVE_x section */ - -#if defined(DJGPP) - #define HAVE_STRCASECMP 1 - #define HAVE_STRNCASECMP 1 - #define HAVE_SYS_TIME_H 1 - #define HAVE_VARIADIC_MACROS_GCC 1 - - /* Because djgpp <= 2.03 doesn't have snprintf() etc. */ - #if (DJGPP_MINOR < 4) - #define _MPRINTF_REPLACE - #endif - -#elif defined(__WATCOMC__) - #define HAVE_STRCASECMP 1 - -#elif defined(__HIGHC__) - #define HAVE_SYS_TIME_H 1 - #define strerror(e) strerror_s_((e)) -#endif - -#ifdef WATT32 - #define HAVE_AF_INET6 1 - #define HAVE_ARPA_INET_H 1 - #define HAVE_ARPA_NAMESER_H 1 - #define HAVE_CLOSE_S 1 - #define HAVE_GETHOSTNAME 1 - #define HAVE_NETDB_H 1 - #define HAVE_NETINET_IN_H 1 - #define HAVE_NETINET_TCP_H 1 - #define HAVE_PF_INET6 1 - #define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1 - #define HAVE_STRUCT_ADDRINFO 1 - #define HAVE_STRUCT_IN6_ADDR 1 - #define HAVE_STRUCT_SOCKADDR_IN6 1 - #define HAVE_SYS_SOCKET_H 1 - #define HAVE_SYS_UIO_H 1 - #define NS_INADDRSZ 4 - #define HAVE_STRUCT_SOCKADDR_IN6 1 -#endif - -#undef word -#undef byte - -#endif /* HEADER_CONFIG_DOS_H */ - diff --git a/contrib/libs/c-ares/ares.h b/contrib/libs/c-ares/include/ares.h index 3f8a6954d0..353e994a3f 100644 --- a/contrib/libs/c-ares/ares.h +++ b/contrib/libs/c-ares/include/ares.h @@ -39,7 +39,7 @@ #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ - defined(__QNXNTO__) + defined(__QNXNTO__) || defined(__MVS__) #include <sys/select.h> #endif #if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) @@ -533,6 +533,15 @@ struct ares_addr6ttl { int ttl; }; +struct ares_caa_reply { + struct ares_caa_reply *next; + int critical; + unsigned char *property; + size_t plength; /* plength excludes null termination */ + unsigned char *value; + size_t length; /* length excludes null termination */ +}; + struct ares_srv_reply { struct ares_srv_reply *next; char *host; @@ -648,6 +657,10 @@ CARES_EXTERN int ares_parse_aaaa_reply(const unsigned char *abuf, struct ares_addr6ttl *addrttls, int *naddrttls); +CARES_EXTERN int ares_parse_caa_reply(const unsigned char* abuf, + int alen, + struct ares_caa_reply** caa_out); + CARES_EXTERN int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, diff --git a/contrib/libs/c-ares/include/ares_build.h b/contrib/libs/c-ares/include/ares_build.h new file mode 100644 index 0000000000..2ed5a82b80 --- /dev/null +++ b/contrib/libs/c-ares/include/ares_build.h @@ -0,0 +1,115 @@ +/* include/ares_build.h. Generated from ares_build.h.in by configure. */ +#ifndef __CARES_BUILD_H +#define __CARES_BUILD_H + + +/* Copyright (C) 2009 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 */ +/* ================================================================ */ + +/* + * NOTE 1: + * ------- + * + * Nothing in this file is intended to be modified or adjusted by the + * c-ares library user nor by the c-ares library builder. + * + * If you think that something actually needs to be changed, adjusted + * or fixed in this file, then, report it on the c-ares development + * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/ + * + * This header file shall only export symbols which are 'cares' or 'CARES' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file ares_build.h.in or ares_build.h, + * this is due to the following reason: + * + * On systems capable of running the configure script, the configure process + * will overwrite the distributed ares_build.h file with one that is suitable + * and specific to the library being configured and built, which is generated + * from the ares_build.h.in template file. + * + */ + +/* ================================================================ */ +/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ +/* ================================================================ */ + +#ifdef CARES_TYPEOF_ARES_SOCKLEN_T +# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" + Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined +#endif + +/* ================================================================ */ +/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +#ifdef _WIN32 +# define CARES_PULL_WS2TCPIP_H 1 +#endif +#ifdef CARES_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include <windows.h> +# include <winsock2.h> +# include <ws2tcpip.h> +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +#ifndef _WIN32 +# define CARES_PULL_SYS_TYPES_H 1 +#endif +#ifdef CARES_PULL_SYS_TYPES_H +# include <sys/types.h> +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +#ifndef _WIN32 +# define CARES_PULL_SYS_SOCKET_H 1 +#endif +#ifdef CARES_PULL_SYS_SOCKET_H +# include <sys/socket.h> +#endif + +/* Integral data type used for ares_socklen_t. */ +#ifdef _WIN32 +# define CARES_TYPEOF_ARES_SOCKLEN_T int +#else +# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t +#endif + +/* Data type definition of ares_socklen_t. */ +typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; + +/* Integral data type used for ares_ssize_t. */ +#ifdef _WIN32 +# define CARES_TYPEOF_ARES_SSIZE_T __int64 +#else +# define CARES_TYPEOF_ARES_SSIZE_T ssize_t +#endif + +/* Data type definition of ares_ssize_t. */ +typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; + +#endif /* __CARES_BUILD_H */ diff --git a/contrib/libs/c-ares/ares_dns.h b/contrib/libs/c-ares/include/ares_dns.h index 79f993b904..bc8aa7b109 100644 --- a/contrib/libs/c-ares/ares_dns.h +++ b/contrib/libs/c-ares/include/ares_dns.h @@ -17,6 +17,15 @@ */ /* + * NOTE TO INTEGRATORS: + * + * This header is made public due to legacy projects relying on it. + * Please do not use the macros within this header, or include this + * header in your project as it may be removed in the future. + */ + + +/* * Macro DNS__16BIT reads a network short (16 bit) given in network * byte order, and returns its value as an unsigned short. */ diff --git a/contrib/libs/c-ares/ares_rules.h b/contrib/libs/c-ares/include/ares_rules.h index cac23cf2e3..cac23cf2e3 100644 --- a/contrib/libs/c-ares/ares_rules.h +++ b/contrib/libs/c-ares/include/ares_rules.h diff --git a/contrib/libs/c-ares/ares_version.h b/contrib/libs/c-ares/include/ares_version.h index c041d574de..de1ac8424c 100644 --- a/contrib/libs/c-ares/ares_version.h +++ b/contrib/libs/c-ares/include/ares_version.h @@ -6,12 +6,12 @@ #define ARES_COPYRIGHT "2004 - 2020 Daniel Stenberg, <daniel@haxx.se>." #define ARES_VERSION_MAJOR 1 -#define ARES_VERSION_MINOR 16 -#define ARES_VERSION_PATCH 1 +#define ARES_VERSION_MINOR 17 +#define ARES_VERSION_PATCH 2 #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ (ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.16.1" +#define ARES_VERSION_STR "1.17.2" #if (ARES_VERSION >= 0x010700) # define CARES_HAVE_ARES_LIBRARY_INIT 1 diff --git a/contrib/libs/c-ares/nameser.h b/contrib/libs/c-ares/nameser.h deleted file mode 100644 index a0302fd398..0000000000 --- a/contrib/libs/c-ares/nameser.h +++ /dev/null @@ -1,211 +0,0 @@ - -#ifndef ARES_NAMESER_H -#define ARES_NAMESER_H - -/* header file provided by liren@vivisimo.com */ - -#ifndef HAVE_ARPA_NAMESER_H - -#define NS_PACKETSZ 512 /* maximum packet size */ -#define NS_MAXDNAME 256 /* maximum domain name */ -#define NS_MAXCDNAME 255 /* maximum compressed domain name */ -#define NS_MAXLABEL 63 -#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ -#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ -#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ -#define NS_INT16SZ 2 -#define NS_INADDRSZ 4 -#define NS_IN6ADDRSZ 16 -#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ -#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ - -typedef enum __ns_class { - ns_c_invalid = 0, /* Cookie. */ - ns_c_in = 1, /* Internet. */ - ns_c_2 = 2, /* unallocated/unsupported. */ - ns_c_chaos = 3, /* MIT Chaos-net. */ - ns_c_hs = 4, /* MIT Hesiod. */ - /* Query class values which do not appear in resource records */ - ns_c_none = 254, /* for prereq. sections in update requests */ - ns_c_any = 255, /* Wildcard match. */ - ns_c_max = 65536 -} ns_class; - -typedef enum __ns_type { - ns_t_invalid = 0, /* Cookie. */ - ns_t_a = 1, /* Host address. */ - ns_t_ns = 2, /* Authoritative server. */ - ns_t_md = 3, /* Mail destination. */ - ns_t_mf = 4, /* Mail forwarder. */ - ns_t_cname = 5, /* Canonical name. */ - ns_t_soa = 6, /* Start of authority zone. */ - ns_t_mb = 7, /* Mailbox domain name. */ - ns_t_mg = 8, /* Mail group member. */ - ns_t_mr = 9, /* Mail rename name. */ - ns_t_null = 10, /* Null resource record. */ - ns_t_wks = 11, /* Well known service. */ - ns_t_ptr = 12, /* Domain name pointer. */ - ns_t_hinfo = 13, /* Host information. */ - ns_t_minfo = 14, /* Mailbox information. */ - ns_t_mx = 15, /* Mail routing information. */ - ns_t_txt = 16, /* Text strings. */ - ns_t_rp = 17, /* Responsible person. */ - ns_t_afsdb = 18, /* AFS cell database. */ - ns_t_x25 = 19, /* X_25 calling address. */ - ns_t_isdn = 20, /* ISDN calling address. */ - ns_t_rt = 21, /* Router. */ - ns_t_nsap = 22, /* NSAP address. */ - ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ - ns_t_sig = 24, /* Security signature. */ - ns_t_key = 25, /* Security key. */ - ns_t_px = 26, /* X.400 mail mapping. */ - ns_t_gpos = 27, /* Geographical position (withdrawn). */ - ns_t_aaaa = 28, /* Ip6 Address. */ - ns_t_loc = 29, /* Location Information. */ - ns_t_nxt = 30, /* Next domain (security). */ - ns_t_eid = 31, /* Endpoint identifier. */ - ns_t_nimloc = 32, /* Nimrod Locator. */ - ns_t_srv = 33, /* Server Selection. */ - ns_t_atma = 34, /* ATM Address */ - ns_t_naptr = 35, /* Naming Authority PoinTeR */ - ns_t_kx = 36, /* Key Exchange */ - ns_t_cert = 37, /* Certification record */ - ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ - ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ - ns_t_sink = 40, /* Kitchen sink (experimentatl) */ - ns_t_opt = 41, /* EDNS0 option (meta-RR) */ - ns_t_apl = 42, /* Address prefix list (RFC3123) */ - ns_t_ds = 43, /* Delegation Signer (RFC4034) */ - ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */ - ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */ - ns_t_nsec = 47, /* Next Secure (RFC4034) */ - ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */ - ns_t_tkey = 249, /* Transaction key */ - ns_t_tsig = 250, /* Transaction signature. */ - ns_t_ixfr = 251, /* Incremental zone transfer. */ - ns_t_axfr = 252, /* Transfer zone of authority. */ - ns_t_mailb = 253, /* Transfer mailbox records. */ - ns_t_maila = 254, /* Transfer mail agent records. */ - ns_t_any = 255, /* Wildcard match. */ - ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ - ns_t_max = 65536 -} ns_type; - -typedef enum __ns_opcode { - ns_o_query = 0, /* Standard query. */ - ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ - ns_o_status = 2, /* Name server status query (unsupported). */ - /* Opcode 3 is undefined/reserved. */ - ns_o_notify = 4, /* Zone change notification. */ - ns_o_update = 5, /* Zone update message. */ - ns_o_max = 6 -} ns_opcode; - -typedef enum __ns_rcode { - ns_r_noerror = 0, /* No error occurred. */ - ns_r_formerr = 1, /* Format error. */ - ns_r_servfail = 2, /* Server failure. */ - ns_r_nxdomain = 3, /* Name error. */ - ns_r_notimpl = 4, /* Unimplemented. */ - ns_r_refused = 5, /* Operation refused. */ - /* these are for BIND_UPDATE */ - ns_r_yxdomain = 6, /* Name exists */ - ns_r_yxrrset = 7, /* RRset exists */ - ns_r_nxrrset = 8, /* RRset does not exist */ - ns_r_notauth = 9, /* Not authoritative for zone */ - ns_r_notzone = 10, /* Zone of record different from zone section */ - ns_r_max = 11, - /* The following are TSIG extended errors */ - ns_r_badsig = 16, - ns_r_badkey = 17, - ns_r_badtime = 18 -} ns_rcode; - -#endif /* HAVE_ARPA_NAMESER_H */ - -#ifndef HAVE_ARPA_NAMESER_COMPAT_H - -#define PACKETSZ NS_PACKETSZ -#define MAXDNAME NS_MAXDNAME -#define MAXCDNAME NS_MAXCDNAME -#define MAXLABEL NS_MAXLABEL -#define HFIXEDSZ NS_HFIXEDSZ -#define QFIXEDSZ NS_QFIXEDSZ -#define RRFIXEDSZ NS_RRFIXEDSZ -#define INDIR_MASK NS_CMPRSFLGS -#define NAMESERVER_PORT NS_DEFAULTPORT - -#define QUERY ns_o_query - -#define SERVFAIL ns_r_servfail -#define NOTIMP ns_r_notimpl -#define REFUSED ns_r_refused -#undef NOERROR /* it seems this is already defined in winerror.h */ -#define NOERROR ns_r_noerror -#define FORMERR ns_r_formerr -#define NXDOMAIN ns_r_nxdomain - -#define C_IN ns_c_in -#define C_CHAOS ns_c_chaos -#define C_HS ns_c_hs -#define C_NONE ns_c_none -#define C_ANY ns_c_any - -#define T_A ns_t_a -#define T_NS ns_t_ns -#define T_MD ns_t_md -#define T_MF ns_t_mf -#define T_CNAME ns_t_cname -#define T_SOA ns_t_soa -#define T_MB ns_t_mb -#define T_MG ns_t_mg -#define T_MR ns_t_mr -#define T_NULL ns_t_null -#define T_WKS ns_t_wks -#define T_PTR ns_t_ptr -#define T_HINFO ns_t_hinfo -#define T_MINFO ns_t_minfo -#define T_MX ns_t_mx -#define T_TXT ns_t_txt -#define T_RP ns_t_rp -#define T_AFSDB ns_t_afsdb -#define T_X25 ns_t_x25 -#define T_ISDN ns_t_isdn -#define T_RT ns_t_rt -#define T_NSAP ns_t_nsap -#define T_NSAP_PTR ns_t_nsap_ptr -#define T_SIG ns_t_sig -#define T_KEY ns_t_key -#define T_PX ns_t_px -#define T_GPOS ns_t_gpos -#define T_AAAA ns_t_aaaa -#define T_LOC ns_t_loc -#define T_NXT ns_t_nxt -#define T_EID ns_t_eid -#define T_NIMLOC ns_t_nimloc -#define T_SRV ns_t_srv -#define T_ATMA ns_t_atma -#define T_NAPTR ns_t_naptr -#define T_KX ns_t_kx -#define T_CERT ns_t_cert -#define T_A6 ns_t_a6 -#define T_DNAME ns_t_dname -#define T_SINK ns_t_sink -#define T_OPT ns_t_opt -#define T_APL ns_t_apl -#define T_DS ns_t_ds -#define T_SSHFP ns_t_sshfp -#define T_RRSIG ns_t_rrsig -#define T_NSEC ns_t_nsec -#define T_DNSKEY ns_t_dnskey -#define T_TKEY ns_t_tkey -#define T_TSIG ns_t_tsig -#define T_IXFR ns_t_ixfr -#define T_AXFR ns_t_axfr -#define T_MAILB ns_t_mailb -#define T_MAILA ns_t_maila -#define T_ANY ns_t_any - -#endif /* HAVE_ARPA_NAMESER_COMPAT_H */ - -#endif /* ARES_NAMESER_H */ diff --git a/contrib/libs/c-ares/ares__close_sockets.c b/contrib/libs/c-ares/src/lib/ares__close_sockets.c index 0477174e3e..0477174e3e 100644 --- a/contrib/libs/c-ares/ares__close_sockets.c +++ b/contrib/libs/c-ares/src/lib/ares__close_sockets.c diff --git a/contrib/libs/c-ares/ares__get_hostent.c b/contrib/libs/c-ares/src/lib/ares__get_hostent.c index 367f39037b..367f39037b 100644 --- a/contrib/libs/c-ares/ares__get_hostent.c +++ b/contrib/libs/c-ares/src/lib/ares__get_hostent.c diff --git a/contrib/libs/c-ares/ares__parse_into_addrinfo.c b/contrib/libs/c-ares/src/lib/ares__parse_into_addrinfo.c index b0801632b4..7550abab4a 100644 --- a/contrib/libs/c-ares/ares__parse_into_addrinfo.c +++ b/contrib/libs/c-ares/src/lib/ares__parse_into_addrinfo.c @@ -24,14 +24,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H # include <strings.h> @@ -76,7 +70,7 @@ int ares__parse_into_addrinfo2(const unsigned char *abuf, /* Expand the name from the question, and skip past the question. */ aptr = abuf + HFIXEDSZ; - status = ares__expand_name_for_response(aptr, abuf, alen, question_hostname, &len); + status = ares__expand_name_for_response(aptr, abuf, alen, question_hostname, &len, 0); if (status != ARES_SUCCESS) return status; if (aptr + len + QFIXEDSZ > abuf + alen) @@ -92,7 +86,7 @@ int ares__parse_into_addrinfo2(const unsigned char *abuf, for (i = 0; i < (int)ancount; i++) { /* Decode the RR up to the data field. */ - status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len, 0); if (status != ARES_SUCCESS) { rr_name = NULL; @@ -194,7 +188,7 @@ int ares__parse_into_addrinfo2(const unsigned char *abuf, { got_cname = 1; status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, - &len); + &len, 1); if (status != ARES_SUCCESS) { goto failed_stat; diff --git a/contrib/libs/c-ares/ares__read_line.c b/contrib/libs/c-ares/src/lib/ares__read_line.c index c62ad2a2b4..c62ad2a2b4 100644 --- a/contrib/libs/c-ares/ares__read_line.c +++ b/contrib/libs/c-ares/src/lib/ares__read_line.c diff --git a/contrib/libs/c-ares/ares__readaddrinfo.c b/contrib/libs/c-ares/src/lib/ares__readaddrinfo.c index dd3abe2e9f..2b5bb40c3d 100644 --- a/contrib/libs/c-ares/ares__readaddrinfo.c +++ b/contrib/libs/c-ares/src/lib/ares__readaddrinfo.c @@ -163,6 +163,10 @@ int ares__readaddrinfo(FILE *fp, continue; } + /* Zero-out 'addr' struct, as there are members that we may not set, especially + * for ipv6. We don't want garbage data */ + memset(&addr, 0, sizeof(addr)); + /* * Convert address string to network address for the requested families. * Actual address family possible values are AF_INET and AF_INET6 only. @@ -179,7 +183,7 @@ int ares__readaddrinfo(FILE *fp, } node->ai_family = addr.sa.sa_family = AF_INET; - node->ai_addrlen = sizeof(sizeof(addr.sa4)); + node->ai_addrlen = sizeof(addr.sa4); node->ai_addr = ares_malloc(sizeof(addr.sa4)); if (!node->ai_addr) { @@ -200,7 +204,7 @@ int ares__readaddrinfo(FILE *fp, } node->ai_family = addr.sa.sa_family = AF_INET6; - node->ai_addrlen = sizeof(sizeof(addr.sa6)); + node->ai_addrlen = sizeof(addr.sa6); node->ai_addr = ares_malloc(sizeof(addr.sa6)); if (!node->ai_addr) { diff --git a/contrib/libs/c-ares/ares__sortaddrinfo.c b/contrib/libs/c-ares/src/lib/ares__sortaddrinfo.c index c0e2ea1528..6e56cc9023 100644 --- a/contrib/libs/c-ares/ares__sortaddrinfo.c +++ b/contrib/libs/c-ares/src/lib/ares__sortaddrinfo.c @@ -385,7 +385,7 @@ static int find_src_addr(ares_channel channel, const struct sockaddr *addr, struct sockaddr *src_addr) { - int sock; + ares_socket_t sock; int ret; ares_socklen_t len; @@ -403,7 +403,7 @@ static int find_src_addr(ares_channel channel, } sock = ares__open_socket(channel, addr->sa_family, SOCK_DGRAM, IPPROTO_UDP); - if (sock == -1) + if (sock == ARES_SOCKET_BAD) { if (errno == EAFNOSUPPORT) { @@ -427,7 +427,7 @@ static int find_src_addr(ares_channel channel, return 0; } - if (getsockname(sock, src_addr, &len) == -1) + if (getsockname(sock, src_addr, &len) != 0) { ares__close_socket(channel, sock); return -1; @@ -453,6 +453,10 @@ int ares__sortaddrinfo(ares_channel channel, struct ares_addrinfo_node *list_sen ++nelem; cur = cur->ai_next; } + + if (!nelem) + return ARES_ENODATA; + elems = (struct addrinfo_sort_elem *)ares_malloc( nelem * sizeof(struct addrinfo_sort_elem)); if (!elems) diff --git a/contrib/libs/c-ares/ares__timeval.c b/contrib/libs/c-ares/src/lib/ares__timeval.c index 94efb7db1e..94efb7db1e 100644 --- a/contrib/libs/c-ares/ares__timeval.c +++ b/contrib/libs/c-ares/src/lib/ares__timeval.c diff --git a/contrib/libs/c-ares/ares_android.c b/contrib/libs/c-ares/src/lib/ares_android.c index 5b00b8065c..5b00b8065c 100644 --- a/contrib/libs/c-ares/ares_android.c +++ b/contrib/libs/c-ares/src/lib/ares_android.c diff --git a/contrib/libs/c-ares/ares_android.h b/contrib/libs/c-ares/src/lib/ares_android.h index 93fb75f585..93fb75f585 100644 --- a/contrib/libs/c-ares/ares_android.h +++ b/contrib/libs/c-ares/src/lib/ares_android.h diff --git a/contrib/libs/c-ares/ares_cancel.c b/contrib/libs/c-ares/src/lib/ares_cancel.c index 465cc9e95e..465cc9e95e 100644 --- a/contrib/libs/c-ares/ares_cancel.c +++ b/contrib/libs/c-ares/src/lib/ares_cancel.c diff --git a/contrib/libs/c-ares/src/lib/ares_config-android.h b/contrib/libs/c-ares/src/lib/ares_config-android.h new file mode 100644 index 0000000000..4d0d3640d2 --- /dev/null +++ b/contrib/libs/c-ares/src/lib/ares_config-android.h @@ -0,0 +1,6 @@ +#pragma once + +#include "ares_config-linux.h" + +#undef HAVE_ARPA_NAMESER_COMPAT_H +#undef HAVE_GETSERVBYPORT_R diff --git a/contrib/libs/c-ares/ares_config.h b/contrib/libs/c-ares/src/lib/ares_config-linux.h index 6695a6ad21..8562530d63 100644 --- a/contrib/libs/c-ares/ares_config.h +++ b/contrib/libs/c-ares/src/lib/ares_config-linux.h @@ -1,5 +1,5 @@ -/* ares_config.h. Generated from ares_config.h.in by configure. */ -/* ares_config.h.in. Generated from configure.ac by autoheader. */ +/* src/lib/ares_config.h. Generated from ares_config.h.in by configure. */ +/* src/lib/ares_config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ /* #undef AC_APPLE_UNIVERSAL_BUILD */ @@ -7,12 +7,24 @@ /* define this if ares is built for a big endian system */ /* #undef ARES_BIG_ENDIAN */ -/* when building as static part of libcurl */ -/* #undef BUILDING_LIBCURL */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ + +/* a suitable file/device to read random data from */ +#define CARES_RANDOM_FILE "/dev/urandom" + +/* Defined for build with symbol hiding. */ +#define CARES_SYMBOL_HIDING 1 /* Definition to make a library symbol externally visible. */ #define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((__visibility__ ("default"))) +/* the signed version of size_t */ +#define CARES_TYPEOF_ARES_SSIZE_T ssize_t + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ + /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ @@ -46,11 +58,8 @@ /* Define to 1 if you have the <arpa/inet.h> header file. */ #define HAVE_ARPA_INET_H 1 -#if defined(__ANDROID__) -#else /* Define to 1 if you have the <arpa/nameser_compat.h> header file. */ #define HAVE_ARPA_NAMESER_COMPAT_H 1 -#endif /* Define to 1 if you have the <arpa/nameser.h> header file. */ #define HAVE_ARPA_NAMESER_H 1 @@ -65,7 +74,7 @@ #define HAVE_BOOL_T 1 /* Define to 1 if you have the clock_gettime function and monotonic timer. */ -// #define HAVE_CLOCK_GETTIME_MONOTONIC 1 +#define HAVE_CLOCK_GETTIME_MONOTONIC 1 /* Define to 1 if you have the closesocket function. */ /* #undef HAVE_CLOSESOCKET */ @@ -76,6 +85,9 @@ /* Define to 1 if you have the connect function. */ #define HAVE_CONNECT 1 +/* define if the compiler supports basic C++11 syntax */ +#define HAVE_CXX11 1 + /* Define to 1 if you have the <dlfcn.h> header file. */ #define HAVE_DLFCN_H 1 @@ -118,14 +130,6 @@ /* Define to 1 if you have the getservbyport_r function. */ #define HAVE_GETSERVBYPORT_R 1 -#if defined(__APPLE__) -#undef HAVE_GETSERVBYPORT_R -#endif - -#if defined(__ANDROID__) -#undef HAVE_GETSERVBYPORT_R -#endif - /* Define to 1 if you have the `gettimeofday' function. */ #define HAVE_GETTIMEOFDAY 1 @@ -139,7 +143,7 @@ #define HAVE_INET_NTOP 1 /* Define to 1 if you have a IPv6 capable working inet_pton function. */ -// #define HAVE_INET_PTON 1 +#define HAVE_INET_PTON 1 /* Define to 1 if you have the <inttypes.h> header file. */ #define HAVE_INTTYPES_H 1 @@ -185,11 +189,7 @@ #define HAVE_MEMORY_H 1 /* Define to 1 if you have the MSG_NOSIGNAL flag. */ -#if defined(__FreeBSD__) && (__FreeBSD__ < 5) -/* #undef HAVE_MSG_NOSIGNAL */ -#else #define HAVE_MSG_NOSIGNAL 1 -#endif /* Define to 1 if you have the <netdb.h> header file. */ #define HAVE_NETDB_H 1 @@ -254,8 +254,8 @@ /* Define to 1 if you have the strcmpi function. */ /* #undef HAVE_STRCMPI */ -/* Potential ares_malloc/ares_free mismatch in ares_strdup.c/ares_strsplit.c. */ -/* #undef HAVE_STRDUP */ +/* Define to 1 if you have the strdup function. */ +#define HAVE_STRDUP 1 /* Define to 1 if you have the stricmp function. */ /* #undef HAVE_STRICMP */ @@ -276,7 +276,7 @@ /* #undef HAVE_STRNICMP */ /* Define to 1 if you have the <stropts.h> header file. */ -#define HAVE_STROPTS_H 1 +/* #undef HAVE_STROPTS_H */ /* Define to 1 if you have struct addrinfo. */ #define HAVE_STRUCT_ADDRINFO 1 @@ -338,8 +338,10 @@ /* Define to 1 if you have the ws2tcpip.h header file. */ /* #undef HAVE_WS2TCPIP_H */ -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ +/* Define if __system_property_get exists. */ +/* #undef HAVE___SYSTEM_PROPERTY_GET */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" /* Define to 1 if you need the malloc.h header file even with stdlib.h */ @@ -354,11 +356,8 @@ /* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ /* #undef NEED_THREAD_SAFE */ -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -/* #undef NO_MINUS_C_MINUS_O */ - /* cpu-machine-OS */ -#define OS "x86_64-unknown-linux-gnu" +#define OS "x86_64-pc-linux-gnu" /* Name of package */ #define PACKAGE "c-ares" @@ -370,7 +369,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.15.0" +#define PACKAGE_STRING "c-ares 1.17.2" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -379,13 +378,10 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.15.0" - -/* a suitable file/device to read random data from */ -#define RANDOM_FILE "/dev/urandom" +#define PACKAGE_VERSION "1.17.2" /* Define to the type qualifier pointed by arg 5 for recvfrom. */ -#define RECVFROM_QUAL_ARG5 +#define RECVFROM_QUAL_ARG5 /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -453,34 +449,6 @@ /* Define to the function return type for send. */ #define SEND_TYPE_RETV ssize_t -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -#if defined(_MSC_VER) -#define SIZEOF_LONG 4 -#elif defined(__SIZEOF_LONG__) -#define SIZEOF_LONG __SIZEOF_LONG__ -#else -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 -#endif - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -#if defined(__SIZEOF_SIZE_T__) -#define SIZEOF_SIZE_T __SIZEOF_SIZE_T__ -#else -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 -#endif - -/* The size of `struct in6_addr', as computed by sizeof. */ -#define SIZEOF_STRUCT_IN6_ADDR 16 - -/* The size of `struct in_addr', as computed by sizeof. */ -#define SIZEOF_STRUCT_IN_ADDR 4 - /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -491,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.15.0" +#define VERSION "1.17.2" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ @@ -532,6 +500,3 @@ /* Define to `unsigned int' if <sys/types.h> does not define. */ /* #undef size_t */ - -/* the signed version of size_t */ -/* #undef ssize_t */ diff --git a/contrib/libs/c-ares/src/lib/ares_config-osx.h b/contrib/libs/c-ares/src/lib/ares_config-osx.h new file mode 100644 index 0000000000..7c380b3d61 --- /dev/null +++ b/contrib/libs/c-ares/src/lib/ares_config-osx.h @@ -0,0 +1,5 @@ +#pragma once + +#include "ares_config-linux.h" + +#undef HAVE_GETSERVBYPORT_R diff --git a/contrib/libs/c-ares/src/lib/ares_config.h b/contrib/libs/c-ares/src/lib/ares_config.h new file mode 100644 index 0000000000..6f5d63ac7d --- /dev/null +++ b/contrib/libs/c-ares/src/lib/ares_config.h @@ -0,0 +1,9 @@ +#pragma once + +#if defined(__ANDROID__) +# include "ares_config-android.h" +#elif defined(__APPLE__) +# include "ares_config-osx.h" +#else +# include "ares_config-linux.h" +#endif diff --git a/contrib/libs/c-ares/ares_create_query.c b/contrib/libs/c-ares/src/lib/ares_create_query.c index 9efce17cfa..e3d874b450 100644 --- a/contrib/libs/c-ares/ares_create_query.c +++ b/contrib/libs/c-ares/src/lib/ares_create_query.c @@ -19,22 +19,13 @@ #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_dns.h" #include "ares_private.h" -#ifndef T_OPT -# define T_OPT 41 /* EDNS0 option (meta-RR) */ -#endif /* Header format, from RFC 1035: * 1 1 1 1 1 1 @@ -57,7 +48,7 @@ * of the remaining fields: * ID Identifier to match responses with queries * QR Query (0) or response (1) - * Opcode For our purposes, always QUERY + * Opcode For our purposes, always O_QUERY * RD Recursion desired * Z Reserved (zero) * QDCOUNT Number of queries @@ -116,7 +107,7 @@ int ares_create_query(const char *name, int dnsclass, int type, q = buf; memset(q, 0, HFIXEDSZ); DNS_HEADER_SET_QID(q, id); - DNS_HEADER_SET_OPCODE(q, QUERY); + DNS_HEADER_SET_OPCODE(q, O_QUERY); if (rd) { DNS_HEADER_SET_RD(q, 1); } diff --git a/contrib/libs/c-ares/ares_data.c b/contrib/libs/c-ares/src/lib/ares_data.c index 18dd650c7b..aa925b8b51 100644 --- a/contrib/libs/c-ares/ares_data.c +++ b/contrib/libs/c-ares/src/lib/ares_data.c @@ -119,6 +119,16 @@ void ares_free_data(void *dataptr) ares_free(ptr->data.soa_reply.hostmaster); break; + case ARES_DATATYPE_CAA_REPLY: + + if (ptr->data.caa_reply.next) + next_data = ptr->data.caa_reply.next; + if (ptr->data.caa_reply.property) + ares_free(ptr->data.caa_reply.property); + if (ptr->data.caa_reply.value) + ares_free(ptr->data.caa_reply.value); + break; + default: return; } @@ -174,6 +184,14 @@ void *ares_malloc_data(ares_datatype type) ptr->data.txt_reply.length = 0; break; + case ARES_DATATYPE_CAA_REPLY: + ptr->data.caa_reply.next = NULL; + ptr->data.caa_reply.plength = 0; + ptr->data.caa_reply.property = NULL; + ptr->data.caa_reply.length = 0; + ptr->data.caa_reply.value = NULL; + break; + case ARES_DATATYPE_ADDR_NODE: ptr->data.addr_node.next = NULL; ptr->data.addr_node.family = 0; diff --git a/contrib/libs/c-ares/ares_data.h b/contrib/libs/c-ares/src/lib/ares_data.h index ee54a4b1f5..9fee9e6b35 100644 --- a/contrib/libs/c-ares/ares_data.h +++ b/contrib/libs/c-ares/src/lib/ares_data.h @@ -31,6 +31,7 @@ typedef enum { ARES_DATATYPE_OPTIONS, /* struct ares_options */ #endif ARES_DATATYPE_ADDR_PORT_NODE, /* struct ares_addr_port_node - introduced in 1.11.0 */ + ARES_DATATYPE_CAA_REPLY, /* struct ares_caa_reply - introduced in 1.17 */ ARES_DATATYPE_LAST /* not used - introduced in 1.7.0 */ } ares_datatype; @@ -66,6 +67,7 @@ struct ares_data { struct ares_mx_reply mx_reply; struct ares_naptr_reply naptr_reply; struct ares_soa_reply soa_reply; + struct ares_caa_reply caa_reply; } data; }; diff --git a/contrib/libs/c-ares/ares_destroy.c b/contrib/libs/c-ares/src/lib/ares_destroy.c index fed2009ab3..fed2009ab3 100644 --- a/contrib/libs/c-ares/ares_destroy.c +++ b/contrib/libs/c-ares/src/lib/ares_destroy.c diff --git a/contrib/libs/c-ares/ares_expand_name.c b/contrib/libs/c-ares/src/lib/ares_expand_name.c index 3a38e6737e..a62c982e04 100644 --- a/contrib/libs/c-ares/ares_expand_name.c +++ b/contrib/libs/c-ares/src/lib/ares_expand_name.c @@ -19,14 +19,8 @@ #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_nowarn.h" @@ -36,7 +30,52 @@ #define MAX_INDIRS 50 static int name_length(const unsigned char *encoded, const unsigned char *abuf, - int alen); + int alen, int is_hostname); + +/* Reserved characters for names that need to be escaped */ +static int is_reservedch(int ch) +{ + switch (ch) { + case '"': + case '.': + case ';': + case '\\': + case '(': + case ')': + case '@': + case '$': + return 1; + default: + break; + } + + return 0; +} + +static int ares__isprint(int ch) +{ + if (ch >= 0x20 && ch <= 0x7E) + return 1; + return 0; +} + +/* Character set allowed by hostnames */ +static int is_hostnamech(int ch) +{ + /* [A-Za-z0-9-.] + * Don't use isalnum() as it is locale-specific + */ + if (ch >= 'A' && ch <= 'Z') + return 1; + if (ch >= 'a' && ch <= 'z') + return 1; + if (ch >= '0' && ch <= '9') + return 1; + if (ch == '-' || ch == '.') + return 1; + + return 0; +} /* Expand an RFC1035-encoded domain name given by encoded. The * containing message is given by abuf and alen. The result given by @@ -60,10 +99,15 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf, * * Since the expanded name uses '.' as a label separator, we use * backslashes to escape periods or backslashes in the expanded name. + * + * If the result is expected to be a hostname, then no escaped data is allowed + * and will return error. */ -int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, - int alen, char **s, long *enclen) +int ares__expand_name_validated(const unsigned char *encoded, + const unsigned char *abuf, + int alen, char **s, long *enclen, + int is_hostname) { int len, indir = 0; char *q; @@ -73,7 +117,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, size_t uns; } nlen; - nlen.sig = name_length(encoded, abuf, alen); + nlen.sig = name_length(encoded, abuf, alen, is_hostname); if (nlen.sig < 0) return ARES_EBADNAME; @@ -113,18 +157,36 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, } else { - len = *p; + int name_len = *p; + len = name_len; p++; + while (len--) { - if (*p == '.' || *p == '\\') - *q++ = '\\'; - *q++ = *p; + /* Output as \DDD for consistency with RFC1035 5.1, except + * for the special case of a root name response */ + if (!ares__isprint(*p) && !(name_len == 1 && *p == 0)) + { + *q++ = '\\'; + *q++ = '0' + *p / 100; + *q++ = '0' + (*p % 100) / 10; + *q++ = '0' + (*p % 10); + } + else if (is_reservedch(*p)) + { + *q++ = '\\'; + *q++ = *p; + } + else + { + *q++ = *p; + } p++; } *q++ = '.'; } - } + } + if (!indir) *enclen = aresx_uztosl(p + 1U - encoded); @@ -137,11 +199,18 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, return ARES_SUCCESS; } + +int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, + int alen, char **s, long *enclen) +{ + return ares__expand_name_validated(encoded, abuf, alen, s, enclen, 0); +} + /* Return the length of the expansion of an encoded domain name, or * -1 if the encoding is invalid. */ static int name_length(const unsigned char *encoded, const unsigned char *abuf, - int alen) + int alen, int is_hostname) { int n = 0, offset, indir = 0, top; @@ -171,15 +240,35 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf, } else if (top == 0x00) { - offset = *encoded; + int name_len = *encoded; + offset = name_len; if (encoded + offset + 1 >= abuf + alen) return -1; encoded++; + while (offset--) { - n += (*encoded == '.' || *encoded == '\\') ? 2 : 1; + if (!ares__isprint(*encoded) && !(name_len == 1 && *encoded == 0)) + { + if (is_hostname) + return -1; + n += 4; + } + else if (is_reservedch(*encoded)) + { + if (is_hostname) + return -1; + n += 2; + } + else + { + if (is_hostname && !is_hostnamech(*encoded)) + return -1; + n += 1; + } encoded++; } + n++; } else @@ -197,12 +286,14 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf, return (n) ? n - 1 : n; } -/* Like ares_expand_name but returns EBADRESP in case of invalid input. */ +/* Like ares_expand_name_validated but returns EBADRESP in case of invalid + * input. */ int ares__expand_name_for_response(const unsigned char *encoded, const unsigned char *abuf, int alen, - char **s, long *enclen) + char **s, long *enclen, int is_hostname) { - int status = ares_expand_name(encoded, abuf, alen, s, enclen); + int status = ares__expand_name_validated(encoded, abuf, alen, s, enclen, + is_hostname); if (status == ARES_EBADNAME) status = ARES_EBADRESP; return status; diff --git a/contrib/libs/c-ares/ares_expand_string.c b/contrib/libs/c-ares/src/lib/ares_expand_string.c index d35df75248..03e3929975 100644 --- a/contrib/libs/c-ares/ares_expand_string.c +++ b/contrib/libs/c-ares/src/lib/ares_expand_string.c @@ -19,11 +19,8 @@ #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_private.h" /* for the memdebug */ diff --git a/contrib/libs/c-ares/ares_fds.c b/contrib/libs/c-ares/src/lib/ares_fds.c index f405fc047c..f405fc047c 100644 --- a/contrib/libs/c-ares/ares_fds.c +++ b/contrib/libs/c-ares/src/lib/ares_fds.c diff --git a/contrib/libs/c-ares/ares_free_hostent.c b/contrib/libs/c-ares/src/lib/ares_free_hostent.c index cfc5f81feb..ea28ff0e2c 100644 --- a/contrib/libs/c-ares/ares_free_hostent.c +++ b/contrib/libs/c-ares/src/lib/ares_free_hostent.c @@ -31,11 +31,13 @@ void ares_free_hostent(struct hostent *host) return; ares_free((char *)(host->h_name)); - for (p = host->h_aliases; *p; p++) + for (p = host->h_aliases; p && *p; p++) ares_free(*p); ares_free(host->h_aliases); - ares_free(host->h_addr_list[0]); /* no matter if there is one or many entries, - there is only one malloc for all of them */ - ares_free(host->h_addr_list); + if (host->h_addr_list) { + ares_free(host->h_addr_list[0]); /* no matter if there is one or many entries, + there is only one malloc for all of them */ + ares_free(host->h_addr_list); + } ares_free(host); } diff --git a/contrib/libs/c-ares/ares_free_string.c b/contrib/libs/c-ares/src/lib/ares_free_string.c index 024992e1c2..024992e1c2 100644 --- a/contrib/libs/c-ares/ares_free_string.c +++ b/contrib/libs/c-ares/src/lib/ares_free_string.c diff --git a/contrib/libs/c-ares/ares_freeaddrinfo.c b/contrib/libs/c-ares/src/lib/ares_freeaddrinfo.c index 128f5daec4..d8891bbf8a 100644 --- a/contrib/libs/c-ares/ares_freeaddrinfo.c +++ b/contrib/libs/c-ares/src/lib/ares_freeaddrinfo.c @@ -51,6 +51,8 @@ void ares__freeaddrinfo_nodes(struct ares_addrinfo_node *head) void ares_freeaddrinfo(struct ares_addrinfo *ai) { + if (ai == NULL) + return; ares__freeaddrinfo_cnames(ai->cnames); ares__freeaddrinfo_nodes(ai->nodes); ares_free(ai); diff --git a/contrib/libs/c-ares/ares_getaddrinfo.c b/contrib/libs/c-ares/src/lib/ares_getaddrinfo.c index be168068b1..db17a67086 100644 --- a/contrib/libs/c-ares/ares_getaddrinfo.c +++ b/contrib/libs/c-ares/src/lib/ares_getaddrinfo.c @@ -34,14 +34,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H #include <strings.h> @@ -386,6 +380,9 @@ static int fake_addrinfo(const char *name, } } + node->ai_socktype = hints->ai_socktype; + node->ai_protocol = hints->ai_protocol; + callback(arg, ARES_SUCCESS, 0, ai); return 1; } @@ -396,7 +393,7 @@ static void end_hquery(struct host_query *hquery, int status) struct ares_addrinfo_node *next; if (status == ARES_SUCCESS) { - if (!(hquery->hints.ai_flags & ARES_AI_NOSORT)) + if (!(hquery->hints.ai_flags & ARES_AI_NOSORT) && hquery->ai->nodes) { sentinel.ai_next = hquery->ai->nodes; ares__sortaddrinfo(hquery->channel, &sentinel); @@ -406,6 +403,8 @@ static void end_hquery(struct host_query *hquery, int status) /* Set port into each address (resolved separately). */ while (next) { + next->ai_socktype = hquery->hints.ai_socktype; + next->ai_protocol = hquery->hints.ai_protocol; if (next->ai_family == AF_INET) { (CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr))->sin_port = htons(hquery->port); @@ -545,11 +544,6 @@ static void host_callback(void *arg, int status, int timeouts, { addinfostatus = ares__parse_into_addrinfo(abuf, alen, hquery->ai); } - else if (status == ARES_EDESTRUCTION) - { - end_hquery(hquery, status); - return; - } if (!hquery->remaining) { @@ -567,6 +561,13 @@ static void host_callback(void *arg, int status, int timeouts, { next_lookup(hquery, 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); @@ -754,6 +755,7 @@ static int as_is_first(const struct host_query* hquery) { char* p; int ndots = 0; + size_t nname = strlen(hquery->name); for (p = hquery->name; *p; p++) { if (*p == '.') @@ -761,5 +763,10 @@ static int as_is_first(const struct host_query* hquery) ndots++; } } + if (nname && hquery->name[nname-1] == '.') + { + /* prevent ARES_EBADNAME for valid FQDN, where ndots < channel->ndots */ + return 1; + } return ndots >= hquery->channel->ndots; } diff --git a/contrib/libs/c-ares/ares_getenv.c b/contrib/libs/c-ares/src/lib/ares_getenv.c index f6e4dc2952..f6e4dc2952 100644 --- a/contrib/libs/c-ares/ares_getenv.c +++ b/contrib/libs/c-ares/src/lib/ares_getenv.c diff --git a/contrib/libs/c-ares/ares_getenv.h b/contrib/libs/c-ares/src/lib/ares_getenv.h index 6da6cc5081..6da6cc5081 100644 --- a/contrib/libs/c-ares/ares_getenv.h +++ b/contrib/libs/c-ares/src/lib/ares_getenv.h diff --git a/contrib/libs/c-ares/ares_gethostbyaddr.c b/contrib/libs/c-ares/src/lib/ares_gethostbyaddr.c index f37fb8b815..084c8fa198 100644 --- a/contrib/libs/c-ares/ares_gethostbyaddr.c +++ b/contrib/libs/c-ares/src/lib/ares_gethostbyaddr.c @@ -24,14 +24,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_inet_net_pton.h" @@ -211,7 +205,6 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host) strcat(PATH_HOSTS, WIN_PATH_HOSTS); #elif defined(WATT32) - extern const char *_w32_GetHostsFile (void); const char *PATH_HOSTS = _w32_GetHostsFile(); if (!PATH_HOSTS) diff --git a/contrib/libs/c-ares/ares_gethostbyname.c b/contrib/libs/c-ares/src/lib/ares_gethostbyname.c index ecd03e7931..e09363632e 100644 --- a/contrib/libs/c-ares/ares_gethostbyname.c +++ b/contrib/libs/c-ares/src/lib/ares_gethostbyname.c @@ -25,14 +25,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H #include <strings.h> @@ -258,7 +252,7 @@ static int fake_hostent(const char *name, int family, struct in_addr in; struct ares_in6_addr in6; - if (family == AF_INET || family == AF_INET6) + if (family == AF_INET || family == AF_UNSPEC) { /* It only looks like an IP address if it's all numbers and dots. */ int numdots = 0, valid = 1; @@ -276,13 +270,17 @@ static int fake_hostent(const char *name, int family, /* if we don't have 3 dots, it is illegal * (although inet_pton doesn't think so). */ - if (numdots != 3 || !valid) + if (numdots != 3 || !valid) { result = 0; - else + } else { result = (ares_inet_pton(AF_INET, name, &in) < 1 ? 0 : 1); + } - if (result) - family = AF_INET; + /* + * Set address family in case of failure, + * as we will try to convert it later afterwards + */ + family = result ? AF_INET : AF_INET6; } if (family == AF_INET6) result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1); @@ -383,7 +381,6 @@ static int file_lookup(const char *name, int family, struct hostent **host) strcat(PATH_HOSTS, WIN_PATH_HOSTS); #elif defined(WATT32) - extern const char *_w32_GetHostsFile (void); const char *PATH_HOSTS = _w32_GetHostsFile(); if (!PATH_HOSTS) diff --git a/contrib/libs/c-ares/ares_getnameinfo.c b/contrib/libs/c-ares/src/lib/ares_getnameinfo.c index 53f91ca845..966919ac23 100644 --- a/contrib/libs/c-ares/ares_getnameinfo.c +++ b/contrib/libs/c-ares/src/lib/ares_getnameinfo.c @@ -31,14 +31,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_NET_IF_H #include <net/if.h> diff --git a/contrib/libs/c-ares/ares_getsock.c b/contrib/libs/c-ares/src/lib/ares_getsock.c index 22d344679f..22d344679f 100644 --- a/contrib/libs/c-ares/ares_getsock.c +++ b/contrib/libs/c-ares/src/lib/ares_getsock.c diff --git a/contrib/libs/c-ares/ares_inet_net_pton.h b/contrib/libs/c-ares/src/lib/ares_inet_net_pton.h index 90da2cc651..90da2cc651 100644 --- a/contrib/libs/c-ares/ares_inet_net_pton.h +++ b/contrib/libs/c-ares/src/lib/ares_inet_net_pton.h diff --git a/contrib/libs/c-ares/ares_init.c b/contrib/libs/c-ares/src/lib/ares_init.c index e06265c6a2..40be0b21fa 100644 --- a/contrib/libs/c-ares/ares_init.c +++ b/contrib/libs/c-ares/src/lib/ares_init.c @@ -33,14 +33,7 @@ #include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif +#include "ares_nameser.h" #if defined(ANDROID) || defined(__ANDROID__) #include <sys/system_properties.h> @@ -115,20 +108,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, int status = ARES_SUCCESS; struct timeval now; -#ifdef CURLDEBUG - const char *env = getenv("CARES_MEMDEBUG"); - - if (env) - curl_memdebug(env); - env = getenv("CARES_MEMLIMIT"); - if (env) { - char *endptr; - long num = strtol(env, &endptr, 10); - if((endptr != env) && (endptr == env + strlen(env)) && (num > 0)) - curl_memlimit(num); - } -#endif - if (ares_library_initialized() != ARES_SUCCESS) return ARES_ENOTINITIALIZED; /* LCOV_EXCL_LINE: n/a on non-WinSock */ @@ -1500,6 +1479,57 @@ static int init_by_resolv_conf(ares_channel channel) /* Catch the case when all the above checks fail (which happens when there is no network card or the cable is unplugged) */ status = ARES_EFILE; +#elif defined(__MVS__) + + struct __res_state *res = 0; + int count4, count6; + __STATEEXTIPV6 *v6; + struct server_state *pserver + if (0 == res) { + int rc = res_init(); + while (rc == -1 && h_errno == TRY_AGAIN) { + rc = res_init(); + } + if (rc == -1) { + return ARES_ENOMEM; + } + res = __res(); + } + + v6 = res->__res_extIPv6; + count4 = res->nscount; + if (v6) { + count6 = v6->__stat_nscount; + } else { + count6 = 0; + } + + nservers = count4 + count6; + servers = ares_malloc(nservers * sizeof(struct server_state)); + if (!servers) + return ARES_ENOMEM; + + memset(servers, 0, nservers * sizeof(struct server_state)); + + pserver = servers; + for (int i = 0; i < count4; ++i, ++pserver) { + struct sockaddr_in *addr_in = &(res->nsaddr_list[i]); + pserver->addr.addrV4.s_addr = addr_in->sin_addr.s_addr; + pserver->addr.family = AF_INET; + pserver->addr.udp_port = addr_in->sin_port; + pserver->addr.tcp_port = addr_in->sin_port; + } + + for (int j = 0; j < count6; ++j, ++pserver) { + struct sockaddr_in6 *addr_in = &(v6->__stat_nsaddr_list[j]); + memcpy(&(pserver->addr.addr.addr6), &(addr_in->sin6_addr), + sizeof(addr_in->sin6_addr)); + pserver->addr.family = AF_INET6; + pserver->addr.udp_port = addr_in->sin6_port; + pserver->addr.tcp_port = addr_in->sin6_port; + } + + status = ARES_EOF; #elif defined(__riscos__) @@ -1625,7 +1655,8 @@ static int init_by_resolv_conf(ares_channel channel) if (channel->nservers == -1) { union res_sockaddr_union addr[MAXNS]; int nscount = res_getservers(&res, addr, MAXNS); - for (int i = 0; i < nscount; ++i) { + int i; + for (i = 0; i < nscount; ++i) { char str[INET6_ADDRSTRLEN]; int config_status; sa_family_t family = addr[i].sin.sin_family; @@ -1648,16 +1679,18 @@ static int init_by_resolv_conf(ares_channel channel) int entries = 0; while ((entries < MAXDNSRCH) && res.dnsrch[entries]) entries++; - - channel->domains = ares_malloc(entries * sizeof(char *)); - if (!channel->domains) { - status = ARES_ENOMEM; - } else { - channel->ndomains = entries; - for (int i = 0; i < channel->ndomains; ++i) { - channel->domains[i] = ares_strdup(res.dnsrch[i]); - if (!channel->domains[i]) - status = ARES_ENOMEM; + if(entries) { + channel->domains = ares_malloc(entries * sizeof(char *)); + if (!channel->domains) { + status = ARES_ENOMEM; + } else { + int i; + channel->ndomains = entries; + for (i = 0; i < channel->ndomains; ++i) { + channel->domains[i] = ares_strdup(res.dnsrch[i]); + if (!channel->domains[i]) + status = ARES_ENOMEM; + } } } } @@ -2508,9 +2541,10 @@ static void randomize_key(unsigned char* key,int key_data_len) randomized = 1; } #else /* !WIN32 */ -#ifdef RANDOM_FILE - FILE *f = fopen(RANDOM_FILE, "rb"); +#ifdef CARES_RANDOM_FILE + FILE *f = fopen(CARES_RANDOM_FILE, "rb"); if(f) { + setvbuf(f, NULL, _IONBF, 0); counter = aresx_uztosi(fread(key, 1, key_data_len, f)); fclose(f); } diff --git a/contrib/libs/c-ares/ares_iphlpapi.h b/contrib/libs/c-ares/src/lib/ares_iphlpapi.h index 343aee3ffb..343aee3ffb 100644 --- a/contrib/libs/c-ares/ares_iphlpapi.h +++ b/contrib/libs/c-ares/src/lib/ares_iphlpapi.h diff --git a/contrib/libs/c-ares/ares_ipv6.h b/contrib/libs/c-ares/src/lib/ares_ipv6.h index fdbc21fe8f..fdbc21fe8f 100644 --- a/contrib/libs/c-ares/ares_ipv6.h +++ b/contrib/libs/c-ares/src/lib/ares_ipv6.h diff --git a/contrib/libs/c-ares/ares_library_init.c b/contrib/libs/c-ares/src/lib/ares_library_init.c index 3c7ad37200..4731886f35 100644 --- a/contrib/libs/c-ares/ares_library_init.c +++ b/contrib/libs/c-ares/src/lib/ares_library_init.c @@ -43,13 +43,18 @@ static unsigned int ares_initialized; static int ares_init_flags; /* library-private global vars with visibility across the whole library */ + +/* Some systems may return either NULL or a valid pointer on malloc(0). c-ares should + * never call malloc(0) so lets return NULL so we're more likely to find an issue if it + * were to occur. */ + +static void *default_malloc(size_t size) { if (size == 0) { return NULL; } return malloc(size); } + #if defined(WIN32) /* We need indirections to handle Windows DLL rules. */ -static void *default_malloc(size_t size) { return malloc(size); } static void *default_realloc(void *p, size_t size) { return realloc(p, size); } static void default_free(void *p) { free(p); } #else -# define default_malloc malloc # define default_realloc realloc # define default_free free #endif diff --git a/contrib/libs/c-ares/ares_library_init.h b/contrib/libs/c-ares/src/lib/ares_library_init.h index 2a2ba118b5..b3896d9f7b 100644 --- a/contrib/libs/c-ares/ares_library_init.h +++ b/contrib/libs/c-ares/src/lib/ares_library_init.h @@ -23,7 +23,7 @@ #ifdef USE_WINSOCK #include <iphlpapi.h> -#include <ares_iphlpapi.h> +#include "ares_iphlpapi.h" typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*); typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG); diff --git a/contrib/libs/c-ares/ares_llist.c b/contrib/libs/c-ares/src/lib/ares_llist.c index 36ca84c43e..36ca84c43e 100644 --- a/contrib/libs/c-ares/ares_llist.c +++ b/contrib/libs/c-ares/src/lib/ares_llist.c diff --git a/contrib/libs/c-ares/ares_llist.h b/contrib/libs/c-ares/src/lib/ares_llist.h index 20f4d1ce42..20f4d1ce42 100644 --- a/contrib/libs/c-ares/ares_llist.h +++ b/contrib/libs/c-ares/src/lib/ares_llist.h diff --git a/contrib/libs/c-ares/ares_mkquery.c b/contrib/libs/c-ares/src/lib/ares_mkquery.c index 5aea914bd0..5aea914bd0 100644 --- a/contrib/libs/c-ares/ares_mkquery.c +++ b/contrib/libs/c-ares/src/lib/ares_mkquery.c diff --git a/contrib/libs/c-ares/src/lib/ares_nameser.h b/contrib/libs/c-ares/src/lib/ares_nameser.h new file mode 100644 index 0000000000..5270e5a3a6 --- /dev/null +++ b/contrib/libs/c-ares/src/lib/ares_nameser.h @@ -0,0 +1,482 @@ + +#ifndef ARES_NAMESER_H +#define ARES_NAMESER_H + +#ifdef HAVE_ARPA_NAMESER_H +# include <arpa/nameser.h> +#endif +#ifdef HAVE_ARPA_NAMESER_COMPAT_H +# include <arpa/nameser_compat.h> +#endif + +/* ============================================================================ + * arpa/nameser.h may or may not provide ALL of the below defines, so check + * each one individually and set if not + * ============================================================================ + */ + +#ifndef NS_PACKETSZ +# define NS_PACKETSZ 512 /* maximum packet size */ +#endif + +#ifndef NS_MAXDNAME +# define NS_MAXDNAME 256 /* maximum domain name */ +#endif + +#ifndef NS_MAXCDNAME +# define NS_MAXCDNAME 255 /* maximum compressed domain name */ +#endif + +#ifndef NS_MAXLABEL +# define NS_MAXLABEL 63 +#endif + +#ifndef NS_HFIXEDSZ +# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#endif + +#ifndef NS_QFIXEDSZ +# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#endif + +#ifndef NS_RRFIXEDSZ +# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#endif + +#ifndef NS_INT16SZ +# define NS_INT16SZ 2 +#endif + +#ifndef NS_INADDRSZ +# define NS_INADDRSZ 4 +#endif + +#ifndef NS_IN6ADDRSZ +# define NS_IN6ADDRSZ 16 +#endif + +#ifndef NS_CMPRSFLGS +# define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ +#endif + +#ifndef NS_DEFAULTPORT +# define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ +#endif + +/* ============================================================================ + * arpa/nameser.h should provide these enumerations always, so if not found, + * provide them + * ============================================================================ + */ +#ifndef HAVE_ARPA_NAMESER_H + +typedef enum __ns_class { + ns_c_invalid = 0, /* Cookie. */ + ns_c_in = 1, /* Internet. */ + ns_c_2 = 2, /* unallocated/unsupported. */ + ns_c_chaos = 3, /* MIT Chaos-net. */ + ns_c_hs = 4, /* MIT Hesiod. */ + /* Query class values which do not appear in resource records */ + ns_c_none = 254, /* for prereq. sections in update requests */ + ns_c_any = 255, /* Wildcard match. */ + ns_c_max = 65536 +} ns_class; + +typedef enum __ns_type { + ns_t_invalid = 0, /* Cookie. */ + ns_t_a = 1, /* Host address. */ + ns_t_ns = 2, /* Authoritative server. */ + ns_t_md = 3, /* Mail destination. */ + ns_t_mf = 4, /* Mail forwarder. */ + ns_t_cname = 5, /* Canonical name. */ + ns_t_soa = 6, /* Start of authority zone. */ + ns_t_mb = 7, /* Mailbox domain name. */ + ns_t_mg = 8, /* Mail group member. */ + ns_t_mr = 9, /* Mail rename name. */ + ns_t_null = 10, /* Null resource record. */ + ns_t_wks = 11, /* Well known service. */ + ns_t_ptr = 12, /* Domain name pointer. */ + ns_t_hinfo = 13, /* Host information. */ + ns_t_minfo = 14, /* Mailbox information. */ + ns_t_mx = 15, /* Mail routing information. */ + ns_t_txt = 16, /* Text strings. */ + ns_t_rp = 17, /* Responsible person. */ + ns_t_afsdb = 18, /* AFS cell database. */ + ns_t_x25 = 19, /* X_25 calling address. */ + ns_t_isdn = 20, /* ISDN calling address. */ + ns_t_rt = 21, /* Router. */ + ns_t_nsap = 22, /* NSAP address. */ + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ + ns_t_sig = 24, /* Security signature. */ + ns_t_key = 25, /* Security key. */ + ns_t_px = 26, /* X.400 mail mapping. */ + ns_t_gpos = 27, /* Geographical position (withdrawn). */ + ns_t_aaaa = 28, /* Ip6 Address. */ + ns_t_loc = 29, /* Location Information. */ + ns_t_nxt = 30, /* Next domain (security). */ + ns_t_eid = 31, /* Endpoint identifier. */ + ns_t_nimloc = 32, /* Nimrod Locator. */ + ns_t_srv = 33, /* Server Selection. */ + ns_t_atma = 34, /* ATM Address */ + ns_t_naptr = 35, /* Naming Authority PoinTeR */ + ns_t_kx = 36, /* Key Exchange */ + ns_t_cert = 37, /* Certification record */ + ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ + ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ + ns_t_sink = 40, /* Kitchen sink (experimentatl) */ + ns_t_opt = 41, /* EDNS0 option (meta-RR) */ + ns_t_apl = 42, /* Address prefix list (RFC3123) */ + ns_t_ds = 43, /* Delegation Signer (RFC4034) */ + ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */ + ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */ + ns_t_nsec = 47, /* Next Secure (RFC4034) */ + ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */ + ns_t_tkey = 249, /* Transaction key */ + ns_t_tsig = 250, /* Transaction signature. */ + ns_t_ixfr = 251, /* Incremental zone transfer. */ + ns_t_axfr = 252, /* Transfer zone of authority. */ + ns_t_mailb = 253, /* Transfer mailbox records. */ + ns_t_maila = 254, /* Transfer mail agent records. */ + ns_t_any = 255, /* Wildcard match. */ + ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ + ns_t_caa = 257, /* Certification Authority Authorization. */ + ns_t_max = 65536 +} ns_type; + +typedef enum __ns_opcode { + ns_o_query = 0, /* Standard query. */ + ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ + ns_o_status = 2, /* Name server status query (unsupported). */ + /* Opcode 3 is undefined/reserved. */ + ns_o_notify = 4, /* Zone change notification. */ + ns_o_update = 5, /* Zone update message. */ + ns_o_max = 6 +} ns_opcode; + +typedef enum __ns_rcode { + ns_r_noerror = 0, /* No error occurred. */ + ns_r_formerr = 1, /* Format error. */ + ns_r_servfail = 2, /* Server failure. */ + ns_r_nxdomain = 3, /* Name error. */ + ns_r_notimpl = 4, /* Unimplemented. */ + ns_r_refused = 5, /* Operation refused. */ + /* these are for BIND_UPDATE */ + ns_r_yxdomain = 6, /* Name exists */ + ns_r_yxrrset = 7, /* RRset exists */ + ns_r_nxrrset = 8, /* RRset does not exist */ + ns_r_notauth = 9, /* Not authoritative for zone */ + ns_r_notzone = 10, /* Zone of record different from zone section */ + ns_r_max = 11, + /* The following are TSIG extended errors */ + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +#endif /* HAVE_ARPA_NAMESER_H */ + + +/* ============================================================================ + * arpa/nameser_compat.h typically sets these. However on some systems + * arpa/nameser.h does, but may not set all of them. Lets conditionally + * define each + * ============================================================================ + */ + +#ifndef PACKETSZ +# define PACKETSZ NS_PACKETSZ +#endif + +#ifndef MAXDNAME +# define MAXDNAME NS_MAXDNAME +#endif + +#ifndef MAXCDNAME +# define MAXCDNAME NS_MAXCDNAME +#endif + +#ifndef MAXLABEL +# define MAXLABEL NS_MAXLABEL +#endif + +#ifndef HFIXEDSZ +# define HFIXEDSZ NS_HFIXEDSZ +#endif + +#ifndef QFIXEDSZ +# define QFIXEDSZ NS_QFIXEDSZ +#endif + +#ifndef RRFIXEDSZ +# define RRFIXEDSZ NS_RRFIXEDSZ +#endif + +#ifndef INDIR_MASK +# define INDIR_MASK NS_CMPRSFLGS +#endif + +#ifndef NAMESERVER_PORT +# define NAMESERVER_PORT NS_DEFAULTPORT +#endif + + +/* opcodes */ +#ifndef O_QUERY +# define O_QUERY 0 /* ns_o_query */ +#endif +#ifndef O_IQUERY +# define O_IQUERY 1 /* ns_o_iquery */ +#endif +#ifndef O_STATUS +# define O_STATUS 2 /* ns_o_status */ +#endif +#ifndef O_NOTIFY +# define O_NOTIFY 4 /* ns_o_notify */ +#endif +#ifndef O_UPDATE +# define O_UPDATE 5 /* ns_o_update */ +#endif + + +/* response codes */ +#ifndef SERVFAIL +# define SERVFAIL ns_r_servfail +#endif +#ifndef NOTIMP +# define NOTIMP ns_r_notimpl +#endif +#ifndef REFUSED +# define REFUSED ns_r_refused +#endif +#if defined(_WIN32) && !defined(HAVE_ARPA_NAMESER_COMPAT_H) && defined(NOERROR) +# undef NOERROR /* it seems this is already defined in winerror.h */ +#endif +#ifndef NOERROR +# define NOERROR ns_r_noerror +#endif +#ifndef FORMERR +# define FORMERR ns_r_formerr +#endif +#ifndef NXDOMAIN +# define NXDOMAIN ns_r_nxdomain +#endif +/* Non-standard response codes, use numeric values */ +#ifndef YXDOMAIN +# define YXDOMAIN 6 /* ns_r_yxdomain */ +#endif +#ifndef YXRRSET +# define YXRRSET 7 /* ns_r_yxrrset */ +#endif +#ifndef NXRRSET +# define NXRRSET 8 /* ns_r_nxrrset */ +#endif +#ifndef NOTAUTH +# define NOTAUTH 9 /* ns_r_notauth */ +#endif +#ifndef NOTZONE +# define NOTZONE 10 /* ns_r_notzone */ +#endif +#ifndef TSIG_BADSIG +# define TSIG_BADSIG 16 /* ns_r_badsig */ +#endif +#ifndef TSIG_BADKEY +# define TSIG_BADKEY 17 /* ns_r_badkey */ +#endif +#ifndef TSIG_BADTIME +# define TSIG_BADTIME 18 /* ns_r_badtime */ +#endif + + +/* classes */ +#ifndef C_IN +# define C_IN 1 /* ns_c_in */ +#endif +#ifndef C_CHAOS +# define C_CHAOS 3 /* ns_c_chaos */ +#endif +#ifndef C_HS +# define C_HS 4 /* ns_c_hs */ +#endif +#ifndef C_NONE +# define C_NONE 254 /* ns_c_none */ +#endif +#ifndef C_ANY +# define C_ANY 255 /* ns_c_any */ +#endif + + +/* types */ +#ifndef T_A +# define T_A 1 /* ns_t_a */ +#endif +#ifndef T_NS +# define T_NS 2 /* ns_t_ns */ +#endif +#ifndef T_MD +# define T_MD 3 /* ns_t_md */ +#endif +#ifndef T_MF +# define T_MF 4 /* ns_t_mf */ +#endif +#ifndef T_CNAME +# define T_CNAME 5 /* ns_t_cname */ +#endif +#ifndef T_SOA +# define T_SOA 6 /* ns_t_soa */ +#endif +#ifndef T_MB +# define T_MB 7 /* ns_t_mb */ +#endif +#ifndef T_MG +# define T_MG 8 /* ns_t_mg */ +#endif +#ifndef T_MR +# define T_MR 9 /* ns_t_mr */ +#endif +#ifndef T_NULL +# define T_NULL 10 /* ns_t_null */ +#endif +#ifndef T_WKS +# define T_WKS 11 /* ns_t_wks */ +#endif +#ifndef T_PTR +# define T_PTR 12 /* ns_t_ptr */ +#endif +#ifndef T_HINFO +# define T_HINFO 13 /* ns_t_hinfo */ +#endif +#ifndef T_MINFO +# define T_MINFO 14 /* ns_t_minfo */ +#endif +#ifndef T_MX +# define T_MX 15 /* ns_t_mx */ +#endif +#ifndef T_TXT +# define T_TXT 16 /* ns_t_txt */ +#endif +#ifndef T_RP +# define T_RP 17 /* ns_t_rp */ +#endif +#ifndef T_AFSDB +# define T_AFSDB 18 /* ns_t_afsdb */ +#endif +#ifndef T_X25 +# define T_X25 19 /* ns_t_x25 */ +#endif +#ifndef T_ISDN +# define T_ISDN 20 /* ns_t_isdn */ +#endif +#ifndef T_RT +# define T_RT 21 /* ns_t_rt */ +#endif +#ifndef T_NSAP +# define T_NSAP 22 /* ns_t_nsap */ +#endif +#ifndef T_NSAP_PTR +# define T_NSAP_PTR 23 /* ns_t_nsap_ptr */ +#endif +#ifndef T_SIG +# define T_SIG 24 /* ns_t_sig */ +#endif +#ifndef T_KEY +# define T_KEY 25 /* ns_t_key */ +#endif +#ifndef T_PX +# define T_PX 26 /* ns_t_px */ +#endif +#ifndef T_GPOS +# define T_GPOS 27 /* ns_t_gpos */ +#endif +#ifndef T_AAAA +# define T_AAAA 28 /* ns_t_aaaa */ +#endif +#ifndef T_LOC +# define T_LOC 29 /* ns_t_loc */ +#endif +#ifndef T_NXT +# define T_NXT 30 /* ns_t_nxt */ +#endif +#ifndef T_EID +# define T_EID 31 /* ns_t_eid */ +#endif +#ifndef T_NIMLOC +# define T_NIMLOC 32 /* ns_t_nimloc */ +#endif +#ifndef T_SRV +# define T_SRV 33 /* ns_t_srv */ +#endif +#ifndef T_ATMA +# define T_ATMA 34 /* ns_t_atma */ +#endif +#ifndef T_NAPTR +# define T_NAPTR 35 /* ns_t_naptr */ +#endif +#ifndef T_KX +# define T_KX 36 /* ns_t_kx */ +#endif +#ifndef T_CERT +# define T_CERT 37 /* ns_t_cert */ +#endif +#ifndef T_A6 +# define T_A6 38 /* ns_t_a6 */ +#endif +#ifndef T_DNAME +# define T_DNAME 39 /* ns_t_dname */ +#endif +#ifndef T_SINK +# define T_SINK 40 /* ns_t_sink */ +#endif +#ifndef T_OPT +# define T_OPT 41 /* ns_t_opt */ +#endif +#ifndef T_APL +# define T_APL 42 /* ns_t_apl */ +#endif +#ifndef T_DS +# define T_DS 43 /* ns_t_ds */ +#endif +#ifndef T_SSHFP +# define T_SSHFP 44 /* ns_t_sshfp */ +#endif +#ifndef T_RRSIG +# define T_RRSIG 46 /* ns_t_rrsig */ +#endif +#ifndef T_NSEC +# define T_NSEC 47 /* ns_t_nsec */ +#endif +#ifndef T_DNSKEY +# define T_DNSKEY 48 /* ns_t_dnskey */ +#endif +#ifndef T_TKEY +# define T_TKEY 249 /* ns_t_tkey */ +#endif +#ifndef T_TSIG +# define T_TSIG 250 /* ns_t_tsig */ +#endif +#ifndef T_IXFR +# define T_IXFR 251 /* ns_t_ixfr */ +#endif +#ifndef T_AXFR +# define T_AXFR 252 /* ns_t_axfr */ +#endif +#ifndef T_MAILB +# define T_MAILB 253 /* ns_t_mailb */ +#endif +#ifndef T_MAILA +# define T_MAILA 254 /* ns_t_maila */ +#endif +#ifndef T_ANY +# define T_ANY 255 /* ns_t_any */ +#endif +#ifndef T_ZXFR +# define T_ZXFR 256 /* ns_t_zxfr */ +#endif +#ifndef T_CAA +# define T_CAA 257 /* ns_t_caa */ +#endif +#ifndef T_MAX +# define T_MAX 65536 /* ns_t_max */ +#endif + + +#endif /* ARES_NAMESER_H */ diff --git a/contrib/libs/c-ares/ares_nowarn.c b/contrib/libs/c-ares/src/lib/ares_nowarn.c index f63d9135ec..f63d9135ec 100644 --- a/contrib/libs/c-ares/ares_nowarn.c +++ b/contrib/libs/c-ares/src/lib/ares_nowarn.c diff --git a/contrib/libs/c-ares/ares_nowarn.h b/contrib/libs/c-ares/src/lib/ares_nowarn.h index 505e622098..505e622098 100644 --- a/contrib/libs/c-ares/ares_nowarn.h +++ b/contrib/libs/c-ares/src/lib/ares_nowarn.h diff --git a/contrib/libs/c-ares/ares_options.c b/contrib/libs/c-ares/src/lib/ares_options.c index de49de4625..de49de4625 100644 --- a/contrib/libs/c-ares/ares_options.c +++ b/contrib/libs/c-ares/src/lib/ares_options.c diff --git a/contrib/libs/c-ares/ares_parse_a_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_a_reply.c index d8a9e9b578..b08ac8760f 100644 --- a/contrib/libs/c-ares/ares_parse_a_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_a_reply.c @@ -26,14 +26,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H # include <strings.h> @@ -113,7 +107,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, while (next_cname) { if(next_cname->alias) - aliases[alias++] = strdup(next_cname->alias); + aliases[alias++] = ares_strdup(next_cname->alias); if(next_cname->ttl < cname_ttl) cname_ttl = next_cname->ttl; next_cname = next_cname->next; @@ -135,7 +129,7 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, if (ai.cnames) { - hostent->h_name = strdup(ai.cnames->name); + hostent->h_name = ares_strdup(ai.cnames->name); ares_free(question_hostname); } else @@ -197,7 +191,8 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen, if (naddrttls) { - *naddrttls = naddrs; + /* Truncated to at most *naddrttls entries */ + *naddrttls = (naddrs > *naddrttls)?*naddrttls:naddrs; } ares__freeaddrinfo_cnames(ai.cnames); diff --git a/contrib/libs/c-ares/ares_parse_aaaa_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_aaaa_reply.c index 0d39bfa826..6f4744a8dc 100644 --- a/contrib/libs/c-ares/ares_parse_aaaa_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_aaaa_reply.c @@ -27,14 +27,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H # include <strings.h> @@ -115,7 +109,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, while (next_cname) { if(next_cname->alias) - aliases[alias++] = strdup(next_cname->alias); + aliases[alias++] = ares_strdup(next_cname->alias); if(next_cname->ttl < cname_ttl) cname_ttl = next_cname->ttl; next_cname = next_cname->next; @@ -137,7 +131,7 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, if (ai.cnames) { - hostent->h_name = strdup(ai.cnames->name); + hostent->h_name = ares_strdup(ai.cnames->name); ares_free(question_hostname); } else @@ -200,7 +194,8 @@ int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, if (naddrttls) { - *naddrttls = naddrs; + /* Truncated to at most *naddrttls entries */ + *naddrttls = (naddrs > *naddrttls)?*naddrttls:naddrs; } ares__freeaddrinfo_cnames(ai.cnames); diff --git a/contrib/libs/c-ares/src/lib/ares_parse_caa_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_caa_reply.c new file mode 100644 index 0000000000..f6d4d3c61f --- /dev/null +++ b/contrib/libs/c-ares/src/lib/ares_parse_caa_reply.c @@ -0,0 +1,199 @@ + +/* Copyright 2020 by <danny.sonnenschein@platynum.ch> + * + * 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_NETINET_IN_H +# include <netinet/in.h> +#endif +#ifdef HAVE_NETDB_H +# include <netdb.h> +#endif +#ifdef HAVE_ARPA_INET_H +# include <arpa/inet.h> +#endif + +#include "ares_nameser.h" + +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif + +#include "ares.h" +#include "ares_dns.h" +#include "ares_data.h" +#include "ares_private.h" + +int +ares_parse_caa_reply (const unsigned char *abuf, int alen, + struct ares_caa_reply **caa_out) +{ + unsigned int qdcount, ancount, i; + const unsigned char *aptr; + const unsigned char *strptr; + int status, rr_type, rr_class, rr_len; + long len; + char *hostname = NULL, *rr_name = NULL; + struct ares_caa_reply *caa_head = NULL; + struct ares_caa_reply *caa_last = NULL; + struct ares_caa_reply *caa_curr; + + /* Set *caa_out to NULL for all failure cases. */ + *caa_out = NULL; + + /* Give up if abuf doesn't have room for a header. */ + if (alen < HFIXEDSZ) + return ARES_EBADRESP; + + /* Fetch the question and answer count from the header. */ + qdcount = DNS_HEADER_QDCOUNT (abuf); + ancount = DNS_HEADER_ANCOUNT (abuf); + if (qdcount != 1) + return ARES_EBADRESP; + if (ancount == 0) + return ARES_ENODATA; + + /* Expand the name from the question, and skip past the question. */ + aptr = abuf + HFIXEDSZ; + status = ares_expand_name (aptr, abuf, alen, &hostname, &len); + if (status != ARES_SUCCESS) + return status; + + if (aptr + len + QFIXEDSZ > abuf + alen) + { + ares_free (hostname); + return ARES_EBADRESP; + } + aptr += len + QFIXEDSZ; + + /* Examine each answer resource record (RR) in turn. */ + for (i = 0; i < ancount; i++) + { + /* Decode the RR up to the data field. */ + status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); + if (status != ARES_SUCCESS) + { + break; + } + aptr += len; + if (aptr + RRFIXEDSZ > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + rr_type = DNS_RR_TYPE (aptr); + rr_class = DNS_RR_CLASS (aptr); + rr_len = DNS_RR_LEN (aptr); + aptr += RRFIXEDSZ; + if (aptr + rr_len > abuf + alen) + { + status = ARES_EBADRESP; + break; + } + + /* Check if we are really looking at a CAA record */ + if ((rr_class == C_IN || rr_class == C_CHAOS) && rr_type == T_CAA) + { + strptr = aptr; + + /* Allocate storage for this CAA answer appending it to the list */ + caa_curr = ares_malloc_data(ARES_DATATYPE_CAA_REPLY); + if (!caa_curr) + { + status = ARES_ENOMEM; + break; + } + if (caa_last) + { + caa_last->next = caa_curr; + } + else + { + caa_head = caa_curr; + } + caa_last = caa_curr; + if (rr_len < 2) + { + status = ARES_EBADRESP; + break; + } + caa_curr->critical = (int)*strptr++; + caa_curr->plength = (int)*strptr++; + if (caa_curr->plength <= 0 || (int)caa_curr->plength >= rr_len - 2) + { + status = ARES_EBADRESP; + break; + } + caa_curr->property = ares_malloc (caa_curr->plength + 1/* Including null byte */); + if (caa_curr->property == NULL) + { + status = ARES_ENOMEM; + break; + } + memcpy ((char *) caa_curr->property, strptr, caa_curr->plength); + /* Make sure we NULL-terminate */ + caa_curr->property[caa_curr->plength] = 0; + strptr += caa_curr->plength; + + caa_curr->length = rr_len - caa_curr->plength - 2; + if (caa_curr->length <= 0) + { + status = ARES_EBADRESP; + break; + } + caa_curr->value = ares_malloc (caa_curr->length + 1/* Including null byte */); + if (caa_curr->value == NULL) + { + status = ARES_ENOMEM; + break; + } + memcpy ((char *) caa_curr->value, strptr, caa_curr->length); + /* Make sure we NULL-terminate */ + caa_curr->value[caa_curr->length] = 0; + } + + /* Propagate any failures */ + if (status != ARES_SUCCESS) + { + break; + } + + /* Don't lose memory in the next iteration */ + ares_free (rr_name); + rr_name = NULL; + + /* Move on to the next record */ + aptr += rr_len; + } + + if (hostname) + ares_free (hostname); + if (rr_name) + ares_free (rr_name); + + /* clean up on error */ + if (status != ARES_SUCCESS) + { + if (caa_head) + ares_free_data (caa_head); + return status; + } + + /* everything looks fine, return the data */ + *caa_out = caa_head; + + return ARES_SUCCESS; +} diff --git a/contrib/libs/c-ares/ares_parse_mx_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_mx_reply.c index 8d1703020c..a57b282544 100644 --- a/contrib/libs/c-ares/ares_parse_mx_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_mx_reply.c @@ -26,14 +26,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_dns.h" diff --git a/contrib/libs/c-ares/ares_parse_naptr_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_naptr_reply.c index 04abc3c7ee..3a19b40ba6 100644 --- a/contrib/libs/c-ares/ares_parse_naptr_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_naptr_reply.c @@ -26,25 +26,14 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_dns.h" #include "ares_data.h" #include "ares_private.h" -/* AIX portability check */ -#ifndef T_NAPTR - #define T_NAPTR 35 /* naming authority pointer */ -#endif - int ares_parse_naptr_reply (const unsigned char *abuf, int alen, struct ares_naptr_reply **naptr_out) diff --git a/contrib/libs/c-ares/ares_parse_ns_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_ns_reply.c index 7bb51429db..47d12994c9 100644 --- a/contrib/libs/c-ares/ares_parse_ns_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_ns_reply.c @@ -29,14 +29,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_dns.h" @@ -68,7 +62,7 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen, /* Expand the name from the question, and skip past the question. */ aptr = abuf + HFIXEDSZ; - status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len); + status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len, 0); if ( status != ARES_SUCCESS ) return status; if ( aptr + len + QFIXEDSZ > abuf + alen ) @@ -91,7 +85,7 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen, for ( i = 0; i < ( int ) ancount; i++ ) { /* Decode the RR up to the data field. */ - status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len ); + status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len, 0); if ( status != ARES_SUCCESS ) break; aptr += len; @@ -116,7 +110,7 @@ int ares_parse_ns_reply( const unsigned char* abuf, int alen, { /* Decode the RR data and add it to the nameservers list */ status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data, - &len); + &len, 1); if ( status != ARES_SUCCESS ) { ares_free(rr_name); diff --git a/contrib/libs/c-ares/ares_parse_ptr_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_ptr_reply.c index 0e2b064bb4..060a2019e2 100644 --- a/contrib/libs/c-ares/ares_parse_ptr_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_ptr_reply.c @@ -22,14 +22,8 @@ #ifdef HAVE_NETDB_H # include <netdb.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H # include <strings.h> @@ -53,7 +47,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, long len; const unsigned char *aptr; char *ptrname, *hostname, *rr_name, *rr_data; - struct hostent *hostent; + struct hostent *hostent = NULL; int aliascnt = 0; int alias_alloc = 8; char ** aliases; @@ -76,7 +70,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, /* Expand the name from the question, and skip past the question. */ aptr = abuf + HFIXEDSZ; - status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len); + status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len, 0); if (status != ARES_SUCCESS) return status; if (aptr + len + QFIXEDSZ > abuf + alen) @@ -97,7 +91,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, for (i = 0; i < (int)ancount; i++) { /* Decode the RR up to the data field. */ - status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len); + status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len, 0); if (status != ARES_SUCCESS) break; aptr += len; @@ -124,7 +118,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, { /* Decode the RR data and set hostname to it. */ status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, - &len); + &len, 1); if (status != ARES_SUCCESS) { ares_free(rr_name); @@ -167,7 +161,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, { /* Decode the RR data and replace ptrname with it. */ status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data, - &len); + &len, 1); if (status != ARES_SUCCESS) { ares_free(rr_name); @@ -190,41 +184,54 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, status = ARES_ENODATA; if (status == ARES_SUCCESS) { - /* We got our answer. Allocate memory to build the host entry. */ - hostent = ares_malloc(sizeof(struct hostent)); - if (hostent) - { - hostent->h_addr_list = ares_malloc(2 * sizeof(char *)); - if (hostent->h_addr_list) - { - hostent->h_addr_list[0] = ares_malloc(addrlen); - if (hostent->h_addr_list[0]) - { - hostent->h_aliases = ares_malloc((aliascnt+1) * sizeof (char *)); - if (hostent->h_aliases) - { - /* Fill in the hostent and return successfully. */ - hostent->h_name = hostname; - for (i=0 ; i<aliascnt ; i++) - hostent->h_aliases[i] = aliases[i]; - hostent->h_aliases[aliascnt] = NULL; - hostent->h_addrtype = aresx_sitoss(family); - hostent->h_length = aresx_sitoss(addrlen); - memcpy(hostent->h_addr_list[0], addr, addrlen); - hostent->h_addr_list[1] = NULL; - *host = hostent; - ares_free(aliases); - ares_free(ptrname); - return ARES_SUCCESS; - } - ares_free(hostent->h_addr_list[0]); - } - ares_free(hostent->h_addr_list); - } - ares_free(hostent); - } + /* If we don't reach the end, we must have failed due to out of memory */ status = ARES_ENOMEM; + + /* We got our answer. Allocate memory to build the host entry. */ + hostent = ares_malloc(sizeof(*hostent)); + if (!hostent) + goto fail; + + /* If we don't memset here, cleanups may fail */ + memset(hostent, 0, sizeof(*hostent)); + + hostent->h_addr_list = ares_malloc(2 * sizeof(char *)); + if (!hostent->h_addr_list) + goto fail; + + + if (addr && addrlen) { + hostent->h_addr_list[0] = ares_malloc(addrlen); + if (!hostent->h_addr_list[0]) + goto fail; + } else { + hostent->h_addr_list[0] = NULL; + } + + hostent->h_aliases = ares_malloc((aliascnt+1) * sizeof (char *)); + if (!hostent->h_aliases) + goto fail; + + /* Fill in the hostent and return successfully. */ + hostent->h_name = hostname; + for (i=0 ; i<aliascnt ; i++) + hostent->h_aliases[i] = aliases[i]; + hostent->h_aliases[aliascnt] = NULL; + hostent->h_addrtype = aresx_sitoss(family); + hostent->h_length = aresx_sitoss(addrlen); + if (addr && addrlen) + memcpy(hostent->h_addr_list[0], addr, addrlen); + hostent->h_addr_list[1] = NULL; + *host = hostent; + ares_free(aliases); + ares_free(ptrname); + + return ARES_SUCCESS; } + +fail: + ares_free_hostent(hostent); + for (i=0 ; i<aliascnt ; i++) if (aliases[i]) ares_free(aliases[i]); diff --git a/contrib/libs/c-ares/ares_parse_soa_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_soa_reply.c index 8b84a368db..48597d616d 100644 --- a/contrib/libs/c-ares/ares_parse_soa_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_soa_reply.c @@ -26,14 +26,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_dns.h" @@ -63,13 +57,16 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen, return ARES_EBADRESP; if (ancount == 0) return ARES_EBADRESP; - + aptr = abuf + HFIXEDSZ; /* query name */ - status = ares__expand_name_for_response(aptr, abuf, alen, &qname, &len); + status = ares__expand_name_for_response(aptr, abuf, alen, &qname, &len, 0); if (status != ARES_SUCCESS) goto failed_stat; + + if (alen <= len + HFIXEDSZ + 1) + goto failed; aptr += len; qclass = DNS_QUESTION_TYPE(aptr); @@ -87,7 +84,7 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen, for (i = 0; i < ancount; i++) { rr_name = NULL; - status = ares__expand_name_for_response (aptr, abuf, alen, &rr_name, &len); + status = ares__expand_name_for_response (aptr, abuf, alen, &rr_name, &len, 0); if (status != ARES_SUCCESS) { ares_free(rr_name); @@ -125,7 +122,7 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen, /* nsname */ status = ares__expand_name_for_response(aptr, abuf, alen, &soa->nsname, - &len); + &len, 0); if (status != ARES_SUCCESS) { ares_free(rr_name); @@ -135,7 +132,7 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen, /* hostmaster */ status = ares__expand_name_for_response(aptr, abuf, alen, - &soa->hostmaster, &len); + &soa->hostmaster, &len, 0); if (status != ARES_SUCCESS) { ares_free(rr_name); @@ -164,9 +161,9 @@ ares_parse_soa_reply(const unsigned char *abuf, int alen, return ARES_SUCCESS; } aptr += rr_len; - + ares_free(rr_name); - + if (aptr > abuf + alen) goto failed_stat; } diff --git a/contrib/libs/c-ares/ares_parse_srv_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_srv_reply.c index 72a2dd4e96..8096381c30 100644 --- a/contrib/libs/c-ares/ares_parse_srv_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_srv_reply.c @@ -26,25 +26,14 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_dns.h" #include "ares_data.h" #include "ares_private.h" -/* AIX portability check */ -#ifndef T_SRV -# define T_SRV 33 /* server selection */ -#endif - int ares_parse_srv_reply (const unsigned char *abuf, int alen, struct ares_srv_reply **srv_out) diff --git a/contrib/libs/c-ares/ares_parse_txt_reply.c b/contrib/libs/c-ares/src/lib/ares_parse_txt_reply.c index c685dfd052..2d4913d450 100644 --- a/contrib/libs/c-ares/ares_parse_txt_reply.c +++ b/contrib/libs/c-ares/src/lib/ares_parse_txt_reply.c @@ -26,14 +26,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H # include <strings.h> diff --git a/contrib/libs/c-ares/ares_platform.c b/contrib/libs/c-ares/src/lib/ares_platform.c index 6c749dccb2..6c749dccb2 100644 --- a/contrib/libs/c-ares/ares_platform.c +++ b/contrib/libs/c-ares/src/lib/ares_platform.c diff --git a/contrib/libs/c-ares/ares_platform.h b/contrib/libs/c-ares/src/lib/ares_platform.h index e6885ae546..e6885ae546 100644 --- a/contrib/libs/c-ares/ares_platform.h +++ b/contrib/libs/c-ares/src/lib/ares_platform.h diff --git a/contrib/libs/c-ares/ares_private.h b/contrib/libs/c-ares/src/lib/ares_private.h index 3312ed1932..b4e9d5e63c 100644 --- a/contrib/libs/c-ares/ares_private.h +++ b/contrib/libs/c-ares/src/lib/ares_private.h @@ -74,6 +74,7 @@ #elif defined(WATT32) #define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf" +W32_FUNC const char *_w32_GetHostsFile (void); #elif defined(NETWARE) @@ -358,9 +359,13 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize); void ares__free_query(struct query *query); unsigned short ares__generate_new_id(rc4_key* key); struct timeval ares__tvnow(void); +int ares__expand_name_validated(const unsigned char *encoded, + const unsigned char *abuf, + int alen, char **s, long *enclen, + int is_hostname); int ares__expand_name_for_response(const unsigned char *encoded, const unsigned char *abuf, int alen, - char **s, long *enclen); + char **s, long *enclen, int is_hostname); void 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); @@ -418,13 +423,4 @@ int ares__connect_socket(ares_channel channel, (c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w)); \ } WHILE_FALSE -#ifdef CURLDEBUG -/* This is low-level hard-hacking memory leak tracking and similar. Using the - libcurl lowlevel code from within library is ugly and only works when - c-ares is built and linked with a similarly curldebug-enabled libcurl, - but we do this anyway for convenience. */ -#define HEADER_CURL_SETUP_ONCE_H -#include "../lib/memdebug.h" -#endif - #endif /* __ARES_PRIVATE_H */ diff --git a/contrib/libs/c-ares/ares_process.c b/contrib/libs/c-ares/src/lib/ares_process.c index 25095d0f05..f7e27fdbdd 100644 --- a/contrib/libs/c-ares/ares_process.c +++ b/contrib/libs/c-ares/src/lib/ares_process.c @@ -32,14 +32,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H # include <strings.h> @@ -87,6 +81,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server); 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); @@ -608,14 +603,13 @@ static void process_answer(ares_channel channel, unsigned char *abuf, return; packetsz = PACKETSZ; - /* If we use EDNS and server answers with one of these RCODES, the protocol + /* If we use EDNS and server answers with FORMERR without an OPT RR, the protocol * extension is not understood by the responder. We must retry the query - * without EDNS enabled. - */ + * without EDNS enabled. */ if (channel->flags & ARES_FLAG_EDNS) { packetsz = channel->ednspsz; - if (rcode == NOTIMP || rcode == FORMERR || rcode == SERVFAIL) + if (rcode == FORMERR && has_opt_rr(abuf, alen) != 1) { int qlen = (query->tcplen - 2) - EDNSFIXEDSZ; channel->flags ^= ARES_FLAG_EDNS; @@ -1375,6 +1369,85 @@ static int same_address(struct sockaddr *sa, struct ares_addr *aa) return 0; /* different */ } +/* search for an OPT RR in the response */ +static int has_opt_rr(const unsigned char *abuf, int alen) +{ + unsigned int qdcount, ancount, nscount, arcount, i; + const unsigned char *aptr; + int status; + + if (alen < HFIXEDSZ) + return -1; + + /* Parse the answer header. */ + qdcount = DNS_HEADER_QDCOUNT(abuf); + ancount = DNS_HEADER_ANCOUNT(abuf); + nscount = DNS_HEADER_NSCOUNT(abuf); + arcount = DNS_HEADER_ARCOUNT(abuf); + + aptr = abuf + HFIXEDSZ; + + /* skip the questions */ + for (i = 0; i < qdcount; i++) + { + char* name; + long len; + status = ares_expand_name(aptr, abuf, alen, &name, &len); + if (status != ARES_SUCCESS) + return -1; + ares_free_string(name); + if (aptr + len + QFIXEDSZ > abuf + alen) + return -1; + aptr += len + QFIXEDSZ; + } + + /* skip the ancount and nscount */ + for (i = 0; i < ancount + nscount; i++) + { + char* name; + long len; + int dlen; + status = ares_expand_name(aptr, abuf, alen, &name, &len); + if (status != ARES_SUCCESS) + return -1; + ares_free_string(name); + if (aptr + len + RRFIXEDSZ > abuf + alen) + return -1; + aptr += len; + dlen = DNS_RR_LEN(aptr); + aptr += RRFIXEDSZ; + if (aptr + dlen > abuf + alen) + return -1; + aptr += dlen; + } + + /* search for rr type (41) - opt */ + for (i = 0; i < arcount; i++) + { + char* name; + long len; + int dlen; + status = ares_expand_name(aptr, abuf, alen, &name, &len); + if (status != ARES_SUCCESS) + return -1; + ares_free_string(name); + if (aptr + len + RRFIXEDSZ > abuf + alen) + return -1; + aptr += len; + + if (DNS_RR_TYPE(aptr) == T_OPT) + return 1; + + dlen = DNS_RR_LEN(aptr); + aptr += RRFIXEDSZ; + if (aptr + dlen > abuf + alen) + return -1; + aptr += dlen; + } + + return 0; +} + static void end_query (ares_channel channel, struct query *query, int status, unsigned char *abuf, int alen) { diff --git a/contrib/libs/c-ares/ares_query.c b/contrib/libs/c-ares/src/lib/ares_query.c index b38b8a6c22..508274db36 100644 --- a/contrib/libs/c-ares/ares_query.c +++ b/contrib/libs/c-ares/src/lib/ares_query.c @@ -19,14 +19,8 @@ #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_dns.h" @@ -45,7 +39,7 @@ static void rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len) unsigned char y; unsigned char* state; unsigned char xorIndex; - short counter; + int counter; x = key->x; y = key->y; diff --git a/contrib/libs/c-ares/ares_search.c b/contrib/libs/c-ares/src/lib/ares_search.c index c4b0424f5b..c4b0424f5b 100644 --- a/contrib/libs/c-ares/ares_search.c +++ b/contrib/libs/c-ares/src/lib/ares_search.c diff --git a/contrib/libs/c-ares/ares_send.c b/contrib/libs/c-ares/src/lib/ares_send.c index f4f1f95119..75ba9e4cc6 100644 --- a/contrib/libs/c-ares/ares_send.c +++ b/contrib/libs/c-ares/src/lib/ares_send.c @@ -19,14 +19,8 @@ #ifdef HAVE_NETINET_IN_H # include <netinet/in.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_dns.h" diff --git a/contrib/libs/c-ares/ares_setup.h b/contrib/libs/c-ares/src/lib/ares_setup.h index b9a1fd5b52..46dd440323 100644 --- a/contrib/libs/c-ares/ares_setup.h +++ b/contrib/libs/c-ares/src/lib/ares_setup.h @@ -178,8 +178,11 @@ /* * Android does have the arpa/nameser.h header which is detected by configure * but it appears to be empty with recent NDK r7b / r7c, so we undefine here. + * z/OS does have the arpa/nameser.h header which is detected by configure + * but it is not fully implemented and missing identifiers, so udefine here. */ -#if (defined(ANDROID) || defined(__ANDROID__)) && defined(HAVE_ARPA_NAMESER_H) +#if (defined(ANDROID) || defined(__ANDROID__) || defined(__MVS__)) && \ + defined(HAVE_ARPA_NAMESER_H) # undef HAVE_ARPA_NAMESER_H #endif diff --git a/contrib/libs/c-ares/ares_strcasecmp.c b/contrib/libs/c-ares/src/lib/ares_strcasecmp.c index f9c85e2096..f9c85e2096 100644 --- a/contrib/libs/c-ares/ares_strcasecmp.c +++ b/contrib/libs/c-ares/src/lib/ares_strcasecmp.c diff --git a/contrib/libs/c-ares/ares_strcasecmp.h b/contrib/libs/c-ares/src/lib/ares_strcasecmp.h index 57d86f9634..57d86f9634 100644 --- a/contrib/libs/c-ares/ares_strcasecmp.h +++ b/contrib/libs/c-ares/src/lib/ares_strcasecmp.h diff --git a/contrib/libs/c-ares/ares_strdup.c b/contrib/libs/c-ares/src/lib/ares_strdup.c index 0c3dcffc30..0c3dcffc30 100644 --- a/contrib/libs/c-ares/ares_strdup.c +++ b/contrib/libs/c-ares/src/lib/ares_strdup.c diff --git a/contrib/libs/c-ares/ares_strdup.h b/contrib/libs/c-ares/src/lib/ares_strdup.h index 67f2a74f5f..67f2a74f5f 100644 --- a/contrib/libs/c-ares/ares_strdup.h +++ b/contrib/libs/c-ares/src/lib/ares_strdup.h diff --git a/contrib/libs/c-ares/ares_strerror.c b/contrib/libs/c-ares/src/lib/ares_strerror.c index c3ecbd7b43..c3ecbd7b43 100644 --- a/contrib/libs/c-ares/ares_strerror.c +++ b/contrib/libs/c-ares/src/lib/ares_strerror.c diff --git a/contrib/libs/c-ares/ares_strsplit.c b/contrib/libs/c-ares/src/lib/ares_strsplit.c index b57a30f2a9..97b4e5d5bb 100644 --- a/contrib/libs/c-ares/ares_strsplit.c +++ b/contrib/libs/c-ares/src/lib/ares_strsplit.c @@ -13,6 +13,10 @@ * without express or implied warranty. */ +#if defined(__MVS__) +#include <strings.h> +#endif + #include "ares_setup.h" #include "ares_strsplit.h" #include "ares.h" diff --git a/contrib/libs/c-ares/ares_strsplit.h b/contrib/libs/c-ares/src/lib/ares_strsplit.h index e00fd14dd5..e00fd14dd5 100644 --- a/contrib/libs/c-ares/ares_strsplit.h +++ b/contrib/libs/c-ares/src/lib/ares_strsplit.h diff --git a/contrib/libs/c-ares/ares_timeout.c b/contrib/libs/c-ares/src/lib/ares_timeout.c index 293e4af021..293e4af021 100644 --- a/contrib/libs/c-ares/ares_timeout.c +++ b/contrib/libs/c-ares/src/lib/ares_timeout.c diff --git a/contrib/libs/c-ares/ares_version.c b/contrib/libs/c-ares/src/lib/ares_version.c index 4f8c42f2c9..4f8c42f2c9 100644 --- a/contrib/libs/c-ares/ares_version.c +++ b/contrib/libs/c-ares/src/lib/ares_version.c diff --git a/contrib/libs/c-ares/ares_writev.c b/contrib/libs/c-ares/src/lib/ares_writev.c index e812c09e1c..e812c09e1c 100644 --- a/contrib/libs/c-ares/ares_writev.c +++ b/contrib/libs/c-ares/src/lib/ares_writev.c diff --git a/contrib/libs/c-ares/ares_writev.h b/contrib/libs/c-ares/src/lib/ares_writev.h index 65cea8708f..65cea8708f 100644 --- a/contrib/libs/c-ares/ares_writev.h +++ b/contrib/libs/c-ares/src/lib/ares_writev.h diff --git a/contrib/libs/c-ares/atomic.cpp b/contrib/libs/c-ares/src/lib/atomic.cpp index e193a64b37..e193a64b37 100644 --- a/contrib/libs/c-ares/atomic.cpp +++ b/contrib/libs/c-ares/src/lib/atomic.cpp diff --git a/contrib/libs/c-ares/atomic.h b/contrib/libs/c-ares/src/lib/atomic.h index 9b26bcdc0b..9b26bcdc0b 100644 --- a/contrib/libs/c-ares/atomic.h +++ b/contrib/libs/c-ares/src/lib/atomic.h diff --git a/contrib/libs/c-ares/bitncmp.c b/contrib/libs/c-ares/src/lib/bitncmp.c index bbf1cff4a6..bbf1cff4a6 100644 --- a/contrib/libs/c-ares/bitncmp.c +++ b/contrib/libs/c-ares/src/lib/bitncmp.c diff --git a/contrib/libs/c-ares/bitncmp.h b/contrib/libs/c-ares/src/lib/bitncmp.h index 7b8d66c166..7b8d66c166 100644 --- a/contrib/libs/c-ares/bitncmp.h +++ b/contrib/libs/c-ares/src/lib/bitncmp.h diff --git a/contrib/libs/c-ares/config-win32.h b/contrib/libs/c-ares/src/lib/config-win32.h index da7eba44d8..da7eba44d8 100644 --- a/contrib/libs/c-ares/config-win32.h +++ b/contrib/libs/c-ares/src/lib/config-win32.h diff --git a/contrib/libs/c-ares/inet_net_pton.c b/contrib/libs/c-ares/src/lib/inet_net_pton.c index af1a534a05..840de50652 100644 --- a/contrib/libs/c-ares/inet_net_pton.c +++ b/contrib/libs/c-ares/src/lib/inet_net_pton.c @@ -24,14 +24,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_ipv6.h" diff --git a/contrib/libs/c-ares/inet_ntop.c b/contrib/libs/c-ares/src/lib/inet_ntop.c index 1935a871ce..6645c0a467 100644 --- a/contrib/libs/c-ares/inet_ntop.c +++ b/contrib/libs/c-ares/src/lib/inet_ntop.c @@ -23,14 +23,8 @@ #ifdef HAVE_ARPA_INET_H # include <arpa/inet.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #include "ares.h" #include "ares_ipv6.h" diff --git a/contrib/libs/c-ares/setup_once.h b/contrib/libs/c-ares/src/lib/setup_once.h index d4b0a954ed..d4b0a954ed 100644 --- a/contrib/libs/c-ares/setup_once.h +++ b/contrib/libs/c-ares/src/lib/setup_once.h diff --git a/contrib/libs/c-ares/windows_port.c b/contrib/libs/c-ares/src/lib/windows_port.c index 03acd1c1e2..03acd1c1e2 100644 --- a/contrib/libs/c-ares/windows_port.c +++ b/contrib/libs/c-ares/src/lib/windows_port.c diff --git a/contrib/libs/c-ares/acountry.c b/contrib/libs/c-ares/src/tools/acountry.c index c486824434..a86d7cb0a3 100644 --- a/contrib/libs/c-ares/acountry.c +++ b/contrib/libs/c-ares/src/tools/acountry.c @@ -89,6 +89,7 @@ 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, ...) { @@ -129,7 +130,11 @@ int main(int argc, char **argv) verbose++; break; case 'h': + print_help_info_acountry(); + break; case '?': + print_help_info_acountry(); + break; default: Abort(usage); } @@ -274,7 +279,7 @@ static const struct search_list *list_lookup(int number, const struct search_lis } /* - * Ref: ftp://ftp.ripe.net/iso3166-countrycodes.txt + * Ref: https://en.wikipedia.org/wiki/ISO_3166-1 */ static const struct search_list country_list[] = { { 4, "af", "Afghanistan" }, @@ -304,7 +309,8 @@ static const struct search_list country_list[] = { { 60, "bm", "Bermuda" }, { 64, "bt", "Bhutan" }, { 68, "bo", "Bolivia" }, - { 70, "ba", "Bosnia & Herzegowina" }, + { 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" }, @@ -333,6 +339,7 @@ static const struct search_list country_list[] = { { 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" }, @@ -345,7 +352,9 @@ static const struct search_list country_list[] = { { 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" }, @@ -367,12 +376,13 @@ static const struct search_list country_list[] = { { 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", "Vatican City" }, + { 336, "va", "Holy See" }, /* Vatican City */ { 340, "hn", "Honduras" }, { 344, "hk", "Hong kong" }, { 348, "hu", "Hungary" }, @@ -382,16 +392,19 @@ static const struct search_list country_list[] = { { 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" }, @@ -404,7 +417,6 @@ static const struct search_list country_list[] = { { 440, "lt", "Lithuania" }, { 442, "lu", "Luxembourg" }, { 446, "mo", "Macao" }, - { 807, "mk", "Macedonia" }, { 450, "mg", "Madagascar" }, { 454, "mw", "Malawi" }, { 458, "my", "Malaysia" }, @@ -421,6 +433,7 @@ static const struct search_list country_list[] = { { 498, "md", "Moldova" }, { 492, "mc", "Monaco" }, { 496, "mn", "Mongolia" }, + { 499, "me", "Montenegro" }, { 500, "ms", "Montserrat" }, { 504, "ma", "Morocco" }, { 508, "mz", "Mozambique" }, @@ -429,7 +442,6 @@ static const struct search_list country_list[] = { { 520, "nr", "Nauru" }, { 524, "np", "Nepal" }, { 528, "nl", "Netherlands" }, - { 530, "an", "Netherlands Antilles" }, { 540, "nc", "New Caledonia" }, { 554, "nz", "New Zealand" }, { 558, "ni", "Nicaragua" }, @@ -437,6 +449,7 @@ static const struct search_list country_list[] = { { 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" }, @@ -455,26 +468,30 @@ static const struct search_list country_list[] = { { 634, "qa", "Qatar" }, { 638, "re", "Reunion" }, { 642, "ro", "Romania" }, - { 643, "ru", "Russia" }, + { 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" }, - { 891, "cs", "Serbia and Montenegro" }, + { 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" }, + { 239, "gs", "South Georgia & South Sandwich Is." }, + { 728, "ss", "South Sudan" }, { 724, "es", "Spain" }, { 144, "lk", "Sri Lanka" }, { 654, "sh", "St. Helena" }, @@ -482,15 +499,14 @@ static const struct search_list country_list[] = { { 736, "sd", "Sudan" }, { 740, "sr", "Suriname" }, { 744, "sj", "Svalbard & Jan Mayen Islands" }, - { 748, "sz", "Swaziland" }, { 752, "se", "Sweden" }, { 756, "ch", "Switzerland" }, { 760, "sy", "Syrian Arab Republic" }, - { 626, "tl", "Timor-Leste" }, { 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" }, @@ -624,3 +640,13 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) } 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" + " d : Print some extra debugging output.\n" + " h : Display this help and exit.\n" + " v : Be more verbose. Print extra information.\n\n"); + exit(0); +} diff --git a/contrib/libs/c-ares/adig.c b/contrib/libs/c-ares/src/tools/adig.c index 2d5cb8c876..3f99f7f00b 100644 --- a/contrib/libs/c-ares/adig.c +++ b/contrib/libs/c-ares/src/tools/adig.c @@ -25,14 +25,8 @@ #ifdef HAVE_NETDB_H # include <netdb.h> #endif -#ifdef HAVE_ARPA_NAMESER_H -# include <arpa/nameser.h> -#else -# include "nameser.h" -#endif -#ifdef HAVE_ARPA_NAMESER_COMPAT_H -# include <arpa/nameser_compat.h> -#endif + +#include "ares_nameser.h" #ifdef HAVE_STRINGS_H # include <strings.h> @@ -62,27 +56,6 @@ #undef WIN32 /* Redefined in MingW headers */ #endif -#ifndef T_SRV -# define T_SRV 33 /* Server selection */ -#endif -#ifndef T_NAPTR -# define T_NAPTR 35 /* Naming authority pointer */ -#endif -#ifndef T_DS -# define T_DS 43 /* Delegation Signer (RFC4034) */ -#endif -#ifndef T_SSHFP -# define T_SSHFP 44 /* SSH Key Fingerprint (RFC4255) */ -#endif -#ifndef T_RRSIG -# define T_RRSIG 46 /* Resource Record Signature (RFC4034) */ -#endif -#ifndef T_NSEC -# define T_NSEC 47 /* Next Secure (RFC4034) */ -#endif -#ifndef T_DNSKEY -# define T_DNSKEY 48 /* DNS Public Key (RFC4034) */ -#endif struct nv { const char *name; @@ -147,6 +120,7 @@ static const struct nv types[] = { { "RRSIG", T_RRSIG }, { "NSEC", T_NSEC }, { "DNSKEY", T_DNSKEY }, + { "CAA", T_CAA }, { "ANY", T_ANY } }; static const int ntypes = sizeof(types) / sizeof(types[0]); @@ -171,18 +145,21 @@ static const unsigned char *display_question(const unsigned char *aptr, int alen); static const unsigned char *display_rr(const unsigned char *aptr, const unsigned char *abuf, int alen); +static int convert_query (char **name, int use_bitstring); static const char *type_name(int type); static const char *class_name(int dnsclass); static void usage(void); static void destroy_addr_list(struct ares_addr_node *head); static void append_addr_list(struct ares_addr_node **head, struct ares_addr_node *node); +static void print_help_info_adig(void); int main(int argc, char **argv) { ares_channel channel; int c, i, optmask = ARES_OPT_FLAGS, dnsclass = C_IN, type = T_A; int status, nfds, count; + int use_ptr_helper = 0; struct ares_options options; struct hostent *hostent; fd_set read_fds, write_fds; @@ -205,7 +182,7 @@ int main(int argc, char **argv) options.flags = ARES_FLAG_NOCHECKRESP; options.servers = NULL; options.nservers = 0; - while ((c = ares_getopt(argc, argv, "df:s:c:t:T:U:")) != -1) + while ((c = ares_getopt(argc, argv, "dh?f:s:c:t:T:U:x")) != -1) { switch (c) { @@ -214,7 +191,12 @@ int main(int argc, char **argv) dbug_init(); #endif break; - + case 'h': + print_help_info_adig(); + break; + case '?': + print_help_info_adig(); + break; case 'f': /* Add a flag. */ for (i = 0; i < nflags; i++) @@ -323,6 +305,10 @@ int main(int argc, char **argv) options.udp_port = (unsigned short)strtol(optarg, NULL, 0); optmask |= ARES_OPT_UDP_PORT; break; + + case 'x': + use_ptr_helper++; + break; } } argc -= optind; @@ -356,12 +342,15 @@ int main(int argc, char **argv) * otherwise, supply the query name as an argument so we can * distinguish responses for the user when printing them out. */ - if (argc == 1) - ares_query(channel, *argv, dnsclass, type, callback, (char *) NULL); - else + for (i = 1; *argv; i++, argv++) { - for (; *argv; argv++) - ares_query(channel, *argv, dnsclass, type, callback, *argv); + char *query = *argv; + + if (type == T_PTR && dnsclass == C_IN && use_ptr_helper) + if (!convert_query (&query, use_ptr_helper >= 2)) + continue; + + ares_query(channel, query, dnsclass, type, callback, i < argc-1 ? (void*)query : NULL); } /* Wait for all queries to complete. */ @@ -529,6 +518,7 @@ static const unsigned char *display_rr(const unsigned char *aptr, const unsigned char *p; int type, dnsclass, ttl, dlen, status; long len; + int vlen; char addr[46]; union { unsigned char * as_uchar; @@ -684,6 +674,35 @@ static const unsigned char *display_rr(const unsigned char *aptr, } break; + case T_CAA: + + p = aptr; + + /* Flags */ + printf(" %u", (int)*p); + p += 1; + + /* Remainder of record */ + vlen = (int)dlen - ((char)*p) - 2; + + /* The Property identifier, one of: + - "issue", + - "iodef", or + - "issuewild" */ + status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); + if (status != ARES_SUCCESS) + return NULL; + printf(" %s", name.as_char); + ares_free_string(name.as_char); + p += len; + + if (p + vlen > abuf + alen) + return NULL; + + /* A sequence of octets representing the Property Value */ + printf(" %.*s", vlen, p); + break; + case T_A: /* The RR data is a four-byte Internet address. */ if (dlen != 4) @@ -769,6 +788,104 @@ static const unsigned char *display_rr(const unsigned char *aptr, return aptr + dlen; } +/* + * With the '-x' (or '-xx') and '-t PTR' options, convert a query for an + * address into a more useful 'T_PTR' type question. + * Like with an input 'query': + * "a.b.c.d" -> "d.c.b.a".in-addr.arpa" for an IPv4 address. + * "a.b.c....x.y.z" -> "z.y.x....c.d.e.IP6.ARPA" for an IPv6 address. + * + * An example from 'dig -x PTR 2001:470:1:1b9::31': + * + * QUESTION SECTION: + * 1.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.b.1.0.1.0.0.0.0.7.4.0.1.0.0.2.IP6.ARPA. IN PTR + * + * ANSWER SECTION: + * 1.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.9.b.1.0.1.0.0.0.0.7.4.0.1.0.0.2.IP6.ARPA. 254148 IN PTR ipv6.cybernode.com. + * + * If 'use_bitstring == 1', try to use the more compact RFC-2673 bitstring format. + * Thus the above 'dig' query should become: + * [x13000000000000009b10100007401002].IP6.ARPA. IN PTR + */ +static int convert_query (char **name_p, int use_bitstring) +{ +#ifndef MAX_IP6_RR +#define MAX_IP6_RR (16*sizeof(".x.x") + sizeof(".IP6.ARPA") + 1) +#endif + +#ifdef HAVE_INET_PTON + #define ACCEPTED_RETVAL4 1 + #define ACCEPTED_RETVAL6 1 +#else + #define ACCEPTED_RETVAL4 32 + #define ACCEPTED_RETVAL6 128 +#endif + + static char new_name [MAX_IP6_RR]; + static const char hex_chars[] = "0123456789ABCDEF"; + + union { + struct in_addr addr4; + struct ares_in6_addr addr6; + } addr; + + if (ares_inet_pton (AF_INET, *name_p, &addr.addr4) == 1) + { + unsigned long laddr = ntohl(addr.addr4.s_addr); + unsigned long a1 = (laddr >> 24UL) & 0xFFUL; + unsigned long a2 = (laddr >> 16UL) & 0xFFUL; + unsigned long a3 = (laddr >> 8UL) & 0xFFUL; + unsigned long a4 = laddr & 0xFFUL; + + snprintf(new_name, sizeof(new_name), "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1); + *name_p = new_name; + return (1); + } + + if (ares_inet_pton(AF_INET6, *name_p, &addr.addr6) == 1) + { + char *c = new_name; + const unsigned char *ip = (const unsigned char*) &addr.addr6; + int max_i = (int)sizeof(addr.addr6) - 1; + int i, hi, lo; + + /* Use the more compact RFC-2673 notation? + * Currently doesn't work or unsupported by the DNS-servers I've tested against. + */ + if (use_bitstring) + { + *c++ = '\\'; + *c++ = '['; + *c++ = 'x'; + for (i = max_i; i >= 0; i--) + { + hi = ip[i] >> 4; + lo = ip[i] & 15; + *c++ = hex_chars [lo]; + *c++ = hex_chars [hi]; + } + strcpy (c, "].IP6.ARPA"); + } + else + { + for (i = max_i; i >= 0; i--) + { + hi = ip[i] >> 4; + lo = ip[i] & 15; + *c++ = hex_chars [lo]; + *c++ = '.'; + *c++ = hex_chars [hi]; + *c++ = '.'; + } + strcpy (c, "IP6.ARPA"); + } + *name_p = new_name; + return (1); + } + printf("Address %s was not legal for this query.\n", *name_p); + return (0); +} + static const char *type_name(int type) { int i; @@ -796,7 +913,7 @@ static const char *class_name(int dnsclass) static void usage(void) { fprintf(stderr, "usage: adig [-h] [-d] [-f flag] [-s server] [-c class] " - "[-t type] [-T|U port] name ...\n"); + "[-t type] [-T|U port] [-x|-xx] name ...\n"); exit(1); } @@ -825,3 +942,29 @@ static void append_addr_list(struct ares_addr_node **head, else *head = node; } + + +/* Information from the man page. Formatting taken from man -h */ +static void print_help_info_adig(void) { + printf("adig, version %s \n\n", ARES_VERSION_STR); + printf("usage: adig [-h] [-d] [-f flag] [-s server] [-c class] [-t type] [-T|U port] [-x | -xx] name ...\n\n" + " d : Print some extra debugging output.\n" + " f : Add a flag. Possible values for flag are igntc, noaliases, norecurse, primary, stayopen, usevc.\n" + " h : Display this help and exit.\n\n" + " T port : Use specified TCP port to connect to DNS server.\n" + " U port : Use specified UDP port to connect to DNS server.\n" + " c class : Set the query class. Possible values for class are NY, CHAOS, HS, IN (default).\n" + " s server : Connect to specified DNS server, instead of the system's default one(s).\n" + " t type : Query records of specified type. \n" + " Possible values for type are A \n" + " (default), AAAA, AFSDB, ANY,\n" + " AXFR, CNAME, GPOS, HINFO, ISDN,\n" + " KEY, LOC, MAILA, MAILB, MB, MD,\n" + " MF, MG, MINFO, MR, MX, NAPTR, NS,\n" + " NSAP, NSAP_PTR, NULL, PTR, PX, RP,\n" + " RT, SIG, SOA, SRV, TXT, WKS, X25\n\n" + " -x : For a '-t PTR a.b.c.d' lookup, query for 'd.c.b.a.in-addr.arpa.'\n" + " -xx : As above, but for IPv6, compact the format into a bitstring like\n" + " '[xabcdef00000000000000000000000000].IP6.ARPA.'\n"); + exit(0); +} diff --git a/contrib/libs/c-ares/ahost.c b/contrib/libs/c-ares/src/tools/ahost.c index 89a7c14fcb..77ca7cd091 100644 --- a/contrib/libs/c-ares/ahost.c +++ b/contrib/libs/c-ares/src/tools/ahost.c @@ -49,6 +49,7 @@ static void callback(void *arg, int status, int timeouts, struct hostent *host); static void usage(void); +static void print_help_info_ahost(void); int main(int argc, char **argv) { @@ -76,7 +77,7 @@ int main(int argc, char **argv) return 1; } - while ((c = ares_getopt(argc,argv,"dt:hs:")) != -1) + while ((c = ares_getopt(argc,argv,"dt:h?s:")) != -1) { switch (c) { @@ -103,6 +104,11 @@ int main(int argc, char **argv) usage(); break; case 'h': + print_help_info_ahost(); + break; + case '?': + print_help_info_ahost(); + break; default: usage(); break; @@ -204,3 +210,22 @@ static void usage(void) fprintf(stderr, "usage: ahost [-h] [-d] [-s {domain}] [-t {a|aaaa|u}] {host|addr} ...\n"); exit(1); } + +/* Information from the man page. Formatting taken from man -h */ +static void print_help_info_ahost(void) { + printf("ahost, version %s \n\n", ARES_VERSION_STR); + printf("usage: ahost [-h] [-d] [-s {domain}] [-t {a|aaaa|u}] {host|addr} ...\n\n" + " d : Print some extra debugging output.\n" + " h : Display this help and exit.\n\n" + " s domain : Specify the domain to search instead of \n" + " using the default values from \n" + " /etc/resolv.conf. This option only has an \n" + " effect on platforms that use /etc/resolv.conf\n" + " for DNS configuration; it has no effect on other\n" + " platforms (such as Win32 or Android).\n" + " t type : If type is \"a\", print the A record (default).\n" + " If type is \"aaaa\", print the AAAA record. If\n" + " type is \"u\", look for either AAAA or A record\n" + " (in that order).\n\n"); + exit(0); +} diff --git a/contrib/libs/c-ares/ares_getopt.c b/contrib/libs/c-ares/src/tools/ares_getopt.c index 1e02d08686..1e02d08686 100644 --- a/contrib/libs/c-ares/ares_getopt.c +++ b/contrib/libs/c-ares/src/tools/ares_getopt.c diff --git a/contrib/libs/c-ares/ares_getopt.h b/contrib/libs/c-ares/src/tools/ares_getopt.h index 63acb3b423..63acb3b423 100644 --- a/contrib/libs/c-ares/ares_getopt.h +++ b/contrib/libs/c-ares/src/tools/ares_getopt.h diff --git a/contrib/libs/c-ares/test/README.md b/contrib/libs/c-ares/test/README.md new file mode 100644 index 0000000000..9881446784 --- /dev/null +++ b/contrib/libs/c-ares/test/README.md @@ -0,0 +1,153 @@ +c-ares Unit Test Suite +====================== + + +This directory holds unit tests for the c-ares library. To build the tests: + + - Build the main c-ares library first, in the directory above this. To + enable tests of internal functions, configure the library build to expose + hidden symbols with `./configure --disable-symbol-hiding`. + - Generate a `configure` file by running `autoreconf -iv` (which requires + a local installation of + [autotools](https://www.gnu.org/software/automake/manual/html_node/Autotools-Introduction.html)). + - `./configure` + - `make` + - Run the tests with `./arestest`, or `./arestest -v` for extra debug info. + +Points to note: + + - The tests are written in C++11, and so need a C++ compiler that supports + this. To avoid adding this as a requirement for the library, the + configuration and build of the tests is independent from the library. + - The tests include some live queries, which will fail when run on a machine + without internet connectivity. To skip live tests, run with + `./arestest --gtest_filter=-*.Live*`. + - The tests include queries of a mock DNS server. This server listens on port + 5300 by default, but the port can be changed with the `-p 5300` option to + `arestest`. + + +Test Types +---------- + +The test suite includes various different types of test. + + - There are live tests (`ares-test-live.cc`), which assume that the + current machine has a valid DNS setup and connection to the + internet; these tests issue queries for real domains but don't + particularly check what gets returned. The tests will fail on + an offline machine. + - There are some mock tests (`ares-test-mock.cc`) that set up a fake DNS + server and inject its port into the c-ares library configuration. + These tests allow specific response messages to be crafted and + injected, and so are likely to be used for many more tests in + future. + - To make this generation/injection easier, the `dns-proto.h` + file includes C++ helper classes for building DNS packets. + - Other library entrypoints that don't require network activity + (e.g. `ares_parse_*_reply`) are tested directly. + - A couple of the tests use a helper method of the test fixture to + inject memory allocation failures, using a recent change to the + c-ares library that allows override of `malloc`/`free`. + - There are some tests of the internal entrypoints of the library + (`ares-test-internal.c`), but these are only enabled if the library + was configured with `--disable-symbol-hiding` and/or + `--enable-expose-statics`. + - There is also an entrypoint to allow Clang's + [libfuzzer](http://llvm.org/docs/LibFuzzer.html) to drive + the packet parsing code in `ares_parse_*_reply`, together with a + standalone wrapper for it (`./aresfuzz`) to allow use of command + line fuzzers (such as [afl-fuzz](http://lcamtuf.coredump.cx/afl/)) + for further [fuzz testing](#fuzzing). + + +Code Coverage Information +------------------------- + +To generate code coverage information: + + - Configure both the library and the tests with `./configure + --enable-code-coverage` before building. This requires the relevant code + coverage tools ([gcov](https://gcc.gnu.org/onlinedocs/gcc/Gcov.html), + [lcov](http://ltp.sourceforge.net/coverage/lcov.php)) to be installed locally. + - Run the tests with `test/arestest`. + - Generate code coverage output with `make code-coverage-capture` in the + library directory (i.e. not in `test/`). + + +Fuzzing +------- + +### libFuzzer + +To fuzz the packet parsing code with libFuzzer, follow the main +[libFuzzer instructions](http://llvm.org/docs/LibFuzzer.html): + + - Configure the c-ares library and test suite with a recent Clang and a sanitizer, for example: + + ```console + % export CFLAGS="-fsanitize=fuzzer-no-link,address" + % export CC=clang + % ./configure --disable-shared && make + ``` + - Link each of the fuzzer entrypoints in with `ares-fuzz.cc`: + + ``` + % clang -I.. -c ares-test-fuzz.c + % clang -I.. -c ares-test-fuzz-name.c + % clang++ -fsanitize=fuzzer,address ares-test-fuzz.o ../.libs/libcares.a -o ares-libfuzzer + % clang++ -fsanitize=fuzzer,address ares-test-fuzz-name.o ../.libs/libcares.a -o ares-libfuzzer-name + ``` + - Run the fuzzer using the starting corpus with: + + ```console + % ./ares-libfuzzer fuzzinput/ # OR + % ./ares-libfuzzer-name fuzznames/ + ``` + +### AFL + +To fuzz using AFL, follow the +[AFL quick start guide](http://lcamtuf.coredump.cx/afl/QuickStartGuide.txt): + + - Download and build AFL. + - Configure the c-ares library and test tool to use AFL's compiler wrappers: + + ```console + % export CC=$AFLDIR/afl-gcc + % ./configure --disable-shared && make + % cd test && ./configure && make aresfuzz aresfuzzname + ``` + + - Run the AFL fuzzer against the starting corpus: + + ```console + % mkdir fuzzoutput + % $AFLDIR/afl-fuzz -i fuzzinput -o fuzzoutput -- ./aresfuzz # OR + % $AFLDIR/afl-fuzz -i fuzznames -o fuzzoutput -- ./aresfuzzname + ``` + +### AFL Persistent Mode + +If a recent version of Clang is available, AFL can use its built-in compiler +instrumentation; this configuration also allows the use of a (much) faster +persistent mode, where multiple fuzz inputs are run for each process invocation. + + - Download and build a recent AFL, and run `make` in the `llvm_mode` + subdirectory to ensure that `afl-clang-fast` gets built. + - Configure the c-ares library and test tool to use AFL's clang wrappers that + use compiler instrumentation: + + ```console + % export CC=$AFLDIR/afl-clang-fast + % ./configure --disable-shared && make + % cd test && ./configure && make aresfuzz + ``` + + - Run the AFL fuzzer (in persistent mode) against the starting corpus: + + ```console + % mkdir fuzzoutput + % $AFLDIR/afl-fuzz -i fuzzinput -o fuzzoutput -- ./aresfuzz + ``` + diff --git a/contrib/libs/c-ares/test/ares-test-live.cc b/contrib/libs/c-ares/test/ares-test-live.cc index 5510163e95..8107f19d08 100644 --- a/contrib/libs/c-ares/test/ares-test-live.cc +++ b/contrib/libs/c-ares/test/ares-test-live.cc @@ -273,7 +273,7 @@ INSTANTIATE_TEST_CASE_P(Modes, DefaultChannelModeTest, VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchA) { SearchResult result; - ares_search(channel_, "www.youtube.com.", ns_c_in, ns_t_a, + ares_search(channel_, "www.youtube.com.", C_IN, T_A, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); @@ -282,7 +282,7 @@ VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchA) { VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveSearchEmptyA) { SearchResult result; - ares_search(channel_, "", ns_c_in, ns_t_a, + ares_search(channel_, "", C_IN, T_A, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); @@ -291,7 +291,7 @@ VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveSearchEmptyA) { VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchNS) { SearchResult result; - ares_search(channel_, "google.com.", ns_c_in, ns_t_ns, + ares_search(channel_, "google.com.", C_IN, T_NS, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); @@ -300,7 +300,7 @@ VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchNS) { VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchMX) { SearchResult result; - ares_search(channel_, "google.com.", ns_c_in, ns_t_mx, + ares_search(channel_, "google.com.", C_IN, T_MX, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); @@ -309,7 +309,7 @@ VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchMX) { VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchTXT) { SearchResult result; - ares_search(channel_, "google.com.", ns_c_in, ns_t_txt, + ares_search(channel_, "google.com.", C_IN, T_TXT, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); @@ -318,7 +318,7 @@ VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchTXT) { VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchSOA) { SearchResult result; - ares_search(channel_, "google.com.", ns_c_in, ns_t_soa, + ares_search(channel_, "google.com.", C_IN, T_SOA, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); @@ -327,7 +327,7 @@ VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchSOA) { VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchSRV) { SearchResult result; - ares_search(channel_, "_imap._tcp.gmail.com.", ns_c_in, ns_t_srv, + ares_search(channel_, "_imap._tcp.gmail.com.", C_IN, T_SRV, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); @@ -336,7 +336,7 @@ VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchSRV) { VIRT_NONVIRT_TEST_F(DefaultChannelTest, DISABLED_LiveSearchANY) { SearchResult result; - ares_search(channel_, "google.com.", ns_c_in, ns_t_any, + ares_search(channel_, "google.com.", C_IN, T_ANY, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); diff --git a/contrib/libs/c-ares/test/ares-test-misc.cc b/contrib/libs/c-ares/test/ares-test-misc.cc index 6fc28a8f97..b11b04babc 100644 --- a/contrib/libs/c-ares/test/ares-test-misc.cc +++ b/contrib/libs/c-ares/test/ares-test-misc.cc @@ -166,13 +166,13 @@ TEST_F(LibraryTest, InetNtoP) { TEST_F(LibraryTest, Mkquery) { byte* p; int len; - ares_mkquery("example.com", ns_c_in, ns_t_a, 0x1234, 0, &p, &len); + ares_mkquery("example.com", C_IN, T_A, 0x1234, 0, &p, &len); std::vector<byte> data(p, p + len); ares_free_string(p); std::string actual = PacketToString(data); DNSPacket pkt; - pkt.set_qid(0x1234).add_question(new DNSQuestion("example.com", ns_t_a)); + pkt.set_qid(0x1234).add_question(new DNSQuestion("example.com", T_A)); std::string expected = PacketToString(pkt.data()); EXPECT_EQ(expected, actual); } @@ -181,14 +181,14 @@ TEST_F(LibraryTest, CreateQuery) { byte* p; int len; EXPECT_EQ(ARES_SUCCESS, - ares_create_query("exam\\@le.com", ns_c_in, ns_t_a, 0x1234, 0, + ares_create_query("exam\\@le.com", C_IN, T_A, 0x1234, 0, &p, &len, 0)); std::vector<byte> data(p, p + len); ares_free_string(p); std::string actual = PacketToString(data); DNSPacket pkt; - pkt.set_qid(0x1234).add_question(new DNSQuestion("exam@le.com", ns_t_a)); + pkt.set_qid(0x1234).add_question(new DNSQuestion("exam@le.com", T_A)); std::string expected = PacketToString(pkt.data()); EXPECT_EQ(expected, actual); } @@ -197,7 +197,7 @@ TEST_F(LibraryTest, CreateQueryTrailingEscapedDot) { byte* p; int len; EXPECT_EQ(ARES_SUCCESS, - ares_create_query("example.com\\.", ns_c_in, ns_t_a, 0x1234, 0, + ares_create_query("example.com\\.", C_IN, T_A, 0x1234, 0, &p, &len, 0)); std::vector<byte> data(p, p + len); ares_free_string(p); @@ -215,7 +215,7 @@ TEST_F(LibraryTest, CreateQueryNameTooLong) { "a1234567890123456789.b1234567890123456789.c1234567890123456789.d1234567890123456789." "a1234567890123456789.b1234567890123456789.c1234567890123456789.d1234567890123456789." "x1234567890123456789.y1234567890123456789.", - ns_c_in, ns_t_a, 0x1234, 0, &p, &len, 0)); + C_IN, T_A, 0x1234, 0, &p, &len, 0)); } TEST_F(LibraryTest, CreateQueryFailures) { @@ -228,7 +228,7 @@ TEST_F(LibraryTest, CreateQueryFailures) { } p = nullptr; EXPECT_EQ(ARES_EBADNAME, - ares_create_query(longname.c_str(), ns_c_in, ns_t_a, 0x1234, 0, + ares_create_query(longname.c_str(), C_IN, T_A, 0x1234, 0, &p, &len, 0)); if (p) ares_free_string(p); @@ -236,7 +236,7 @@ TEST_F(LibraryTest, CreateQueryFailures) { p = nullptr; EXPECT_EQ(ARES_ENOMEM, - ares_create_query("example.com", ns_c_in, ns_t_a, 0x1234, 0, + ares_create_query("example.com", C_IN, T_A, 0x1234, 0, &p, &len, 0)); if (p) ares_free_string(p); @@ -244,14 +244,14 @@ TEST_F(LibraryTest, CreateQueryFailures) { std::string longlabel = "a.a123456789b123456789c123456789d123456789e123456789f123456789g123456789.org"; p = nullptr; EXPECT_EQ(ARES_EBADNAME, - ares_create_query(longlabel.c_str(), ns_c_in, ns_t_a, 0x1234, 0, + ares_create_query(longlabel.c_str(), C_IN, T_A, 0x1234, 0, &p, &len, 0)); if (p) ares_free_string(p); // Empty non-terminal label p = nullptr; EXPECT_EQ(ARES_EBADNAME, - ares_create_query("example..com", ns_c_in, ns_t_a, 0x1234, 0, + ares_create_query("example..com", C_IN, T_A, 0x1234, 0, &p, &len, 0)); if (p) ares_free_string(p); } @@ -260,7 +260,7 @@ TEST_F(LibraryTest, CreateQueryOnionDomain) { byte* p; int len; EXPECT_EQ(ARES_ENOTFOUND, - ares_create_query("dontleak.onion", ns_c_in, ns_t_a, 0x1234, 0, + ares_create_query("dontleak.onion", C_IN, T_A, 0x1234, 0, &p, &len, 0)); } @@ -291,7 +291,7 @@ TEST_F(DefaultChannelTest, GetAddrinfoOnionDomain) { // still leaks information about the query to malicious resolvers. TEST_F(DefaultChannelTest, SearchOnionDomain) { SearchResult result; - ares_search(channel_, "dontleak.onion", ns_c_in, ns_t_a, + ares_search(channel_, "dontleak.onion", C_IN, T_A, SearchCallback, &result); EXPECT_TRUE(result.done_); EXPECT_EQ(ARES_ENOTFOUND, result.status_); @@ -454,14 +454,14 @@ TEST_F(LibraryTest, CreateEDNSQuery) { byte* p; int len; EXPECT_EQ(ARES_SUCCESS, - ares_create_query("example.com", ns_c_in, ns_t_a, 0x1234, 0, + ares_create_query("example.com", C_IN, T_A, 0x1234, 0, &p, &len, 1280)); std::vector<byte> data(p, p + len); ares_free_string(p); std::string actual = PacketToString(data); DNSPacket pkt; - pkt.set_qid(0x1234).add_question(new DNSQuestion("example.com", ns_t_a)) + pkt.set_qid(0x1234).add_question(new DNSQuestion("example.com", T_A)) .add_additional(new DNSOptRR(0, 1280)); std::string expected = PacketToString(pkt.data()); EXPECT_EQ(expected, actual); @@ -470,13 +470,13 @@ TEST_F(LibraryTest, CreateEDNSQuery) { TEST_F(LibraryTest, CreateRootQuery) { byte* p; int len; - ares_create_query(".", ns_c_in, ns_t_a, 0x1234, 0, &p, &len, 0); + ares_create_query(".", C_IN, T_A, 0x1234, 0, &p, &len, 0); std::vector<byte> data(p, p + len); ares_free_string(p); std::string actual = PacketToString(data); DNSPacket pkt; - pkt.set_qid(0x1234).add_question(new DNSQuestion("", ns_t_a)); + pkt.set_qid(0x1234).add_question(new DNSQuestion("", T_A)); std::string expected = PacketToString(pkt.data()); EXPECT_EQ(expected, actual); } diff --git a/contrib/libs/c-ares/test/ares-test-mock-ai.cc b/contrib/libs/c-ares/test/ares-test-mock-ai.cc index d0df867fef..0de315a57c 100644 --- a/contrib/libs/c-ares/test/ares-test-mock-ai.cc +++ b/contrib/libs/c-ares/test/ares-test-mock-ai.cc @@ -61,15 +61,15 @@ MATCHER_P(IncludesV6Address, address, "") { TEST_P(MockUDPChannelTestAI, GetAddrInfoParallelLookups) { DNSPacket rsp1; rsp1.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp1)); DNSPacket rsp2; rsp2.set_response().set_aa() - .add_question(new DNSQuestion("www.example.com", ns_t_a)) + .add_question(new DNSQuestion("www.example.com", T_A)) .add_answer(new DNSARR("www.example.com", 100, {1, 2, 3, 4})); - ON_CALL(server_, OnRequest("www.example.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp2)); struct ares_addrinfo_hints hints = {}; @@ -103,12 +103,12 @@ TEST_P(MockUDPChannelTestAI, GetAddrInfoParallelLookups) { TEST_P(MockUDPChannelTestAI, TruncationRetry) { DNSPacket rsptruncated; rsptruncated.set_response().set_aa().set_tc() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); + .add_question(new DNSQuestion("www.google.com", T_A)); DNSPacket rspok; rspok.set_response() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {1, 2, 3, 4})); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsptruncated)) .WillOnce(SetReply(&server_, &rspok)); @@ -127,7 +127,7 @@ TEST_P(MockUDPChannelTestAI, TruncationRetry) { // TCP only to prevent retries TEST_P(MockTCPChannelTestAI, MalformedResponse) { std::vector<byte> one = {0x01}; - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReplyData(&server_, one)); AddrInfoResult result; @@ -143,9 +143,9 @@ TEST_P(MockTCPChannelTestAI, MalformedResponse) { TEST_P(MockTCPChannelTestAI, FormErrResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_formerr); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(FORMERR); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -161,9 +161,9 @@ TEST_P(MockTCPChannelTestAI, FormErrResponse) { TEST_P(MockTCPChannelTestAI, ServFailResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_servfail); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(SERVFAIL); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -180,9 +180,9 @@ TEST_P(MockTCPChannelTestAI, ServFailResponse) { TEST_P(MockTCPChannelTestAI, NotImplResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_notimpl); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(NOTIMP); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -192,16 +192,16 @@ TEST_P(MockTCPChannelTestAI, NotImplResponse) { ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result); Process(); EXPECT_TRUE(result.done_); - // ARES_FLAG_NOCHECKRESP not set, so NOTIMPL consumed + // ARES_FLAG_NOCHECKRESP not set, so NOTIMP consumed EXPECT_EQ(ARES_ECONNREFUSED, result.status_); } TEST_P(MockTCPChannelTestAI, RefusedResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_refused); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(REFUSED); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -218,9 +218,9 @@ TEST_P(MockTCPChannelTestAI, RefusedResponse) { TEST_P(MockTCPChannelTestAI, YXDomainResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_yxdomain); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(YXDOMAIN); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -261,9 +261,9 @@ TEST_P(MockExtraOptsTestAI, SimpleQuery) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -278,6 +278,57 @@ TEST_P(MockExtraOptsTestAI, SimpleQuery) { EXPECT_THAT(result.ai_, IncludesV4Address("2.3.4.5")); } +class MockExtraOptsNDotsTestAI + : public MockChannelOptsTest, + public ::testing::WithParamInterface< std::pair<int, bool> > { + public: + MockExtraOptsNDotsTestAI(int ndots) + : MockChannelOptsTest(1, GetParam().first, GetParam().second, + FillOptions(&opts_, ndots), + ARES_OPT_SOCK_SNDBUF|ARES_OPT_SOCK_RCVBUF|ARES_OPT_NDOTS) {} + static struct ares_options* FillOptions(struct ares_options * opts, int ndots) { + memset(opts, 0, sizeof(struct ares_options)); + // Set a few options that affect socket communications + opts->socket_send_buffer_size = 514; + opts->socket_receive_buffer_size = 514; + opts->ndots = ndots; + return opts; + } + private: + struct ares_options opts_; +}; + +class MockExtraOptsNDots5TestAI : public MockExtraOptsNDotsTestAI { + public: + MockExtraOptsNDots5TestAI() : MockExtraOptsNDotsTestAI(5) {} +}; + +TEST_P(MockExtraOptsNDots5TestAI, SimpleQuery) { + ares_set_local_ip4(channel_, 0x7F000001); + byte addr6[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; + ares_set_local_ip6(channel_, addr6); + ares_set_local_dev(channel_, "dummy"); + + DNSPacket rsp; + rsp.set_response().set_aa() + .add_question(new DNSQuestion("dynamodb.us-east-1.amazonaws.com", T_A)) + .add_answer(new DNSARR("dynamodb.us-east-1.amazonaws.com", 100, {123, 45, 67, 8})); + ON_CALL(server_, OnRequest("dynamodb.us-east-1.amazonaws.com", T_A)) + .WillByDefault(SetReply(&server_, &rsp)); + + AddrInfoResult result; + struct ares_addrinfo_hints hints = {}; + hints.ai_family = AF_INET; + hints.ai_flags = ARES_AI_NOSORT; + ares_getaddrinfo(channel_, "dynamodb.us-east-1.amazonaws.com.", NULL, &hints, AddrInfoCallback, &result); + Process(); + EXPECT_TRUE(result.done_); + EXPECT_EQ(ARES_SUCCESS, result.status_); + EXPECT_THAT(result.ai_, IncludesNumAddresses(1)); + EXPECT_THAT(result.ai_, IncludesV4Address("123.45.67.8")); +} + class MockFlagsChannelOptsTestAI : public MockChannelOptsTest, public ::testing::WithParamInterface< std::pair<int, bool> > { @@ -302,9 +353,9 @@ class MockNoCheckRespChannelTestAI : public MockFlagsChannelOptsTestAI { TEST_P(MockNoCheckRespChannelTestAI, ServFailResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_servfail); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(SERVFAIL); + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -320,9 +371,9 @@ TEST_P(MockNoCheckRespChannelTestAI, ServFailResponse) { TEST_P(MockNoCheckRespChannelTestAI, NotImplResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_notimpl); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(NOTIMP); + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -338,9 +389,9 @@ TEST_P(MockNoCheckRespChannelTestAI, NotImplResponse) { TEST_P(MockNoCheckRespChannelTestAI, RefusedResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_refused); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(REFUSED); + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); AddrInfoResult result; @@ -356,11 +407,11 @@ TEST_P(MockNoCheckRespChannelTestAI, RefusedResponse) { TEST_P(MockChannelTestAI, FamilyV6) { DNSPacket rsp6; rsp6.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSAaaaRR("example.com", 100, {0x21, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03})); - ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp6)); AddrInfoResult result; struct ares_addrinfo_hints hints = {}; @@ -377,9 +428,9 @@ TEST_P(MockChannelTestAI, FamilyV6) { TEST_P(MockChannelTestAI, FamilyV4) { DNSPacket rsp4; rsp4.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 100, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) + ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; struct ares_addrinfo_hints hints = {}; @@ -396,10 +447,10 @@ TEST_P(MockChannelTestAI, FamilyV4) { TEST_P(MockChannelTestAI, FamilyV4_MultipleAddresses) { DNSPacket rsp4; rsp4.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 100, {2, 3, 4, 5})) .add_answer(new DNSARR("example.com", 100, {7, 8, 9, 0})); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) + ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; struct ares_addrinfo_hints hints = {}; @@ -417,17 +468,17 @@ TEST_P(MockChannelTestAI, FamilyV4_MultipleAddresses) { TEST_P(MockChannelTestAI, FamilyUnspecified) { DNSPacket rsp6; rsp6.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSAaaaRR("example.com", 100, {0x21, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03})); - ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp6)); DNSPacket rsp4; rsp4.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 100, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) + ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result; struct ares_addrinfo_hints hints = {}; @@ -449,13 +500,13 @@ class MockEDNSChannelTestAI : public MockFlagsChannelOptsTestAI { TEST_P(MockEDNSChannelTestAI, RetryWithoutEDNS) { DNSPacket rspfail; - rspfail.set_response().set_aa().set_rcode(ns_r_servfail) - .add_question(new DNSQuestion("www.google.com", ns_t_a)); + rspfail.set_response().set_aa().set_rcode(FORMERR) + .add_question(new DNSQuestion("www.google.com", T_A)); DNSPacket rspok; rspok.set_response() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {1, 2, 3, 4})); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rspfail)) .WillOnce(SetReply(&server_, &rspok)); @@ -472,20 +523,20 @@ TEST_P(MockEDNSChannelTestAI, RetryWithoutEDNS) { TEST_P(MockChannelTestAI, SearchDomains) { DNSPacket nofirst; - nofirst.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + nofirst.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.first.com", T_A)); + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &nofirst)); DNSPacket nosecond; - nosecond.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.second.org", ns_t_a)); - ON_CALL(server_, OnRequest("www.second.org", ns_t_a)) + nosecond.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.second.org", T_A)); + ON_CALL(server_, OnRequest("www.second.org", T_A)) .WillByDefault(SetReply(&server_, &nosecond)); DNSPacket yesthird; yesthird.set_response().set_aa() - .add_question(new DNSQuestion("www.third.gov", ns_t_a)) + .add_question(new DNSQuestion("www.third.gov", T_A)) .add_answer(new DNSARR("www.third.gov", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + ON_CALL(server_, OnRequest("www.third.gov", T_A)) .WillByDefault(SetReply(&server_, &yesthird)); AddrInfoResult result; @@ -501,37 +552,37 @@ TEST_P(MockChannelTestAI, SearchDomains) { TEST_P(MockChannelTestAI, SearchDomainsServFailOnAAAA) { DNSPacket nofirst; - nofirst.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.first.com", ns_t_aaaa)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_aaaa)) + nofirst.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.first.com", T_AAAA)); + ON_CALL(server_, OnRequest("www.first.com", T_AAAA)) .WillByDefault(SetReply(&server_, &nofirst)); DNSPacket nofirst4; - nofirst4.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + nofirst4.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.first.com", T_A)); + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &nofirst4)); DNSPacket nosecond; - nosecond.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.second.org", ns_t_aaaa)); - ON_CALL(server_, OnRequest("www.second.org", ns_t_aaaa)) + nosecond.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.second.org", T_AAAA)); + ON_CALL(server_, OnRequest("www.second.org", T_AAAA)) .WillByDefault(SetReply(&server_, &nosecond)); DNSPacket yessecond4; yessecond4.set_response().set_aa() - .add_question(new DNSQuestion("www.second.org", ns_t_a)) + .add_question(new DNSQuestion("www.second.org", T_A)) .add_answer(new DNSARR("www.second.org", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.second.org", ns_t_a)) + ON_CALL(server_, OnRequest("www.second.org", T_A)) .WillByDefault(SetReply(&server_, &yessecond4)); DNSPacket failthird; - failthird.set_response().set_aa().set_rcode(ns_r_servfail) - .add_question(new DNSQuestion("www.third.gov", ns_t_aaaa)); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_aaaa)) + failthird.set_response().set_aa().set_rcode(SERVFAIL) + .add_question(new DNSQuestion("www.third.gov", T_AAAA)); + ON_CALL(server_, OnRequest("www.third.gov", T_AAAA)) .WillByDefault(SetReply(&server_, &failthird)); DNSPacket failthird4; - failthird4.set_response().set_aa().set_rcode(ns_r_servfail) - .add_question(new DNSQuestion("www.third.gov", ns_t_a)); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + failthird4.set_response().set_aa().set_rcode(SERVFAIL) + .add_question(new DNSQuestion("www.third.gov", T_A)); + ON_CALL(server_, OnRequest("www.third.gov", T_A)) .WillByDefault(SetReply(&server_, &failthird4)); AddrInfoResult result; @@ -584,39 +635,39 @@ TEST_P(RotateMultiMockTestAI, ThirdServer) { ares_destroy_options(&opts); DNSPacket servfailrsp; - servfailrsp.set_response().set_aa().set_rcode(ns_r_servfail) - .add_question(new DNSQuestion("www.example.com", ns_t_a)); + servfailrsp.set_response().set_aa().set_rcode(SERVFAIL) + .add_question(new DNSQuestion("www.example.com", T_A)); DNSPacket notimplrsp; - notimplrsp.set_response().set_aa().set_rcode(ns_r_notimpl) - .add_question(new DNSQuestion("www.example.com", ns_t_a)); + notimplrsp.set_response().set_aa().set_rcode(NOTIMP) + .add_question(new DNSQuestion("www.example.com", T_A)); DNSPacket okrsp; okrsp.set_response().set_aa() - .add_question(new DNSQuestion("www.example.com", ns_t_a)) + .add_question(new DNSQuestion("www.example.com", T_A)) .add_answer(new DNSARR("www.example.com", 100, {2,3,4,5})); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), ¬implrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &okrsp)); CheckExample(); // Second time around, starts from server [1]. - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), &servfailrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), ¬implrsp)); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &okrsp)); CheckExample(); // Third time around, starts from server [2]. - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &servfailrsp)); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), ¬implrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), &okrsp)); CheckExample(); } @@ -629,39 +680,39 @@ TEST_P(NoRotateMultiMockTestAI, ThirdServer) { ares_destroy_options(&opts); DNSPacket servfailrsp; - servfailrsp.set_response().set_aa().set_rcode(ns_r_servfail) - .add_question(new DNSQuestion("www.example.com", ns_t_a)); + servfailrsp.set_response().set_aa().set_rcode(SERVFAIL) + .add_question(new DNSQuestion("www.example.com", T_A)); DNSPacket notimplrsp; - notimplrsp.set_response().set_aa().set_rcode(ns_r_notimpl) - .add_question(new DNSQuestion("www.example.com", ns_t_a)); + notimplrsp.set_response().set_aa().set_rcode(NOTIMP) + .add_question(new DNSQuestion("www.example.com", T_A)); DNSPacket okrsp; okrsp.set_response().set_aa() - .add_question(new DNSQuestion("www.example.com", ns_t_a)) + .add_question(new DNSQuestion("www.example.com", T_A)) .add_answer(new DNSARR("www.example.com", 100, {2,3,4,5})); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), ¬implrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &okrsp)); CheckExample(); // Second time around, still starts from server [0]. - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), ¬implrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &okrsp)); CheckExample(); // Third time around, still starts from server [0]. - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), ¬implrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &okrsp)); CheckExample(); } @@ -669,10 +720,10 @@ TEST_P(NoRotateMultiMockTestAI, ThirdServer) { TEST_P(MockChannelTestAI, FamilyV4ServiceName) { DNSPacket rsp4; rsp4.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 100, {1, 1, 1, 1})) .add_answer(new DNSARR("example.com", 100, {2, 2, 2, 2})); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) + ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); AddrInfoResult result = {}; struct ares_addrinfo_hints hints = {}; @@ -706,6 +757,9 @@ INSTANTIATE_TEST_CASE_P(AddressFamiliesAI, MockTCPChannelTestAI, INSTANTIATE_TEST_CASE_P(AddressFamiliesAI, MockExtraOptsTestAI, ::testing::ValuesIn(ares::test::families_modes)); +INSTANTIATE_TEST_CASE_P(AddressFamiliesAI, MockExtraOptsNDots5TestAI, + ::testing::ValuesIn(ares::test::families_modes)); + INSTANTIATE_TEST_CASE_P(AddressFamiliesAI, MockNoCheckRespChannelTestAI, ::testing::ValuesIn(ares::test::families_modes)); diff --git a/contrib/libs/c-ares/test/ares-test-mock.cc b/contrib/libs/c-ares/test/ares-test-mock.cc index 80e9fc02b0..f4e773cf8f 100644 --- a/contrib/libs/c-ares/test/ares-test-mock.cc +++ b/contrib/libs/c-ares/test/ares-test-mock.cc @@ -38,7 +38,7 @@ TEST_P(MockChannelTest, Basic) { 0x01, 0x02, 0x03, 0x04 }; - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReplyData(&server_, reply)); HostResult result; @@ -54,15 +54,15 @@ TEST_P(MockChannelTest, Basic) { TEST_P(MockUDPChannelTest, GetHostByNameParallelLookups) { DNSPacket rsp1; rsp1.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp1)); DNSPacket rsp2; rsp2.set_response().set_aa() - .add_question(new DNSQuestion("www.example.com", ns_t_a)) + .add_question(new DNSQuestion("www.example.com", T_A)) .add_answer(new DNSARR("www.example.com", 100, {1, 2, 3, 4})); - ON_CALL(server_, OnRequest("www.example.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp2)); HostResult result1; @@ -90,12 +90,12 @@ TEST_P(MockUDPChannelTest, GetHostByNameParallelLookups) { TEST_P(MockUDPChannelTest, TruncationRetry) { DNSPacket rsptruncated; rsptruncated.set_response().set_aa().set_tc() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); + .add_question(new DNSQuestion("www.google.com", T_A)); DNSPacket rspok; rspok.set_response() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {1, 2, 3, 4})); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsptruncated)) .WillOnce(SetReply(&server_, &rspok)); HostResult result; @@ -118,9 +118,9 @@ static int SocketConnectCallback(ares_socket_t fd, int type, void *data) { TEST_P(MockChannelTest, SockCallback) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {2, 3, 4, 5})); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); // Get notified of new sockets @@ -163,9 +163,9 @@ static int SocketConfigureCallback(ares_socket_t fd, int type, void *data) { TEST_P(MockChannelTest, SockConfigureCallback) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {2, 3, 4, 5})); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); // Get notified of new sockets @@ -200,7 +200,7 @@ TEST_P(MockChannelTest, SockConfigureFailCallback) { // TCP only to prevent retries TEST_P(MockTCPChannelTest, MalformedResponse) { std::vector<byte> one = {0x01}; - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReplyData(&server_, one)); HostResult result; @@ -213,9 +213,9 @@ TEST_P(MockTCPChannelTest, MalformedResponse) { TEST_P(MockTCPChannelTest, FormErrResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_formerr); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(FORMERR); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); HostResult result; ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); @@ -227,9 +227,9 @@ TEST_P(MockTCPChannelTest, FormErrResponse) { TEST_P(MockTCPChannelTest, ServFailResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_servfail); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(SERVFAIL); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); HostResult result; ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); @@ -242,24 +242,24 @@ TEST_P(MockTCPChannelTest, ServFailResponse) { TEST_P(MockTCPChannelTest, NotImplResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_notimpl); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(NOTIMP); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); HostResult result; ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); Process(); EXPECT_TRUE(result.done_); - // ARES_FLAG_NOCHECKRESP not set, so NOTIMPL consumed + // ARES_FLAG_NOCHECKRESP not set, so NOTIMP consumed EXPECT_EQ(ARES_ECONNREFUSED, result.status_); } TEST_P(MockTCPChannelTest, RefusedResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_refused); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(REFUSED); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); HostResult result; ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); @@ -272,9 +272,9 @@ TEST_P(MockTCPChannelTest, RefusedResponse) { TEST_P(MockTCPChannelTest, YXDomainResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_yxdomain); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(YXDOMAIN); + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rsp)); HostResult result; ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); @@ -311,9 +311,9 @@ TEST_P(MockExtraOptsTest, SimpleQuery) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); HostResult result; @@ -349,9 +349,9 @@ class MockNoCheckRespChannelTest : public MockFlagsChannelOptsTest { TEST_P(MockNoCheckRespChannelTest, ServFailResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_servfail); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(SERVFAIL); + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); HostResult result; ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); @@ -363,9 +363,9 @@ TEST_P(MockNoCheckRespChannelTest, ServFailResponse) { TEST_P(MockNoCheckRespChannelTest, NotImplResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_notimpl); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(NOTIMP); + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); HostResult result; ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); @@ -377,9 +377,9 @@ TEST_P(MockNoCheckRespChannelTest, NotImplResponse) { TEST_P(MockNoCheckRespChannelTest, RefusedResponse) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)); - rsp.set_rcode(ns_r_refused); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)); + rsp.set_rcode(REFUSED); + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); HostResult result; ares_gethostbyname(channel_, "www.google.com.", AF_INET, HostCallback, &result); @@ -395,13 +395,13 @@ class MockEDNSChannelTest : public MockFlagsChannelOptsTest { TEST_P(MockEDNSChannelTest, RetryWithoutEDNS) { DNSPacket rspfail; - rspfail.set_response().set_aa().set_rcode(ns_r_servfail) - .add_question(new DNSQuestion("www.google.com", ns_t_a)); + rspfail.set_response().set_aa().set_rcode(FORMERR) + .add_question(new DNSQuestion("www.google.com", T_A)); DNSPacket rspok; rspok.set_response() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 100, {1, 2, 3, 4})); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReply(&server_, &rspfail)) .WillOnce(SetReply(&server_, &rspok)); HostResult result; @@ -415,20 +415,20 @@ TEST_P(MockEDNSChannelTest, RetryWithoutEDNS) { TEST_P(MockChannelTest, SearchDomains) { DNSPacket nofirst; - nofirst.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + nofirst.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.first.com", T_A)); + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &nofirst)); DNSPacket nosecond; - nosecond.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.second.org", ns_t_a)); - ON_CALL(server_, OnRequest("www.second.org", ns_t_a)) + nosecond.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.second.org", T_A)); + ON_CALL(server_, OnRequest("www.second.org", T_A)) .WillByDefault(SetReply(&server_, &nosecond)); DNSPacket yesthird; yesthird.set_response().set_aa() - .add_question(new DNSQuestion("www.third.gov", ns_t_a)) + .add_question(new DNSQuestion("www.third.gov", T_A)) .add_answer(new DNSARR("www.third.gov", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + ON_CALL(server_, OnRequest("www.third.gov", T_A)) .WillByDefault(SetReply(&server_, &yesthird)); HostResult result; @@ -443,21 +443,21 @@ TEST_P(MockChannelTest, SearchDomains) { // Relies on retries so is UDP-only TEST_P(MockUDPChannelTest, SearchDomainsWithResentReply) { DNSPacket nofirst; - nofirst.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - EXPECT_CALL(server_, OnRequest("www.first.com", ns_t_a)) + nofirst.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.first.com", T_A)); + EXPECT_CALL(server_, OnRequest("www.first.com", T_A)) .WillOnce(SetReply(&server_, &nofirst)); DNSPacket nosecond; - nosecond.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.second.org", ns_t_a)); - EXPECT_CALL(server_, OnRequest("www.second.org", ns_t_a)) + nosecond.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.second.org", T_A)); + EXPECT_CALL(server_, OnRequest("www.second.org", T_A)) .WillOnce(SetReply(&server_, &nosecond)); DNSPacket yesthird; yesthird.set_response().set_aa() - .add_question(new DNSQuestion("www.third.gov", ns_t_a)) + .add_question(new DNSQuestion("www.third.gov", T_A)) .add_answer(new DNSARR("www.third.gov", 0x0200, {2, 3, 4, 5})); // Before sending the real answer, resend an earlier reply - EXPECT_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.third.gov", T_A)) .WillOnce(DoAll(SetReply(&server_, &nofirst), SetReplyQID(&server_, 123))) .WillOnce(DoAll(SetReply(&server_, &yesthird), @@ -474,25 +474,25 @@ TEST_P(MockUDPChannelTest, SearchDomainsWithResentReply) { TEST_P(MockChannelTest, SearchDomainsBare) { DNSPacket nofirst; - nofirst.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + nofirst.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.first.com", T_A)); + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &nofirst)); DNSPacket nosecond; - nosecond.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.second.org", ns_t_a)); - ON_CALL(server_, OnRequest("www.second.org", ns_t_a)) + nosecond.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.second.org", T_A)); + ON_CALL(server_, OnRequest("www.second.org", T_A)) .WillByDefault(SetReply(&server_, &nosecond)); DNSPacket nothird; - nothird.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.third.gov", ns_t_a)); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + nothird.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.third.gov", T_A)); + ON_CALL(server_, OnRequest("www.third.gov", T_A)) .WillByDefault(SetReply(&server_, ¬hird)); DNSPacket yesbare; yesbare.set_response().set_aa() - .add_question(new DNSQuestion("www", ns_t_a)) + .add_question(new DNSQuestion("www", T_A)) .add_answer(new DNSARR("www", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www", ns_t_a)) + ON_CALL(server_, OnRequest("www", T_A)) .WillByDefault(SetReply(&server_, &yesbare)); HostResult result; @@ -508,19 +508,19 @@ TEST_P(MockChannelTest, SearchNoDataThenSuccess) { // First two search domains recognize the name but have no A records. DNSPacket nofirst; nofirst.set_response().set_aa() - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + .add_question(new DNSQuestion("www.first.com", T_A)); + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &nofirst)); DNSPacket nosecond; nosecond.set_response().set_aa() - .add_question(new DNSQuestion("www.second.org", ns_t_a)); - ON_CALL(server_, OnRequest("www.second.org", ns_t_a)) + .add_question(new DNSQuestion("www.second.org", T_A)); + ON_CALL(server_, OnRequest("www.second.org", T_A)) .WillByDefault(SetReply(&server_, &nosecond)); DNSPacket yesthird; yesthird.set_response().set_aa() - .add_question(new DNSQuestion("www.third.gov", ns_t_a)) + .add_question(new DNSQuestion("www.third.gov", T_A)) .add_answer(new DNSARR("www.third.gov", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + ON_CALL(server_, OnRequest("www.third.gov", T_A)) .WillByDefault(SetReply(&server_, &yesthird)); HostResult result; @@ -536,23 +536,23 @@ TEST_P(MockChannelTest, SearchNoDataThenNoDataBare) { // First two search domains recognize the name but have no A records. DNSPacket nofirst; nofirst.set_response().set_aa() - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + .add_question(new DNSQuestion("www.first.com", T_A)); + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &nofirst)); DNSPacket nosecond; nosecond.set_response().set_aa() - .add_question(new DNSQuestion("www.second.org", ns_t_a)); - ON_CALL(server_, OnRequest("www.second.org", ns_t_a)) + .add_question(new DNSQuestion("www.second.org", T_A)); + ON_CALL(server_, OnRequest("www.second.org", T_A)) .WillByDefault(SetReply(&server_, &nosecond)); DNSPacket nothird; nothird.set_response().set_aa() - .add_question(new DNSQuestion("www.third.gov", ns_t_a)); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + .add_question(new DNSQuestion("www.third.gov", T_A)); + ON_CALL(server_, OnRequest("www.third.gov", T_A)) .WillByDefault(SetReply(&server_, ¬hird)); DNSPacket nobare; nobare.set_response().set_aa() - .add_question(new DNSQuestion("www", ns_t_a)); - ON_CALL(server_, OnRequest("www", ns_t_a)) + .add_question(new DNSQuestion("www", T_A)); + ON_CALL(server_, OnRequest("www", T_A)) .WillByDefault(SetReply(&server_, &nobare)); HostResult result; @@ -566,23 +566,23 @@ TEST_P(MockChannelTest, SearchNoDataThenFail) { // First two search domains recognize the name but have no A records. DNSPacket nofirst; nofirst.set_response().set_aa() - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + .add_question(new DNSQuestion("www.first.com", T_A)); + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &nofirst)); DNSPacket nosecond; nosecond.set_response().set_aa() - .add_question(new DNSQuestion("www.second.org", ns_t_a)); - ON_CALL(server_, OnRequest("www.second.org", ns_t_a)) + .add_question(new DNSQuestion("www.second.org", T_A)); + ON_CALL(server_, OnRequest("www.second.org", T_A)) .WillByDefault(SetReply(&server_, &nosecond)); DNSPacket nothird; nothird.set_response().set_aa() - .add_question(new DNSQuestion("www.third.gov", ns_t_a)); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + .add_question(new DNSQuestion("www.third.gov", T_A)); + ON_CALL(server_, OnRequest("www.third.gov", T_A)) .WillByDefault(SetReply(&server_, ¬hird)); DNSPacket nobare; - nobare.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www", ns_t_a)); - ON_CALL(server_, OnRequest("www", ns_t_a)) + nobare.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www", T_A)); + ON_CALL(server_, OnRequest("www", T_A)) .WillByDefault(SetReply(&server_, &nobare)); HostResult result; @@ -595,7 +595,7 @@ TEST_P(MockChannelTest, SearchNoDataThenFail) { TEST_P(MockChannelTest, SearchAllocFailure) { SearchResult result; SetAllocFail(1); - ares_search(channel_, "fully.qualified.", ns_c_in, ns_t_a, SearchCallback, &result); + ares_search(channel_, "fully.qualified.", C_IN, T_A, SearchCallback, &result); /* Already done */ EXPECT_TRUE(result.done_); EXPECT_EQ(ARES_ENOMEM, result.status_); @@ -603,19 +603,19 @@ TEST_P(MockChannelTest, SearchAllocFailure) { TEST_P(MockChannelTest, SearchHighNdots) { DNSPacket nobare; - nobare.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("a.b.c.w.w.w", ns_t_a)); - ON_CALL(server_, OnRequest("a.b.c.w.w.w", ns_t_a)) + nobare.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("a.b.c.w.w.w", T_A)); + ON_CALL(server_, OnRequest("a.b.c.w.w.w", T_A)) .WillByDefault(SetReply(&server_, &nobare)); DNSPacket yesfirst; yesfirst.set_response().set_aa() - .add_question(new DNSQuestion("a.b.c.w.w.w.first.com", ns_t_a)) + .add_question(new DNSQuestion("a.b.c.w.w.w.first.com", T_A)) .add_answer(new DNSARR("a.b.c.w.w.w.first.com", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("a.b.c.w.w.w.first.com", ns_t_a)) + ON_CALL(server_, OnRequest("a.b.c.w.w.w.first.com", T_A)) .WillByDefault(SetReply(&server_, &yesfirst)); SearchResult result; - ares_search(channel_, "a.b.c.w.w.w", ns_c_in, ns_t_a, SearchCallback, &result); + ares_search(channel_, "a.b.c.w.w.w", C_IN, T_A, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); EXPECT_EQ(ARES_SUCCESS, result.status_); @@ -629,11 +629,11 @@ TEST_P(MockChannelTest, SearchHighNdots) { TEST_P(MockChannelTest, UnspecifiedFamilyV6) { DNSPacket rsp6; rsp6.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSAaaaRR("example.com", 100, {0x21, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03})); - ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp6)); HostResult result; @@ -649,14 +649,14 @@ TEST_P(MockChannelTest, UnspecifiedFamilyV6) { TEST_P(MockChannelTest, UnspecifiedFamilyV4) { DNSPacket rsp6; rsp6.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)); - ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)); + ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp6)); DNSPacket rsp4; rsp4.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 100, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) + ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); HostResult result; @@ -671,14 +671,14 @@ TEST_P(MockChannelTest, UnspecifiedFamilyV4) { TEST_P(MockChannelTest, UnspecifiedFamilyNoData) { DNSPacket rsp6; rsp6.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSCnameRR("example.com", 100, "elsewhere.com")); - ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp6)); DNSPacket rsp4; rsp4.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)); + ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); HostResult result; @@ -693,15 +693,15 @@ TEST_P(MockChannelTest, UnspecifiedFamilyNoData) { TEST_P(MockChannelTest, UnspecifiedFamilyCname6A4) { DNSPacket rsp6; rsp6.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSCnameRR("example.com", 100, "elsewhere.com")); - ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp6)); DNSPacket rsp4; rsp4.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 100, {1, 2, 3, 4})); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) + ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp4)); HostResult result; @@ -734,11 +734,11 @@ TEST_P(MockChannelTest, ExplicitIPAllocFail) { TEST_P(MockChannelTest, SortListV4) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 100, {22, 23, 24, 25})) .add_answer(new DNSARR("example.com", 100, {12, 13, 14, 15})) .add_answer(new DNSARR("example.com", 100, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) + ON_CALL(server_, OnRequest("example.com", T_A)) .WillByDefault(SetReply(&server_, &rsp)); { @@ -772,14 +772,14 @@ TEST_P(MockChannelTest, SortListV4) { TEST_P(MockChannelTest, SortListV6) { DNSPacket rsp; rsp.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSAaaaRR("example.com", 100, {0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02})) .add_answer(new DNSAaaaRR("example.com", 100, {0x21, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03})); - ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + ON_CALL(server_, OnRequest("example.com", T_AAAA)) .WillByDefault(SetReply(&server_, &rsp)); { @@ -809,20 +809,20 @@ TEST_P(MockChannelTest, SortListV6) { // Relies on retries so is UDP-only TEST_P(MockUDPChannelTest, SearchDomainsAllocFail) { DNSPacket nofirst; - nofirst.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.first.com", ns_t_a)); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + nofirst.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.first.com", T_A)); + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &nofirst)); DNSPacket nosecond; - nosecond.set_response().set_aa().set_rcode(ns_r_nxdomain) - .add_question(new DNSQuestion("www.second.org", ns_t_a)); - ON_CALL(server_, OnRequest("www.second.org", ns_t_a)) + nosecond.set_response().set_aa().set_rcode(NXDOMAIN) + .add_question(new DNSQuestion("www.second.org", T_A)); + ON_CALL(server_, OnRequest("www.second.org", T_A)) .WillByDefault(SetReply(&server_, &nosecond)); DNSPacket yesthird; yesthird.set_response().set_aa() - .add_question(new DNSQuestion("www.third.gov", ns_t_a)) + .add_question(new DNSQuestion("www.third.gov", T_A)) .add_answer(new DNSARR("www.third.gov", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.third.gov", ns_t_a)) + ON_CALL(server_, OnRequest("www.third.gov", T_A)) .WillByDefault(SetReply(&server_, &yesthird)); // Fail a variety of different memory allocations, and confirm @@ -856,10 +856,10 @@ TEST_P(MockUDPChannelTest, Resend) { std::vector<byte> nothing; DNSPacket reply; reply.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 0x0100, {0x01, 0x02, 0x03, 0x04})); - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReplyData(&server_, nothing)) .WillOnce(SetReplyData(&server_, nothing)) .WillOnce(SetReply(&server_, &reply)); @@ -900,7 +900,7 @@ TEST_P(MockUDPChannelTest, CancelLater) { std::vector<byte> nothing; // On second request, cancel the channel. - EXPECT_CALL(server_, OnRequest("www.google.com", ns_t_a)) + EXPECT_CALL(server_, OnRequest("www.google.com", T_A)) .WillOnce(SetReplyData(&server_, nothing)) .WillOnce(CancelChannel(&server_, channel_)); @@ -939,9 +939,9 @@ TEST_P(MockChannelTest, GetHostByNameDestroyRelative) { TEST_P(MockChannelTest, GetHostByNameCNAMENoData) { DNSPacket response; response.set_response().set_aa() - .add_question(new DNSQuestion("cname.first.com", ns_t_a)) + .add_question(new DNSQuestion("cname.first.com", T_A)) .add_answer(new DNSCnameRR("cname.first.com", 100, "a.first.com")); - ON_CALL(server_, OnRequest("cname.first.com", ns_t_a)) + ON_CALL(server_, OnRequest("cname.first.com", T_A)) .WillByDefault(SetReply(&server_, &response)); HostResult result; @@ -968,9 +968,9 @@ TEST_P(MockChannelTest, GetHostByAddrDestroy) { TEST_P(MockChannelTest, HostAlias) { DNSPacket reply; reply.set_response().set_aa() - .add_question(new DNSQuestion("www.google.com", ns_t_a)) + .add_question(new DNSQuestion("www.google.com", T_A)) .add_answer(new DNSARR("www.google.com", 0x0100, {0x01, 0x02, 0x03, 0x04})); - ON_CALL(server_, OnRequest("www.google.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.google.com", T_A)) .WillByDefault(SetReply(&server_, &reply)); TempFile aliases("\n\n# www commentedout\nwww www.google.com\n"); @@ -988,9 +988,9 @@ TEST_P(MockChannelTest, HostAlias) { TEST_P(MockChannelTest, HostAliasMissing) { DNSPacket yesfirst; yesfirst.set_response().set_aa() - .add_question(new DNSQuestion("www.first.com", ns_t_a)) + .add_question(new DNSQuestion("www.first.com", T_A)) .add_answer(new DNSARR("www.first.com", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &yesfirst)); TempFile aliases("\n\n# www commentedout\nww www.google.com\n"); @@ -1007,9 +1007,9 @@ TEST_P(MockChannelTest, HostAliasMissing) { TEST_P(MockChannelTest, HostAliasMissingFile) { DNSPacket yesfirst; yesfirst.set_response().set_aa() - .add_question(new DNSQuestion("www.first.com", ns_t_a)) + .add_question(new DNSQuestion("www.first.com", T_A)) .add_answer(new DNSARR("www.first.com", 0x0200, {2, 3, 4, 5})); - ON_CALL(server_, OnRequest("www.first.com", ns_t_a)) + ON_CALL(server_, OnRequest("www.first.com", T_A)) .WillByDefault(SetReply(&server_, &yesfirst)); EnvValue with_env("HOSTALIASES", "bogus.mcfile"); @@ -1071,39 +1071,39 @@ TEST_P(RotateMultiMockTest, ThirdServer) { ares_destroy_options(&opts); DNSPacket servfailrsp; - servfailrsp.set_response().set_aa().set_rcode(ns_r_servfail) - .add_question(new DNSQuestion("www.example.com", ns_t_a)); + servfailrsp.set_response().set_aa().set_rcode(SERVFAIL) + .add_question(new DNSQuestion("www.example.com", T_A)); DNSPacket notimplrsp; - notimplrsp.set_response().set_aa().set_rcode(ns_r_notimpl) - .add_question(new DNSQuestion("www.example.com", ns_t_a)); + notimplrsp.set_response().set_aa().set_rcode(NOTIMP) + .add_question(new DNSQuestion("www.example.com", T_A)); DNSPacket okrsp; okrsp.set_response().set_aa() - .add_question(new DNSQuestion("www.example.com", ns_t_a)) + .add_question(new DNSQuestion("www.example.com", T_A)) .add_answer(new DNSARR("www.example.com", 100, {2,3,4,5})); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), ¬implrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &okrsp)); CheckExample(); // Second time around, starts from server [1]. - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), &servfailrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), ¬implrsp)); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &okrsp)); CheckExample(); // Third time around, starts from server [2]. - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &servfailrsp)); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), ¬implrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), &okrsp)); CheckExample(); } @@ -1116,39 +1116,39 @@ TEST_P(NoRotateMultiMockTest, ThirdServer) { ares_destroy_options(&opts); DNSPacket servfailrsp; - servfailrsp.set_response().set_aa().set_rcode(ns_r_servfail) - .add_question(new DNSQuestion("www.example.com", ns_t_a)); + servfailrsp.set_response().set_aa().set_rcode(SERVFAIL) + .add_question(new DNSQuestion("www.example.com", T_A)); DNSPacket notimplrsp; - notimplrsp.set_response().set_aa().set_rcode(ns_r_notimpl) - .add_question(new DNSQuestion("www.example.com", ns_t_a)); + notimplrsp.set_response().set_aa().set_rcode(NOTIMP) + .add_question(new DNSQuestion("www.example.com", T_A)); DNSPacket okrsp; okrsp.set_response().set_aa() - .add_question(new DNSQuestion("www.example.com", ns_t_a)) + .add_question(new DNSQuestion("www.example.com", T_A)) .add_answer(new DNSARR("www.example.com", 100, {2,3,4,5})); - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), ¬implrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &okrsp)); CheckExample(); // Second time around, still starts from server [0]. - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), ¬implrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &okrsp)); CheckExample(); // Third time around, still starts from server [0]. - EXPECT_CALL(*servers_[0], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[0], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[0].get(), &servfailrsp)); - EXPECT_CALL(*servers_[1], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[1], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[1].get(), ¬implrsp)); - EXPECT_CALL(*servers_[2], OnRequest("www.example.com", ns_t_a)) + EXPECT_CALL(*servers_[2], OnRequest("www.example.com", T_A)) .WillOnce(SetReply(servers_[2].get(), &okrsp)); CheckExample(); } diff --git a/contrib/libs/c-ares/test/ares-test-parse-a.cc b/contrib/libs/c-ares/test/ares-test-parse-a.cc index 7f6a987c13..f8050ac708 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-a.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-a.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseAReplyOK) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 0x01020304, {2,3,4,5})) .add_answer(new DNSAaaaRR("example.com", 0x01020304, {0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5})); std::vector<byte> data = { @@ -119,7 +119,7 @@ TEST_F(LibraryTest, ParseMalformedAReply) { TEST_F(LibraryTest, ParseAReplyNoData) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)); + .add_question(new DNSQuestion("example.com", T_A)); std::vector<byte> data = pkt.data(); struct hostent *host = nullptr; struct ares_addrttl info[2]; @@ -146,7 +146,7 @@ TEST_F(LibraryTest, ParseAReplyNoData) { TEST_F(LibraryTest, ParseAReplyVariantA) { DNSPacket pkt; pkt.set_qid(6366).set_rd().set_ra() - .add_question(new DNSQuestion("mit.edu", ns_t_a)) + .add_question(new DNSQuestion("mit.edu", T_A)) .add_answer(new DNSARR("mit.edu", 52, {18,7,22,69})) .add_auth(new DNSNsRR("mit.edu", 292, "W20NS.mit.edu")) .add_auth(new DNSNsRR("mit.edu", 292, "BITSY.mit.edu")) @@ -167,7 +167,7 @@ TEST_F(LibraryTest, ParseAReplyVariantA) { TEST_F(LibraryTest, ParseAReplyJustCname) { DNSPacket pkt; pkt.set_qid(6366).set_rd().set_ra() - .add_question(new DNSQuestion("mit.edu", ns_t_a)) + .add_question(new DNSQuestion("mit.edu", T_A)) .add_answer(new DNSCnameRR("mit.edu", 52, "other.mit.edu")); struct hostent *host = nullptr; struct ares_addrttl info[2]; @@ -186,7 +186,7 @@ TEST_F(LibraryTest, ParseAReplyJustCname) { TEST_F(LibraryTest, ParseAReplyVariantCname) { DNSPacket pkt; pkt.set_qid(6366).set_rd().set_ra() - .add_question(new DNSQuestion("query.example.com", ns_t_a)) + .add_question(new DNSQuestion("query.example.com", T_A)) .add_answer(new DNSCnameRR("query.example.com", 200, "redirect.query.example.com")) .add_answer(new DNSARR("redirect.query.example.com", 300, {129,97,123,22})) .add_auth(new DNSNsRR("example.com", 218, "aa.ns1.example.com")) @@ -218,7 +218,7 @@ TEST_F(LibraryTest, ParseAReplyVariantCname) { TEST_F(LibraryTest, ParseAReplyVariantCnameChain) { DNSPacket pkt; pkt.set_qid(6366).set_rd().set_ra() - .add_question(new DNSQuestion("c1.localhost", ns_t_a)) + .add_question(new DNSQuestion("c1.localhost", T_A)) .add_answer(new DNSCnameRR("c1.localhost", 604800, "c2.localhost")) .add_answer(new DNSCnameRR("c2.localhost", 604800, "c3.localhost")) .add_answer(new DNSCnameRR("c3.localhost", 604800, "c4.localhost")) @@ -243,7 +243,7 @@ TEST_F(LibraryTest, ParseAReplyVariantCnameChain) { TEST_F(LibraryTest, DISABLED_ParseAReplyVariantCnameLast) { DNSPacket pkt; pkt.set_qid(6366).set_rd().set_ra() - .add_question(new DNSQuestion("query.example.com", ns_t_a)) + .add_question(new DNSQuestion("query.example.com", T_A)) .add_answer(new DNSARR("redirect.query.example.com", 300, {129,97,123,221})) .add_answer(new DNSARR("redirect.query.example.com", 300, {129,97,123,222})) .add_answer(new DNSARR("redirect.query.example.com", 300, {129,97,123,223})) @@ -271,7 +271,7 @@ TEST_F(LibraryTest, DISABLED_ParseAReplyVariantCnameLast) { TEST_F(LibraryTest, ParseAReplyErrors) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSARR("example.com", 100, {0x02, 0x03, 0x04, 0x05})); std::vector<byte> data; @@ -285,17 +285,17 @@ TEST_F(LibraryTest, ParseAReplyErrors) { EXPECT_EQ(ARES_EBADRESP, ares_parse_a_reply(data.data(), data.size(), &host, info, &count)); EXPECT_EQ(nullptr, host); - pkt.add_question(new DNSQuestion("example.com", ns_t_a)); + pkt.add_question(new DNSQuestion("example.com", T_A)); // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_a)); + pkt.add_question(new DNSQuestion("Axample.com", T_A)); data = pkt.data(); EXPECT_EQ(ARES_ENODATA, ares_parse_a_reply(data.data(), data.size(), &host, info, &count)); EXPECT_EQ(nullptr, host); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_a)); + pkt.add_question(new DNSQuestion("example.com", T_A)); #ifdef DISABLED // Not a response. @@ -307,22 +307,22 @@ TEST_F(LibraryTest, ParseAReplyErrors) { pkt.set_response(true); // Bad return code. - pkt.set_rcode(ns_r_formerr); + pkt.set_rcode(FORMERR); data = pkt.data(); EXPECT_EQ(ARES_ENODATA, ares_parse_a_reply(data.data(), data.size(), &host, info, &count)); EXPECT_EQ(nullptr, host); - pkt.set_rcode(ns_r_noerror); + pkt.set_rcode(NOERROR); #endif // Two questions - pkt.add_question(new DNSQuestion("example.com", ns_t_a)); + pkt.add_question(new DNSQuestion("example.com", T_A)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_a_reply(data.data(), data.size(), &host, info, &count)); EXPECT_EQ(nullptr, host); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_a)); + pkt.add_question(new DNSQuestion("example.com", T_A)); // Wrong sort of answer. pkt.answers_.clear(); @@ -356,7 +356,7 @@ TEST_F(LibraryTest, ParseAReplyErrors) { TEST_F(LibraryTest, ParseAReplyAllocFail) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_question(new DNSQuestion("example.com", T_A)) .add_answer(new DNSCnameRR("example.com", 300, "c.example.com")) .add_answer(new DNSARR("c.example.com", 500, {0x02, 0x03, 0x04, 0x05})); std::vector<byte> data = pkt.data(); diff --git a/contrib/libs/c-ares/test/ares-test-parse-aaaa.cc b/contrib/libs/c-ares/test/ares-test-parse-aaaa.cc index 1314c837a6..df56529680 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-aaaa.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-aaaa.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseAaaaReplyOK) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSAaaaRR("example.com", 100, {0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04})) @@ -40,7 +40,7 @@ TEST_F(LibraryTest, ParseAaaaReplyOK) { TEST_F(LibraryTest, ParseAaaaReplyCname) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSCnameRR("example.com", 50, "c.example.com")) .add_answer(new DNSAaaaRR("c.example.com", 100, {0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, @@ -75,7 +75,7 @@ TEST_F(LibraryTest, ParseAaaaReplyCname) { TEST_F(LibraryTest, ParseAaaaReplyNoData) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)); + .add_question(new DNSQuestion("example.com", T_AAAA)); std::vector<byte> data = pkt.data(); struct hostent *host = nullptr; struct ares_addr6ttl info[2]; @@ -96,7 +96,7 @@ TEST_F(LibraryTest, ParseAaaaReplyNoData) { TEST_F(LibraryTest, ParseAaaaReplyErrors) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSAaaaRR("example.com", 100, {0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04})); @@ -112,26 +112,26 @@ TEST_F(LibraryTest, ParseAaaaReplyErrors) { EXPECT_EQ(ARES_EBADRESP, ares_parse_aaaa_reply(data.data(), data.size(), &host, info, &count)); EXPECT_EQ(nullptr, host); - pkt.add_question(new DNSQuestion("example.com", ns_t_aaaa)); + pkt.add_question(new DNSQuestion("example.com", T_AAAA)); // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_aaaa)); + pkt.add_question(new DNSQuestion("Axample.com", T_AAAA)); data = pkt.data(); EXPECT_EQ(ARES_ENODATA, ares_parse_aaaa_reply(data.data(), data.size(), &host, info, &count)); EXPECT_EQ(nullptr, host); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_aaaa)); + pkt.add_question(new DNSQuestion("example.com", T_AAAA)); // Two questions. - pkt.add_question(new DNSQuestion("example.com", ns_t_aaaa)); + pkt.add_question(new DNSQuestion("example.com", T_AAAA)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_aaaa_reply(data.data(), data.size(), &host, info, &count)); EXPECT_EQ(nullptr, host); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_aaaa)); + pkt.add_question(new DNSQuestion("example.com", T_AAAA)); // Wrong sort of answer. pkt.answers_.clear(); @@ -169,7 +169,7 @@ TEST_F(LibraryTest, ParseAaaaReplyErrors) { TEST_F(LibraryTest, ParseAaaaReplyAllocFail) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_question(new DNSQuestion("example.com", T_AAAA)) .add_answer(new DNSCnameRR("example.com", 300, "c.example.com")) .add_answer(new DNSAaaaRR("c.example.com", 100, {0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, diff --git a/contrib/libs/c-ares/test/ares-test-parse-caa.cc b/contrib/libs/c-ares/test/ares-test-parse-caa.cc new file mode 100644 index 0000000000..99903edf71 --- /dev/null +++ b/contrib/libs/c-ares/test/ares-test-parse-caa.cc @@ -0,0 +1,113 @@ +#include "ares-test.h" +#include "dns-proto.h" + +#include <sstream> +#include <vector> + +namespace ares { +namespace test { + +TEST_F(LibraryTest, ParseCaaReplyMultipleOK) { + std::vector<byte> data = { + 0x27, 0x86, 0x81, 0x80, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x09, 0x77, 0x69, 0x6B, // '............wik + 0x69, 0x70, 0x65, 0x64, 0x69, 0x61, 0x03, 0x6F, 0x72, 0x67, 0x00, 0x01, 0x01, 0x00, 0x01, 0xC0, // ipedia.org...... + 0x0C, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x23, 0x00, 0x15, 0x00, 0x05, 0x69, 0x73, 0x73, // ........#....iss + 0x75, 0x65, 0x67, 0x6C, 0x6F, 0x62, 0x61, 0x6C, 0x73, 0x69, 0x67, 0x6E, 0x2E, 0x63, 0x6F, 0x6D, // ueglobalsign.com + 0xC0, 0x0C, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x23, 0x00, 0x13, 0x00, 0x05, 0x69, 0x73, // .........#....is + 0x73, 0x75, 0x65, 0x64, 0x69, 0x67, 0x69, 0x63, 0x65, 0x72, 0x74, 0x2E, 0x63, 0x6F, 0x6D, 0xC0, // suedigicert.com. + 0x0C, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x23, 0x00, 0x16, 0x00, 0x05, 0x69, 0x73, 0x73, // ........#....iss + 0x75, 0x65, 0x6C, 0x65, 0x74, 0x73, 0x65, 0x6E, 0x63, 0x72, 0x79, 0x70, 0x74, 0x2E, 0x6F, 0x72, // ueletsencrypt.or + 0x67, 0xC0, 0x0C, 0x01, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x23, 0x00, 0x25, 0x00, 0x05, 0x69, // g.........#.%..i + 0x6F, 0x64, 0x65, 0x66, 0x6D, 0x61, 0x69, 0x6C, 0x74, 0x6F, 0x3A, 0x64, 0x6E, 0x73, 0x2D, 0x61, // odefmailto:dns-a + 0x64, 0x6D, 0x69, 0x6E, 0x40, 0x77, 0x69, 0x6B, 0x69, 0x6D, 0x65, 0x64, 0x69, 0x61, 0x2E, 0x6F, // dmin@wikimedia.o + 0x72, 0x67 // rg + }; + + struct ares_caa_reply* caa = nullptr; + EXPECT_EQ(ARES_SUCCESS, ares_parse_caa_reply(data.data(), data.size(), &caa)); + ASSERT_NE(nullptr, caa); + ASSERT_NE(nullptr, caa->next); + ASSERT_NE(nullptr, caa->next->next); + ASSERT_NE(nullptr, caa->next->next->next); + + ares_free_data(caa); +} + +TEST_F(LibraryTest, ParseCaaReplySingleOK) { + std::vector<byte> data = { + 0x27, 0x86, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x67, 0x6F, 0x6F, // '............goo + 0x67, 0x6C, 0x65, 0x03, 0x63, 0x6F, 0x6D, 0x00, 0x01, 0x01, 0x00, 0x01, 0xC0, 0x0C, 0x01, 0x01, // gle.com......... + 0x00, 0x01, 0x00, 0x01, 0x43, 0xBE, 0x00, 0x0F, 0x00, 0x05, 0x69, 0x73, 0x73, 0x75, 0x65, 0x70, // ....C.....issuep + 0x6B, 0x69, 0x2E, 0x67, 0x6F, 0x6F, 0x67 // ki.goog + }; + + struct ares_caa_reply* caa = nullptr; + EXPECT_EQ(ARES_SUCCESS, ares_parse_caa_reply(data.data(), data.size(), &caa)); + ASSERT_NE(nullptr, caa); + + EXPECT_EQ(caa->critical, 0); + EXPECT_EQ(caa->plength, 5); + EXPECT_STREQ((char *)caa->property, "issue"); + EXPECT_EQ(caa->length, 8); + EXPECT_STREQ((char *)caa->value, "pki.goog"); + + ares_free_data(caa); +} + +TEST_F(LibraryTest, ParseCaaBogusReply1) { + std::vector<byte> data = { + 0x27, 0x86, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x67, 0x6F, 0x6F, // '............goo + 0x67, 0x6C, 0x65, 0x03, 0x63, 0x6F, 0x6D, 0x00, 0x01, 0x01, 0x00, 0x01, 0xC0, 0x0C, 0x01, 0x01, // gle.com......... + 0x00, 0x01, 0x00, 0x01, 0x43, 0xBE, 0x00, 0x0F, 0x00, 0x00, 0x69, 0x73, 0x73, 0x75, 0x65, 0x70, // ....C.....issuep + 0x6B, 0x69, 0x2E, 0x67, 0x6F, 0x6F, 0x67 // ki.goog + }; + + struct ares_caa_reply* caa = nullptr; + EXPECT_EQ(ARES_EBADRESP, ares_parse_caa_reply(data.data(), data.size(), &caa)); + ASSERT_EQ(nullptr, caa); +} + +TEST_F(LibraryTest, ParseCaaBogusReply2) { + std::vector<byte> data = { + 0x27, 0x86, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x67, 0x6F, 0x6F, // '............goo + 0x67, 0x6C, 0x65, 0x03, 0x63, 0x6F, 0x6D, 0x00, 0x01, 0x01, 0x00, 0x01, 0xC0, 0x0C, 0x01, 0x01, // gle.com......... + 0x00, 0x01, 0x00, 0x01, 0x43, 0xBE, 0x00, 0x0F, 0x00, 0x0e, 0x69, 0x73, 0x73, 0x75, 0x65, 0x70, // ....C.....issuep + 0x6B, 0x69, 0x2E, 0x67, 0x6F, 0x6F, 0x67 // ki.goog + }; + + struct ares_caa_reply* caa = nullptr; + EXPECT_EQ(ARES_EBADRESP, ares_parse_caa_reply(data.data(), data.size(), &caa)); + ASSERT_EQ(nullptr, caa); +} + +TEST_F(LibraryTest, ParseCaaBogusReply3) { + std::vector<byte> data = { + 0x27, 0x86, 0x81, 0x80, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x06, 0x67, 0x6F, 0x6F, // '............goo + 0x67, 0x6C, 0x65, 0x03, 0x63, 0x6F, 0x6D, 0x00, 0x01, 0x01, 0x00, 0x01, 0xC0, 0x0C, 0x01, 0x01, // gle.com......... + 0x00, 0x01, 0x00, 0x01, 0x43, 0xBE, 0x00, 0x10, 0x00, 0x05, 0x69, 0x73, 0x73, 0x75, 0x65, 0x70, // ....C.....issuep + 0x6B, 0x69, 0x2E, 0x67, 0x6F, 0x6F, 0x67 // ki.goog + }; + + struct ares_caa_reply* caa = nullptr; + EXPECT_EQ(ARES_EBADRESP, ares_parse_caa_reply(data.data(), data.size(), &caa)); + ASSERT_EQ(nullptr, caa); +} + +TEST_F(LibraryTest, ParseCaaEmptyReply) { + std::vector<byte> data = { + 0x27, 0x86, 0x81, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x09, 0x77, 0x69, 0x6B, // '............wik + 0x69, 0x70, 0x65, 0x64, 0x69, 0x61, 0x02, 0x64, 0x65, 0x00, 0x01, 0x01, 0x00, 0x01, 0xC0, 0x0C, // ipedia.de....... + 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x02, 0x58, 0x00, 0x3B, 0x04, 0x6E, 0x73, 0x38, 0x31, 0x0D, // .......X.;.ns81. + 0x64, 0x6F, 0x6D, 0x61, 0x69, 0x6E, 0x63, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C, 0x03, 0x63, 0x6F, // domaincontrol.co + 0x6D, 0x00, 0x03, 0x64, 0x6E, 0x73, 0x05, 0x6A, 0x6F, 0x6D, 0x61, 0x78, 0x03, 0x6E, 0x65, 0x74, // m..dns.jomax.net + 0x00, 0x78, 0x67, 0xFE, 0x34, 0x00, 0x00, 0x70, 0x80, 0x00, 0x00, 0x1C, 0x20, 0x00, 0x09, 0x3A, // .xg.4..p.... ..: + 0x80, 0x00, 0x00, 0x02, 0x58 // ....X + }; + + struct ares_caa_reply* caa = nullptr; + EXPECT_EQ(ARES_ENODATA, ares_parse_caa_reply(data.data(), data.size(), &caa)); + ASSERT_EQ(nullptr, caa); +} + +} // namespace test +} // namespace ares diff --git a/contrib/libs/c-ares/test/ares-test-parse-mx.cc b/contrib/libs/c-ares/test/ares-test-parse-mx.cc index 37324a6d4c..db8fa89404 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-mx.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-mx.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseMxReplyOK) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_mx)) + .add_question(new DNSQuestion("example.com", T_MX)) .add_answer(new DNSMxRR("example.com", 100, 100, "mx1.example.com")) .add_answer(new DNSMxRR("example.com", 100, 200, "mx2.example.com")); std::vector<byte> data = pkt.data(); @@ -65,7 +65,7 @@ TEST_F(LibraryTest, ParseMxReplyMalformed) { TEST_F(LibraryTest, ParseMxReplyErrors) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_mx)) + .add_question(new DNSQuestion("example.com", T_MX)) .add_answer(new DNSMxRR("example.com", 100, 100, "mx1.example.com")); std::vector<byte> data; struct ares_mx_reply* mx = nullptr; @@ -75,25 +75,25 @@ TEST_F(LibraryTest, ParseMxReplyErrors) { data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_mx_reply(data.data(), data.size(), &mx)); EXPECT_EQ(nullptr, mx); - pkt.add_question(new DNSQuestion("example.com", ns_t_mx)); + pkt.add_question(new DNSQuestion("example.com", T_MX)); #ifdef DISABLED // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_mx)); + pkt.add_question(new DNSQuestion("Axample.com", T_MX)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_mx_reply(data.data(), data.size(), &mx)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_mx)); + pkt.add_question(new DNSQuestion("example.com", T_MX)); #endif // Two questions. - pkt.add_question(new DNSQuestion("example.com", ns_t_mx)); + pkt.add_question(new DNSQuestion("example.com", T_MX)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_mx_reply(data.data(), data.size(), &mx)); EXPECT_EQ(nullptr, mx); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_mx)); + pkt.add_question(new DNSQuestion("example.com", T_MX)); // Wrong sort of answer. // TODO(drysdale): check if this should be ARES_ENODATA? @@ -124,7 +124,7 @@ TEST_F(LibraryTest, ParseMxReplyErrors) { TEST_F(LibraryTest, ParseMxReplyAllocFail) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_mx)) + .add_question(new DNSQuestion("example.com", T_MX)) .add_answer(new DNSCnameRR("example.com", 300, "c.example.com")) .add_answer(new DNSMxRR("c.example.com", 100, 100, "mx1.example.com")); std::vector<byte> data = pkt.data(); diff --git a/contrib/libs/c-ares/test/ares-test-parse-naptr.cc b/contrib/libs/c-ares/test/ares-test-parse-naptr.cc index 3238a1923d..aa1a2a5029 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-naptr.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-naptr.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseNaptrReplyOK) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_naptr)) + .add_question(new DNSQuestion("example.com", T_NAPTR)) .add_answer(new DNSNaptrRR("example.com", 100, 10, 20, "SP", "service", "regexp", "replace")) .add_answer(new DNSNaptrRR("example.com", 0x0010, @@ -43,7 +43,7 @@ TEST_F(LibraryTest, ParseNaptrReplyOK) { TEST_F(LibraryTest, ParseNaptrReplyErrors) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_naptr)) + .add_question(new DNSQuestion("example.com", T_NAPTR)) .add_answer(new DNSNaptrRR("example.com", 100, 10, 20, "SP", "service", "regexp", "replace")); std::vector<byte> data; @@ -53,24 +53,24 @@ TEST_F(LibraryTest, ParseNaptrReplyErrors) { pkt.questions_.clear(); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_naptr_reply(data.data(), data.size(), &naptr)); - pkt.add_question(new DNSQuestion("example.com", ns_t_naptr)); + pkt.add_question(new DNSQuestion("example.com", T_NAPTR)); #ifdef DISABLED // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_naptr)); + pkt.add_question(new DNSQuestion("Axample.com", T_NAPTR)); data = pkt.data(); EXPECT_EQ(ARES_ENODATA, ares_parse_naptr_reply(data.data(), data.size(), &naptr)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_naptr)); + pkt.add_question(new DNSQuestion("example.com", T_NAPTR)); #endif // Two questions - pkt.add_question(new DNSQuestion("example.com", ns_t_naptr)); + pkt.add_question(new DNSQuestion("example.com", T_NAPTR)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_naptr_reply(data.data(), data.size(), &naptr)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_naptr)); + pkt.add_question(new DNSQuestion("example.com", T_NAPTR)); // Wrong sort of answer. pkt.answers_.clear(); @@ -129,7 +129,7 @@ TEST_F(LibraryTest, ParseNaptrReplyTooShort) { TEST_F(LibraryTest, ParseNaptrReplyAllocFail) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_naptr)) + .add_question(new DNSQuestion("example.com", T_NAPTR)) .add_answer(new DNSNaptrRR("example.com", 100, 10, 20, "SP", "service", "regexp", "replace")) .add_answer(new DNSNaptrRR("example.com", 0x0010, diff --git a/contrib/libs/c-ares/test/ares-test-parse-ns.cc b/contrib/libs/c-ares/test/ares-test-parse-ns.cc index cd65318969..316492174c 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-ns.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-ns.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseNsReplyOK) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_ns)) + .add_question(new DNSQuestion("example.com", T_NS)) .add_answer(new DNSNsRR("example.com", 100, "ns.example.com")); std::vector<byte> data = pkt.data(); @@ -26,7 +26,7 @@ TEST_F(LibraryTest, ParseNsReplyOK) { TEST_F(LibraryTest, ParseNsReplyMultiple) { DNSPacket pkt; pkt.set_qid(10501).set_response().set_rd().set_ra() - .add_question(new DNSQuestion("google.com", ns_t_ns)) + .add_question(new DNSQuestion("google.com", T_NS)) .add_answer(new DNSNsRR("google.com", 59, "ns1.google.com")) .add_answer(new DNSNsRR("google.com", 59, "ns2.google.com")) .add_answer(new DNSNsRR("google.com", 59, "ns3.google.com")) @@ -49,7 +49,7 @@ TEST_F(LibraryTest, ParseNsReplyMultiple) { TEST_F(LibraryTest, ParseNsReplyErrors) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_ns)) + .add_question(new DNSQuestion("example.com", T_NS)) .add_answer(new DNSNsRR("example.com", 100, "ns.example.com")); std::vector<byte> data; struct hostent *host = nullptr; @@ -58,24 +58,24 @@ TEST_F(LibraryTest, ParseNsReplyErrors) { pkt.questions_.clear(); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_ns_reply(data.data(), data.size(), &host)); - pkt.add_question(new DNSQuestion("example.com", ns_t_ns)); + pkt.add_question(new DNSQuestion("example.com", T_NS)); #ifdef DISABLED // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_ns)); + pkt.add_question(new DNSQuestion("Axample.com", T_NS)); data = pkt.data(); EXPECT_EQ(ARES_ENODATA, ares_parse_ns_reply(data.data(), data.size(), &host)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_ns)); + pkt.add_question(new DNSQuestion("example.com", T_NS)); #endif // Two questions. - pkt.add_question(new DNSQuestion("example.com", ns_t_ns)); + pkt.add_question(new DNSQuestion("example.com", T_NS)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_ns_reply(data.data(), data.size(), &host)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_ns)); + pkt.add_question(new DNSQuestion("example.com", T_NS)); // Wrong sort of answer. pkt.answers_.clear(); @@ -101,7 +101,7 @@ TEST_F(LibraryTest, ParseNsReplyErrors) { TEST_F(LibraryTest, ParseNsReplyAllocFail) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_ns)) + .add_question(new DNSQuestion("example.com", T_NS)) .add_answer(new DNSCnameRR("example.com", 300, "c.example.com")) .add_answer(new DNSNsRR("c.example.com", 100, "ns.example.com")); std::vector<byte> data = pkt.data(); diff --git a/contrib/libs/c-ares/test/ares-test-parse-ptr.cc b/contrib/libs/c-ares/test/ares-test-parse-ptr.cc index 75f74c16f7..e8fcac3224 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-ptr.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-ptr.cc @@ -11,7 +11,7 @@ TEST_F(LibraryTest, ParsePtrReplyOK) { byte addrv4[4] = {0x10, 0x20, 0x30, 0x40}; DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)) + .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "other.com")); std::vector<byte> data = pkt.data(); @@ -29,7 +29,7 @@ TEST_F(LibraryTest, ParsePtrReplyCname) { byte addrv4[4] = {0x10, 0x20, 0x30, 0x40}; DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)) + .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)) .add_answer(new DNSCnameRR("64.48.32.16.in-addr.arpa", 50, "64.48.32.8.in-addr.arpa")) .add_answer(new DNSPtrRR("64.48.32.8.in-addr.arpa", 100, "other.com")); std::vector<byte> data = pkt.data(); @@ -63,7 +63,7 @@ TEST_F(LibraryTest, ParsePtrReplyMalformedCname) { byte addrv4[4] = {0x10, 0x20, 0x30, 0x40}; DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)) + .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)) .add_answer(new DNSMalformedCnameRR("64.48.32.16.in-addr.arpa", 50, "64.48.32.8.in-addr.arpa")) .add_answer(new DNSPtrRR("64.48.32.8.in-addr.arpa", 100, "other.com")); std::vector<byte> data = pkt.data(); @@ -78,7 +78,7 @@ TEST_F(LibraryTest, ParseManyPtrReply) { byte addrv4[4] = {0x10, 0x20, 0x30, 0x40}; DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)) + .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "main.com")) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "other1.com")) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "other2.com")) @@ -102,7 +102,7 @@ TEST_F(LibraryTest, ParsePtrReplyAdditional) { byte addrv4[4] = {0x10, 0x20, 0x30, 0x40}; DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)) + .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 55, "other.com")) .add_auth(new DNSNsRR("16.in-addr.arpa", 234, "ns1.other.com")) .add_auth(new DNSNsRR("16.in-addr.arpa", 234, "bb.ns2.other.com")) @@ -126,7 +126,7 @@ TEST_F(LibraryTest, ParsePtrReplyErrors) { byte addrv4[4] = {0x10, 0x20, 0x30, 0x40}; DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)) + .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "other.com")); std::vector<byte> data; struct hostent *host = nullptr; @@ -136,26 +136,26 @@ TEST_F(LibraryTest, ParsePtrReplyErrors) { data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_ptr_reply(data.data(), data.size(), addrv4, sizeof(addrv4), AF_INET, &host, NULL)); - pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)); + pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)); // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("99.48.32.16.in-addr.arpa", ns_t_ptr)); + pkt.add_question(new DNSQuestion("99.48.32.16.in-addr.arpa", T_PTR)); data = pkt.data(); EXPECT_EQ(ARES_ENODATA, ares_parse_ptr_reply(data.data(), data.size(), addrv4, sizeof(addrv4), AF_INET, &host, NULL)); EXPECT_EQ(nullptr, host); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)); + pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)); // Two questions. - pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)); + pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_ptr_reply(data.data(), data.size(), addrv4, sizeof(addrv4), AF_INET, &host, NULL)); EXPECT_EQ(nullptr, host); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)); + pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)); // Wrong sort of answer. pkt.answers_.clear(); @@ -197,7 +197,7 @@ TEST_F(LibraryTest, ParsePtrReplyAllocFailSome) { byte addrv4[4] = {0x10, 0x20, 0x30, 0x40}; DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)) + .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "main.com")) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "other1.com")) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "other2.com")) @@ -217,7 +217,7 @@ TEST_F(LibraryTest, ParsePtrReplyAllocFailMany) { byte addrv4[4] = {0x10, 0x20, 0x30, 0x40}; DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)) + .add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "main.com")) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "other1.com")) .add_answer(new DNSPtrRR("64.48.32.16.in-addr.arpa", 100, "other2.com")) diff --git a/contrib/libs/c-ares/test/ares-test-parse-soa-any.cc b/contrib/libs/c-ares/test/ares-test-parse-soa-any.cc index 804c6a0060..700073c5c8 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-soa-any.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-soa-any.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseSoaAnyReplyOK) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_any))\ + .add_question(new DNSQuestion("example.com", T_ANY))\ .add_answer(new DNSARR("example.com", 0x01020304, {2,3,4,5})) .add_answer(new DNSMxRR("example.com", 100, 100, "mx1.example.com")) .add_answer(new DNSMxRR("example.com", 100, 200, "mx2.example.com")) @@ -35,7 +35,7 @@ TEST_F(LibraryTest, ParseSoaAnyReplyOK) { TEST_F(LibraryTest, ParseSoaAnyReplyErrors) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_any)) + .add_question(new DNSQuestion("example.com", T_ANY)) .add_answer(new DNSSoaRR("example.com", 100, "soa1.example.com", "fred.example.com", 1, 2, 3, 4, 5)); @@ -46,24 +46,24 @@ TEST_F(LibraryTest, ParseSoaAnyReplyErrors) { pkt.questions_.clear(); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_soa_reply(data.data(), data.size(), &soa)); - pkt.add_question(new DNSQuestion("example.com", ns_t_any)); + pkt.add_question(new DNSQuestion("example.com", T_ANY)); #ifdef DISABLED // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_any)); + pkt.add_question(new DNSQuestion("Axample.com", T_ANY)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_soa_reply(data.data(), data.size(), &soa)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_any)); + pkt.add_question(new DNSQuestion("example.com", T_ANY)); #endif // Two questions - pkt.add_question(new DNSQuestion("example.com", ns_t_any)); + pkt.add_question(new DNSQuestion("example.com", T_ANY)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_soa_reply(data.data(), data.size(), &soa)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_any)); + pkt.add_question(new DNSQuestion("example.com", T_ANY)); // Wrong sort of answer. pkt.answers_.clear(); @@ -93,7 +93,7 @@ TEST_F(LibraryTest, ParseSoaAnyReplyErrors) { TEST_F(LibraryTest, ParseSoaAnyReplyAllocFail) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_any)) + .add_question(new DNSQuestion("example.com", T_ANY)) .add_answer(new DNSSoaRR("example.com", 100, "soa1.example.com", "fred.example.com", 1, 2, 3, 4, 5)); diff --git a/contrib/libs/c-ares/test/ares-test-parse-soa.cc b/contrib/libs/c-ares/test/ares-test-parse-soa.cc index c0ffaaed50..22a78e5f46 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-soa.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-soa.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseSoaReplyOK) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_soa)) + .add_question(new DNSQuestion("example.com", T_SOA)) .add_answer(new DNSSoaRR("example.com", 100, "soa1.example.com", "fred.example.com", 1, 2, 3, 4, 5)); @@ -32,7 +32,7 @@ TEST_F(LibraryTest, ParseSoaReplyOK) { TEST_F(LibraryTest, ParseSoaReplyErrors) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_soa)) + .add_question(new DNSQuestion("example.com", T_SOA)) .add_answer(new DNSSoaRR("example.com", 100, "soa1.example.com", "fred.example.com", 1, 2, 3, 4, 5)); @@ -43,24 +43,24 @@ TEST_F(LibraryTest, ParseSoaReplyErrors) { pkt.questions_.clear(); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_soa_reply(data.data(), data.size(), &soa)); - pkt.add_question(new DNSQuestion("example.com", ns_t_soa)); + pkt.add_question(new DNSQuestion("example.com", T_SOA)); #ifdef DISABLED // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_soa)); + pkt.add_question(new DNSQuestion("Axample.com", T_SOA)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_soa_reply(data.data(), data.size(), &soa)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_soa)); + pkt.add_question(new DNSQuestion("example.com", T_SOA)); #endif // Two questions - pkt.add_question(new DNSQuestion("example.com", ns_t_soa)); + pkt.add_question(new DNSQuestion("example.com", T_SOA)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_soa_reply(data.data(), data.size(), &soa)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_soa)); + pkt.add_question(new DNSQuestion("example.com", T_SOA)); // Wrong sort of answer. pkt.answers_.clear(); @@ -90,7 +90,7 @@ TEST_F(LibraryTest, ParseSoaReplyErrors) { TEST_F(LibraryTest, ParseSoaReplyAllocFail) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_soa)) + .add_question(new DNSQuestion("example.com", T_SOA)) .add_answer(new DNSSoaRR("example.com", 100, "soa1.example.com", "fred.example.com", 1, 2, 3, 4, 5)); diff --git a/contrib/libs/c-ares/test/ares-test-parse-srv.cc b/contrib/libs/c-ares/test/ares-test-parse-srv.cc index cc651d6d4e..b004759801 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-srv.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-srv.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseSrvReplyOK) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_srv)) + .add_question(new DNSQuestion("example.com", T_SRV)) .add_answer(new DNSSrvRR("example.com", 100, 10, 20, 30, "srv.example.com")) .add_answer(new DNSSrvRR("example.com", 100, 11, 21, 31, "srv2.example.com")); std::vector<byte> data = pkt.data(); @@ -38,7 +38,7 @@ TEST_F(LibraryTest, ParseSrvReplyOK) { TEST_F(LibraryTest, ParseSrvReplySingle) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.abc.def.com", ns_t_srv)) + .add_question(new DNSQuestion("example.abc.def.com", T_SRV)) .add_answer(new DNSSrvRR("example.abc.def.com", 180, 0, 10, 8160, "example.abc.def.com")) .add_auth(new DNSNsRR("abc.def.com", 44, "else1.where.com")) .add_auth(new DNSNsRR("abc.def.com", 44, "else2.where.com")) @@ -96,7 +96,7 @@ TEST_F(LibraryTest, ParseSrvReplyMalformed) { TEST_F(LibraryTest, ParseSrvReplyMultiple) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_ra().set_rd() - .add_question(new DNSQuestion("srv.example.com", ns_t_srv)) + .add_question(new DNSQuestion("srv.example.com", T_SRV)) .add_answer(new DNSSrvRR("srv.example.com", 300, 0, 5, 6789, "a1.srv.example.com")) .add_answer(new DNSSrvRR("srv.example.com", 300, 0, 5, 4567, "a2.srv.example.com")) .add_answer(new DNSSrvRR("srv.example.com", 300, 0, 5, 5678, "a3.srv.example.com")) @@ -142,7 +142,7 @@ TEST_F(LibraryTest, ParseSrvReplyMultiple) { TEST_F(LibraryTest, ParseSrvReplyCname) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.abc.def.com", ns_t_srv)) + .add_question(new DNSQuestion("example.abc.def.com", T_SRV)) .add_answer(new DNSCnameRR("example.abc.def.com", 300, "cname.abc.def.com")) .add_answer(new DNSSrvRR("cname.abc.def.com", 300, 0, 10, 1234, "srv.abc.def.com")) .add_auth(new DNSNsRR("abc.def.com", 44, "else1.where.com")) @@ -170,7 +170,7 @@ TEST_F(LibraryTest, ParseSrvReplyCname) { TEST_F(LibraryTest, ParseSrvReplyCnameMultiple) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_ra().set_rd() - .add_question(new DNSQuestion("query.example.com", ns_t_srv)) + .add_question(new DNSQuestion("query.example.com", T_SRV)) .add_answer(new DNSCnameRR("query.example.com", 300, "srv.example.com")) .add_answer(new DNSSrvRR("srv.example.com", 300, 0, 5, 6789, "a1.srv.example.com")) .add_answer(new DNSSrvRR("srv.example.com", 300, 0, 5, 4567, "a2.srv.example.com")) @@ -217,7 +217,7 @@ TEST_F(LibraryTest, ParseSrvReplyCnameMultiple) { TEST_F(LibraryTest, ParseSrvReplyErrors) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.abc.def.com", ns_t_srv)) + .add_question(new DNSQuestion("example.abc.def.com", T_SRV)) .add_answer(new DNSSrvRR("example.abc.def.com", 180, 0, 10, 8160, "example.abc.def.com")); std::vector<byte> data; struct ares_srv_reply* srv = nullptr; @@ -226,24 +226,24 @@ TEST_F(LibraryTest, ParseSrvReplyErrors) { pkt.questions_.clear(); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_srv_reply(data.data(), data.size(), &srv)); - pkt.add_question(new DNSQuestion("example.abc.def.com", ns_t_srv)); + pkt.add_question(new DNSQuestion("example.abc.def.com", T_SRV)); #ifdef DISABLED // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_srv)); + pkt.add_question(new DNSQuestion("Axample.com", T_SRV)); data = pkt.data(); EXPECT_EQ(ARES_ENODATA, ares_parse_srv_reply(data.data(), data.size(), &srv)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_srv)); + pkt.add_question(new DNSQuestion("example.com", T_SRV)); #endif // Two questions. - pkt.add_question(new DNSQuestion("example.abc.def.com", ns_t_srv)); + pkt.add_question(new DNSQuestion("example.abc.def.com", T_SRV)); data = pkt.data(); EXPECT_EQ(ARES_EBADRESP, ares_parse_srv_reply(data.data(), data.size(), &srv)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", ns_t_ptr)); + pkt.add_question(new DNSQuestion("64.48.32.16.in-addr.arpa", T_PTR)); // Wrong sort of answer. pkt.answers_.clear(); @@ -271,7 +271,7 @@ TEST_F(LibraryTest, ParseSrvReplyErrors) { TEST_F(LibraryTest, ParseSrvReplyAllocFail) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.abc.def.com", ns_t_srv)) + .add_question(new DNSQuestion("example.abc.def.com", T_SRV)) .add_answer(new DNSCnameRR("example.com", 300, "c.example.com")) .add_answer(new DNSSrvRR("example.abc.def.com", 180, 0, 10, 8160, "example.abc.def.com")); std::vector<byte> data = pkt.data(); diff --git a/contrib/libs/c-ares/test/ares-test-parse-txt.cc b/contrib/libs/c-ares/test/ares-test-parse-txt.cc index 8aaaaa3b47..b33fb2de0c 100644 --- a/contrib/libs/c-ares/test/ares-test-parse-txt.cc +++ b/contrib/libs/c-ares/test/ares-test-parse-txt.cc @@ -13,7 +13,7 @@ TEST_F(LibraryTest, ParseTxtReplyOK) { std::string expected2a = "txt2a"; std::string expected2b("ABC\0ABC", 7); pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_mx)) + .add_question(new DNSQuestion("example.com", T_MX)) .add_answer(new DNSTxtRR("example.com", 100, {expected1})) .add_answer(new DNSTxtRR("example.com", 100, {expected2a, expected2b})); std::vector<byte> data = pkt.data(); @@ -44,7 +44,7 @@ TEST_F(LibraryTest, ParseTxtExtReplyOK) { std::string expected2a = "txt2a"; std::string expected2b("ABC\0ABC", 7); pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_mx)) + .add_question(new DNSQuestion("example.com", T_MX)) .add_answer(new DNSTxtRR("example.com", 100, {expected1})) .add_answer(new DNSTxtRR("example.com", 100, {expected2a, expected2b})); std::vector<byte> data = pkt.data(); @@ -190,7 +190,7 @@ TEST_F(LibraryTest, ParseTxtReplyErrors) { std::string expected2a = "txt2a"; std::string expected2b = "txt2b"; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_mx)) + .add_question(new DNSQuestion("example.com", T_MX)) .add_answer(new DNSTxtRR("example.com", 100, {expected1})) .add_answer(new DNSTxtRR("example.com", 100, {expected1})) .add_answer(new DNSTxtRR("example.com", 100, {expected2a, expected2b})); @@ -203,26 +203,26 @@ TEST_F(LibraryTest, ParseTxtReplyErrors) { txt = nullptr; EXPECT_EQ(ARES_EBADRESP, ares_parse_txt_reply(data.data(), data.size(), &txt)); EXPECT_EQ(nullptr, txt); - pkt.add_question(new DNSQuestion("example.com", ns_t_mx)); + pkt.add_question(new DNSQuestion("example.com", T_MX)); #ifdef DISABLED // Question != answer pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("Axample.com", ns_t_txt)); + pkt.add_question(new DNSQuestion("Axample.com", T_TXT)); data = pkt.data(); EXPECT_EQ(ARES_ENODATA, ares_parse_txt_reply(data.data(), data.size(), &txt)); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_txt)); + pkt.add_question(new DNSQuestion("example.com", T_TXT)); #endif // Two questions. - pkt.add_question(new DNSQuestion("example.com", ns_t_mx)); + pkt.add_question(new DNSQuestion("example.com", T_MX)); data = pkt.data(); txt = nullptr; EXPECT_EQ(ARES_EBADRESP, ares_parse_txt_reply(data.data(), data.size(), &txt)); EXPECT_EQ(nullptr, txt); pkt.questions_.clear(); - pkt.add_question(new DNSQuestion("example.com", ns_t_mx)); + pkt.add_question(new DNSQuestion("example.com", T_MX)); // No answer. pkt.answers_.clear(); @@ -246,7 +246,7 @@ TEST_F(LibraryTest, ParseTxtReplyAllocFail) { std::string expected2a = "txt2a"; std::string expected2b = "txt2b"; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_mx)) + .add_question(new DNSQuestion("example.com", T_MX)) .add_answer(new DNSCnameRR("example.com", 300, "c.example.com")) .add_answer(new DNSTxtRR("c.example.com", 100, {expected1})) .add_answer(new DNSTxtRR("c.example.com", 100, {expected1})) diff --git a/contrib/libs/c-ares/test/ares-test-parse.cc b/contrib/libs/c-ares/test/ares-test-parse.cc index 4c54fc9902..87ab0bd25f 100644 --- a/contrib/libs/c-ares/test/ares-test-parse.cc +++ b/contrib/libs/c-ares/test/ares-test-parse.cc @@ -10,7 +10,7 @@ namespace test { TEST_F(LibraryTest, ParseRootName) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion(".", ns_t_a)) + .add_question(new DNSQuestion(".", T_A)) .add_answer(new DNSARR(".", 100, {0x02, 0x03, 0x04, 0x05})); std::vector<byte> data = pkt.data(); @@ -60,6 +60,8 @@ TEST_F(LibraryTest, ParseIndirectRootName) { ares_free_hostent(host); } + +#if 0 /* We are validating hostnames now, its not clear how this would ever be valid */ TEST_F(LibraryTest, ParseEscapedName) { std::vector<byte> data = { 0x12, 0x34, // qid @@ -105,6 +107,7 @@ TEST_F(LibraryTest, ParseEscapedName) { EXPECT_EQ('c', hent.name_[6]); ares_free_hostent(host); } +#endif TEST_F(LibraryTest, ParsePartialCompressedName) { std::vector<byte> data = { diff --git a/contrib/libs/c-ares/test/ares-test.cc b/contrib/libs/c-ares/test/ares-test.cc index ec4b460549..0c0e6bc5d0 100644 --- a/contrib/libs/c-ares/test/ares-test.cc +++ b/contrib/libs/c-ares/test/ares-test.cc @@ -1,9 +1,11 @@ +#include "ares_setup.h" +#include "ares.h" +#include "ares_nameser.h" #include "ares-test.h" #include "ares-test-ai.h" #include "dns-proto.h" // Include ares internal files for DNS protocol details -#include "nameser.h" #include "ares_dns.h" #ifdef HAVE_NETDB_H @@ -30,7 +32,8 @@ namespace ares { namespace test { bool verbose = false; -int mock_port = 5300; +static constexpr int dynamic_port = 0; +int mock_port = dynamic_port; const std::vector<int> both_families = {AF_INET, AF_INET6}; const std::vector<int> ipv4_family = {AF_INET}; @@ -134,7 +137,7 @@ bool LibraryTest::ShouldAllocFail(size_t size) { // static void* LibraryTest::amalloc(size_t size) { - if (ShouldAllocFail(size)) { + if (ShouldAllocFail(size) || size == 0) { if (verbose) std::cerr << "Failing malloc(" << size << ") request" << std::endl; return nullptr; } else { @@ -169,8 +172,8 @@ void DefaultChannelModeTest::Process() { ProcessWork(channel_, NoExtraFDs, nullptr); } -MockServer::MockServer(int family, int port, int tcpport) - : udpport_(port), tcpport_(tcpport ? tcpport : udpport_), qid_(-1) { +MockServer::MockServer(int family, int port) + : udpport_(port), tcpport_(port), qid_(-1) { // Create a TCP socket to receive data on. tcpfd_ = socket(family, SOCK_STREAM, 0); EXPECT_NE(-1, tcpfd_); @@ -197,6 +200,21 @@ MockServer::MockServer(int family, int port, int tcpport) addr.sin_port = htons(udpport_); int udprc = bind(udpfd_, (struct sockaddr*)&addr, sizeof(addr)); EXPECT_EQ(0, udprc) << "Failed to bind AF_INET to UDP port " << udpport_; + // retrieve system-assigned port + if (udpport_ == dynamic_port) { + ares_socklen_t len = sizeof(addr); + auto result = getsockname(udpfd_, (struct sockaddr*)&addr, &len); + EXPECT_EQ(0, result); + udpport_ = ntohs(addr.sin_port); + EXPECT_NE(dynamic_port, udpport_); + } + if (tcpport_ == dynamic_port) { + ares_socklen_t len = sizeof(addr); + auto result = getsockname(tcpfd_, (struct sockaddr*)&addr, &len); + EXPECT_EQ(0, result); + tcpport_ = ntohs(addr.sin_port); + EXPECT_NE(dynamic_port, tcpport_); + } } else { EXPECT_EQ(AF_INET6, family); struct sockaddr_in6 addr; @@ -209,6 +227,21 @@ MockServer::MockServer(int family, int port, int tcpport) addr.sin6_port = htons(udpport_); int udprc = bind(udpfd_, (struct sockaddr*)&addr, sizeof(addr)); EXPECT_EQ(0, udprc) << "Failed to bind AF_INET6 to UDP port " << udpport_; + // retrieve system-assigned port + if (udpport_ == dynamic_port) { + ares_socklen_t len = sizeof(addr); + auto result = getsockname(udpfd_, (struct sockaddr*)&addr, &len); + EXPECT_EQ(0, result); + udpport_ = ntohs(addr.sin6_port); + EXPECT_NE(dynamic_port, udpport_); + } + if (tcpport_ == dynamic_port) { + ares_socklen_t len = sizeof(addr); + auto result = getsockname(tcpfd_, (struct sockaddr*)&addr, &len); + EXPECT_EQ(0, result); + tcpport_ = ntohs(addr.sin6_port); + EXPECT_NE(dynamic_port, tcpport_); + } } if (verbose) std::cerr << "Configured " << (family == AF_INET ? "IPv4" : "IPv6") @@ -281,7 +314,7 @@ void MockServer::ProcessFD(int fd) { std::cerr << "Not a request" << std::endl; return; } - if (DNS_HEADER_OPCODE(data) != ns_o_query) { + if (DNS_HEADER_OPCODE(data) != O_QUERY) { std::cerr << "Not a query (opcode " << DNS_HEADER_OPCODE(data) << ")" << std::endl; return; @@ -311,7 +344,7 @@ void MockServer::ProcessFD(int fd) { << " bytes after name)" << std::endl; return; } - if (DNS_QUESTION_CLASS(question) != ns_c_in) { + if (DNS_QUESTION_CLASS(question) != C_IN) { std::cerr << "Unexpected question class (" << DNS_QUESTION_CLASS(question) << ")" << std::endl; return; @@ -381,7 +414,8 @@ MockChannelOptsTest::NiceMockServers MockChannelOptsTest::BuildServers(int count NiceMockServers servers; assert(count > 0); for (int ii = 0; ii < count; ii++) { - std::unique_ptr<NiceMockServer> server(new NiceMockServer(family, base_port + ii)); + int port = base_port == dynamic_port ? dynamic_port : base_port + ii; + std::unique_ptr<NiceMockServer> server(new NiceMockServer(family, port)); servers.push_back(std::move(server)); } return servers; @@ -403,9 +437,9 @@ MockChannelOptsTest::MockChannelOptsTest(int count, } // Point the library at the first mock server by default (overridden below). - opts.udp_port = mock_port; + opts.udp_port = server_.udpport(); optmask |= ARES_OPT_UDP_PORT; - opts.tcp_port = mock_port; + opts.tcp_port = server_.tcpport(); optmask |= ARES_OPT_TCP_PORT; // If not already overridden, set short-ish timeouts. diff --git a/contrib/libs/c-ares/test/ares-test.h b/contrib/libs/c-ares/test/ares-test.h index fd3bc31c27..06e9759948 100644 --- a/contrib/libs/c-ares/test/ares-test.h +++ b/contrib/libs/c-ares/test/ares-test.h @@ -2,13 +2,13 @@ #ifndef ARES_TEST_H #define ARES_TEST_H -#include "dns-proto.h" -// Include ares internal file for DNS protocol constants -#include "nameser.h" - #include "ares_setup.h" #include "ares.h" +#include "dns-proto.h" +// Include ares internal file for DNS protocol constants +#include "ares_nameser.h" + #include "gtest/gtest.h" #include "gmock/gmock.h" @@ -133,7 +133,7 @@ class DefaultChannelModeTest // Mock DNS server to allow responses to be scripted by tests. class MockServer { public: - MockServer(int family, int port, int tcpport = 0); + MockServer(int family, int port); ~MockServer(); // Mock method indicating the processing of a particular <name, RRtype> diff --git a/contrib/libs/c-ares/test/dns-proto-test.cc b/contrib/libs/c-ares/test/dns-proto-test.cc index 0c36a0c922..3dadeeee1c 100644 --- a/contrib/libs/c-ares/test/dns-proto-test.cc +++ b/contrib/libs/c-ares/test/dns-proto-test.cc @@ -9,8 +9,8 @@ namespace test { TEST(DNSProto, EncodeQuestions) { DNSPacket pkt; pkt.set_qid(0x1234).set_response().set_aa() - .add_question(new DNSQuestion("example.com.", ns_t_a)) - .add_question(new DNSQuestion("www.example.com", ns_t_aaaa, ns_c_chaos)); + .add_question(new DNSQuestion("example.com.", T_A)) + .add_question(new DNSQuestion("www.example.com", T_AAAA, C_CHAOS)); std::vector<byte> data = { 0x12, 0x34, // qid @@ -42,7 +42,7 @@ TEST(DNSProto, EncodeSingleNameAnswers) { pkt.qid_ = 0x1234; pkt.response_ = true; pkt.aa_ = true; - pkt.opcode_ = ns_o_query; + pkt.opcode_ = O_QUERY; pkt.add_answer(new DNSCnameRR("example.com", 0x01020304, "other.com.")); pkt.add_auth(new DNSPtrRR("www.example.com", 0x01020304, "www.other.com")); @@ -87,7 +87,7 @@ TEST(DNSProto, EncodeAddressAnswers) { pkt.qid_ = 0x1234; pkt.response_ = true; pkt.aa_ = true; - pkt.opcode_ = ns_o_query; + pkt.opcode_ = O_QUERY; std::vector<byte> addrv4 = {0x02, 0x03, 0x04, 0x05}; pkt.add_answer(new DNSARR("example.com", 0x01020304, addrv4)); byte addrv6[16] = {0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, diff --git a/contrib/libs/c-ares/test/dns-proto.cc b/contrib/libs/c-ares/test/dns-proto.cc index d2fa8b15be..63cf374338 100644 --- a/contrib/libs/c-ares/test/dns-proto.cc +++ b/contrib/libs/c-ares/test/dns-proto.cc @@ -1,9 +1,9 @@ -#include "dns-proto.h" // Include ares internal file for DNS protocol details #include "ares_setup.h" #include "ares.h" #include "ares_dns.h" +#include "dns-proto.h" #include <stdio.h> #include <stdlib.h> @@ -63,93 +63,93 @@ std::string StatusToString(int status) { std::string RcodeToString(int rcode) { switch (rcode) { - case ns_r_noerror: return "NOERROR"; - case ns_r_formerr: return "FORMERR"; - case ns_r_servfail: return "SERVFAIL"; - case ns_r_nxdomain: return "NXDOMAIN"; - case ns_r_notimpl: return "NOTIMPL"; - case ns_r_refused: return "REFUSED"; - case ns_r_yxdomain: return "YXDOMAIN"; - case ns_r_yxrrset: return "YXRRSET"; - case ns_r_nxrrset: return "NXRRSET"; - case ns_r_notauth: return "NOTAUTH"; - case ns_r_notzone: return "NOTZONE"; - case ns_r_badsig: return "BADSIG"; - case ns_r_badkey: return "BADKEY"; - case ns_r_badtime: return "BADTIME"; + case NOERROR: return "NOERROR"; + case FORMERR: return "FORMERR"; + case SERVFAIL: return "SERVFAIL"; + case NXDOMAIN: return "NXDOMAIN"; + case NOTIMP: return "NOTIMP"; + case REFUSED: return "REFUSED"; + case YXDOMAIN: return "YXDOMAIN"; + case YXRRSET: return "YXRRSET"; + case NXRRSET: return "NXRRSET"; + case NOTAUTH: return "NOTAUTH"; + case NOTZONE: return "NOTZONE"; + case TSIG_BADSIG: return "BADSIG"; + case TSIG_BADKEY: return "BADKEY"; + case TSIG_BADTIME: return "BADTIME"; default: return "UNKNOWN"; } } std::string RRTypeToString(int rrtype) { switch (rrtype) { - case ns_t_a: return "A"; - case ns_t_ns: return "NS"; - case ns_t_md: return "MD"; - case ns_t_mf: return "MF"; - case ns_t_cname: return "CNAME"; - case ns_t_soa: return "SOA"; - case ns_t_mb: return "MB"; - case ns_t_mg: return "MG"; - case ns_t_mr: return "MR"; - case ns_t_null: return "NULL"; - case ns_t_wks: return "WKS"; - case ns_t_ptr: return "PTR"; - case ns_t_hinfo: return "HINFO"; - case ns_t_minfo: return "MINFO"; - case ns_t_mx: return "MX"; - case ns_t_txt: return "TXT"; - case ns_t_rp: return "RP"; - case ns_t_afsdb: return "AFSDB"; - case ns_t_x25: return "X25"; - case ns_t_isdn: return "ISDN"; - case ns_t_rt: return "RT"; - case ns_t_nsap: return "NSAP"; - case ns_t_nsap_ptr: return "NSAP_PTR"; - case ns_t_sig: return "SIG"; - case ns_t_key: return "KEY"; - case ns_t_px: return "PX"; - case ns_t_gpos: return "GPOS"; - case ns_t_aaaa: return "AAAA"; - case ns_t_loc: return "LOC"; - case ns_t_nxt: return "NXT"; - case ns_t_eid: return "EID"; - case ns_t_nimloc: return "NIMLOC"; - case ns_t_srv: return "SRV"; - case ns_t_atma: return "ATMA"; - case ns_t_naptr: return "NAPTR"; - case ns_t_kx: return "KX"; - case ns_t_cert: return "CERT"; - case ns_t_a6: return "A6"; - case ns_t_dname: return "DNAME"; - case ns_t_sink: return "SINK"; - case ns_t_opt: return "OPT"; - case ns_t_apl: return "APL"; - case ns_t_ds: return "DS"; - case ns_t_sshfp: return "SSHFP"; - case ns_t_rrsig: return "RRSIG"; - case ns_t_nsec: return "NSEC"; - case ns_t_dnskey: return "DNSKEY"; - case ns_t_tkey: return "TKEY"; - case ns_t_tsig: return "TSIG"; - case ns_t_ixfr: return "IXFR"; - case ns_t_axfr: return "AXFR"; - case ns_t_mailb: return "MAILB"; - case ns_t_maila: return "MAILA"; - case ns_t_any: return "ANY"; - case ns_t_zxfr: return "ZXFR"; - case ns_t_max: return "MAX"; + case T_A: return "A"; + case T_NS: return "NS"; + case T_MD: return "MD"; + case T_MF: return "MF"; + case T_CNAME: return "CNAME"; + case T_SOA: return "SOA"; + case T_MB: return "MB"; + case T_MG: return "MG"; + case T_MR: return "MR"; + case T_NULL: return "NULL"; + case T_WKS: return "WKS"; + case T_PTR: return "PTR"; + case T_HINFO: return "HINFO"; + case T_MINFO: return "MINFO"; + case T_MX: return "MX"; + case T_TXT: return "TXT"; + case T_RP: return "RP"; + case T_AFSDB: return "AFSDB"; + case T_X25: return "X25"; + case T_ISDN: return "ISDN"; + case T_RT: return "RT"; + case T_NSAP: return "NSAP"; + case T_NSAP_PTR: return "NSAP_PTR"; + case T_SIG: return "SIG"; + case T_KEY: return "KEY"; + case T_PX: return "PX"; + case T_GPOS: return "GPOS"; + case T_AAAA: return "AAAA"; + case T_LOC: return "LOC"; + case T_NXT: return "NXT"; + case T_EID: return "EID"; + case T_NIMLOC: return "NIMLOC"; + case T_SRV: return "SRV"; + case T_ATMA: return "ATMA"; + case T_NAPTR: return "NAPTR"; + case T_KX: return "KX"; + case T_CERT: return "CERT"; + case T_A6: return "A6"; + case T_DNAME: return "DNAME"; + case T_SINK: return "SINK"; + case T_OPT: return "OPT"; + case T_APL: return "APL"; + case T_DS: return "DS"; + case T_SSHFP: return "SSHFP"; + case T_RRSIG: return "RRSIG"; + case T_NSEC: return "NSEC"; + case T_DNSKEY: return "DNSKEY"; + case T_TKEY: return "TKEY"; + case T_TSIG: return "TSIG"; + case T_IXFR: return "IXFR"; + case T_AXFR: return "AXFR"; + case T_MAILB: return "MAILB"; + case T_MAILA: return "MAILA"; + case T_ANY: return "ANY"; + case T_ZXFR: return "ZXFR"; + case T_MAX: return "MAX"; default: return "UNKNOWN"; } } std::string ClassToString(int qclass) { switch (qclass) { - case ns_c_in: return "IN"; - case ns_c_chaos: return "CHAOS"; - case ns_c_hs: return "HESIOD"; - case ns_c_none: return "NONE"; - case ns_c_any: return "ANY"; + case C_IN: return "IN"; + case C_CHAOS: return "CHAOS"; + case C_HS: return "HESIOD"; + case C_NONE: return "NONE"; + case C_ANY: return "ANY"; default: return "UNKNOWN"; } } @@ -188,11 +188,11 @@ std::string PacketToString(const std::vector<byte>& packet) { } ss << ((DNS_HEADER_QR(data) == 0) ? "REQ " : "RSP "); switch (DNS_HEADER_OPCODE(data)) { - case ns_o_query: ss << "QRY "; break; - case ns_o_iquery: ss << "IQRY "; break; - case ns_o_status: ss << "STATUS "; break; - case ns_o_notify: ss << "NOTIFY "; break; - case ns_o_update: ss << "UPDATE "; break; + case O_QUERY: ss << "QRY "; break; + case O_IQUERY: ss << "IQRY "; break; + case O_STATUS: ss << "STATUS "; break; + case O_NOTIFY: ss << "NOTIFY "; break; + case O_UPDATE: ss << "UPDATE "; break; default: ss << "UNKNOWN(" << DNS_HEADER_OPCODE(data) << ") "; break; } if (DNS_HEADER_AA(data)) ss << "AA "; @@ -292,7 +292,7 @@ std::string RRToString(const std::vector<byte>& packet, return ss.str(); } int rrtype = DNS_RR_TYPE(*data); - if (rrtype == ns_t_opt) { + if (rrtype == T_OPT) { ss << "MAXUDP=" << DNS_RR_CLASS(*data) << " "; ss << RRTypeToString(rrtype) << " "; ss << "RCODE2=" << DNS_RR_TTL(*data); @@ -309,11 +309,11 @@ std::string RRToString(const std::vector<byte>& packet, ss << "(RR too long at " << rdatalen << ", len left " << *len << ")"; } else { switch (rrtype) { - case ns_t_a: - case ns_t_aaaa: + case T_A: + case T_AAAA: ss << " " << AddressToString(*data, rdatalen); break; - case ns_t_txt: { + case T_TXT: { const byte* p = *data; while (p < (*data + rdatalen)) { int len = *p++; @@ -327,9 +327,9 @@ std::string RRToString(const std::vector<byte>& packet, } break; } - case ns_t_cname: - case ns_t_ns: - case ns_t_ptr: { + case T_CNAME: + case T_NS: + case T_PTR: { int rc = ares_expand_name(*data, packet.data(), packet.size(), &name, &enclen); if (rc != ARES_SUCCESS) { ss << "(error from ares_expand_name)"; @@ -339,7 +339,7 @@ std::string RRToString(const std::vector<byte>& packet, ares_free_string(name); break; } - case ns_t_mx: + case T_MX: if (rdatalen > 2) { int rc = ares_expand_name(*data + 2, packet.data(), packet.size(), &name, &enclen); if (rc != ARES_SUCCESS) { @@ -352,7 +352,7 @@ std::string RRToString(const std::vector<byte>& packet, ss << "(RR too short)"; } break; - case ns_t_srv: { + case T_SRV: { if (rdatalen > 6) { const byte* p = *data; unsigned long prio = DNS__16BIT(p); @@ -371,7 +371,7 @@ std::string RRToString(const std::vector<byte>& packet, } break; } - case ns_t_soa: { + case T_SOA: { const byte* p = *data; int rc = ares_expand_name(p, packet.data(), packet.size(), &name, &enclen); if (rc != ARES_SUCCESS) { @@ -401,7 +401,7 @@ std::string RRToString(const std::vector<byte>& packet, } break; } - case ns_t_naptr: { + case T_NAPTR: { if (rdatalen > 7) { const byte* p = *data; unsigned long order = DNS__16BIT(p); diff --git a/contrib/libs/c-ares/test/dns-proto.h b/contrib/libs/c-ares/test/dns-proto.h index 346711dfe9..854c99a9eb 100644 --- a/contrib/libs/c-ares/test/dns-proto.h +++ b/contrib/libs/c-ares/test/dns-proto.h @@ -3,8 +3,10 @@ #define DNS_PROTO_H // Utilities for processing DNS packet contents +#include "ares_setup.h" +#include "ares.h" // Include ares internal file for DNS protocol constants -#include "nameser.h" +#include "ares_nameser.h" #include <memory> #include <string> @@ -41,21 +43,21 @@ void PushInt16(std::vector<byte>* data, int value); std::vector<byte> EncodeString(const std::string& name); struct DNSQuestion { - DNSQuestion(const std::string& name, ns_type rrtype, ns_class qclass) + DNSQuestion(const std::string& name, int rrtype, int qclass) : name_(name), rrtype_(rrtype), qclass_(qclass) {} - DNSQuestion(const std::string& name, ns_type rrtype) - : name_(name), rrtype_(rrtype), qclass_(ns_c_in) {} + DNSQuestion(const std::string& name, int rrtype) + : name_(name), rrtype_(rrtype), qclass_(C_IN) {} virtual ~DNSQuestion() {} virtual std::vector<byte> data() const; std::string name_; - ns_type rrtype_; - ns_class qclass_; + int rrtype_; + int qclass_; }; struct DNSRR : public DNSQuestion { - DNSRR(const std::string& name, ns_type rrtype, ns_class qclass, int ttl) + DNSRR(const std::string& name, int rrtype, int qclass, int ttl) : DNSQuestion(name, rrtype, qclass), ttl_(ttl) {} - DNSRR(const std::string& name, ns_type rrtype, int ttl) + DNSRR(const std::string& name, int rrtype, int ttl) : DNSQuestion(name, rrtype), ttl_(ttl) {} virtual ~DNSRR() {} virtual std::vector<byte> data() const = 0; @@ -63,10 +65,10 @@ struct DNSRR : public DNSQuestion { }; struct DNSAddressRR : public DNSRR { - DNSAddressRR(const std::string& name, ns_type rrtype, int ttl, + DNSAddressRR(const std::string& name, int rrtype, int ttl, const byte* addr, int addrlen) : DNSRR(name, rrtype, ttl), addr_(addr, addr + addrlen) {} - DNSAddressRR(const std::string& name, ns_type rrtype, int ttl, + DNSAddressRR(const std::string& name, int rrtype, int ttl, const std::vector<byte>& addr) : DNSRR(name, rrtype, ttl), addr_(addr) {} virtual std::vector<byte> data() const; @@ -75,20 +77,20 @@ struct DNSAddressRR : public DNSRR { struct DNSARR : public DNSAddressRR { DNSARR(const std::string& name, int ttl, const byte* addr, int addrlen) - : DNSAddressRR(name, ns_t_a, ttl, addr, addrlen) {} + : DNSAddressRR(name, T_A, ttl, addr, addrlen) {} DNSARR(const std::string& name, int ttl, const std::vector<byte>& addr) - : DNSAddressRR(name, ns_t_a, ttl, addr) {} + : DNSAddressRR(name, T_A, ttl, addr) {} }; struct DNSAaaaRR : public DNSAddressRR { DNSAaaaRR(const std::string& name, int ttl, const byte* addr, int addrlen) - : DNSAddressRR(name, ns_t_aaaa, ttl, addr, addrlen) {} + : DNSAddressRR(name, T_AAAA, ttl, addr, addrlen) {} DNSAaaaRR(const std::string& name, int ttl, const std::vector<byte>& addr) - : DNSAddressRR(name, ns_t_aaaa, ttl, addr) {} + : DNSAddressRR(name, T_AAAA, ttl, addr) {} }; struct DNSSingleNameRR : public DNSRR { - DNSSingleNameRR(const std::string& name, ns_type rrtype, int ttl, + DNSSingleNameRR(const std::string& name, int rrtype, int ttl, const std::string& other) : DNSRR(name, rrtype, ttl), other_(other) {} virtual std::vector<byte> data() const; @@ -97,29 +99,29 @@ struct DNSSingleNameRR : public DNSRR { struct DNSCnameRR : public DNSSingleNameRR { DNSCnameRR(const std::string& name, int ttl, const std::string& other) - : DNSSingleNameRR(name, ns_t_cname, ttl, other) {} + : DNSSingleNameRR(name, T_CNAME, ttl, other) {} }; struct DNSNsRR : public DNSSingleNameRR { DNSNsRR(const std::string& name, int ttl, const std::string& other) - : DNSSingleNameRR(name, ns_t_ns, ttl, other) {} + : DNSSingleNameRR(name, T_NS, ttl, other) {} }; struct DNSPtrRR : public DNSSingleNameRR { DNSPtrRR(const std::string& name, int ttl, const std::string& other) - : DNSSingleNameRR(name, ns_t_ptr, ttl, other) {} + : DNSSingleNameRR(name, T_PTR, ttl, other) {} }; struct DNSTxtRR : public DNSRR { DNSTxtRR(const std::string& name, int ttl, const std::vector<std::string>& txt) - : DNSRR(name, ns_t_txt, ttl), txt_(txt) {} + : DNSRR(name, T_TXT, ttl), txt_(txt) {} virtual std::vector<byte> data() const; std::vector<std::string> txt_; }; struct DNSMxRR : public DNSRR { DNSMxRR(const std::string& name, int ttl, int pref, const std::string& other) - : DNSRR(name, ns_t_mx, ttl), pref_(pref), other_(other) {} + : DNSRR(name, T_MX, ttl), pref_(pref), other_(other) {} virtual std::vector<byte> data() const; int pref_; std::string other_; @@ -128,7 +130,7 @@ struct DNSMxRR : public DNSRR { struct DNSSrvRR : public DNSRR { DNSSrvRR(const std::string& name, int ttl, int prio, int weight, int port, const std::string& target) - : DNSRR(name, ns_t_srv, ttl), prio_(prio), weight_(weight), port_(port), target_(target) {} + : DNSRR(name, T_SRV, ttl), prio_(prio), weight_(weight), port_(port), target_(target) {} virtual std::vector<byte> data() const; int prio_; int weight_; @@ -140,7 +142,7 @@ struct DNSSoaRR : public DNSRR { DNSSoaRR(const std::string& name, int ttl, const std::string& nsname, const std::string& rname, int serial, int refresh, int retry, int expire, int minimum) - : DNSRR(name, ns_t_soa, ttl), nsname_(nsname), rname_(rname), + : DNSRR(name, T_SOA, ttl), nsname_(nsname), rname_(rname), serial_(serial), refresh_(refresh), retry_(retry), expire_(expire), minimum_(minimum) {} virtual std::vector<byte> data() const; @@ -160,7 +162,7 @@ struct DNSNaptrRR : public DNSRR { const std::string& service, const std::string& regexp, const std::string& replacement) - : DNSRR(name, ns_t_naptr, ttl), order_(order), pref_(pref), + : DNSRR(name, T_NAPTR, ttl), order_(order), pref_(pref), flags_(flags), service_(service), regexp_(regexp), replacement_(replacement) {} virtual std::vector<byte> data() const; int order_; @@ -178,16 +180,16 @@ struct DNSOption { struct DNSOptRR : public DNSRR { DNSOptRR(int extrcode, int udpsize) - : DNSRR("", ns_t_opt, static_cast<ns_class>(udpsize), extrcode) {} + : DNSRR("", T_OPT, static_cast<int>(udpsize), extrcode) {} virtual std::vector<byte> data() const; std::vector<DNSOption> opts_; }; struct DNSPacket { DNSPacket() - : qid_(0), response_(false), opcode_(ns_o_query), + : qid_(0), response_(false), opcode_(O_QUERY), aa_(false), tc_(false), rd_(false), ra_(false), - z_(false), ad_(false), cd_(false), rcode_(ns_r_noerror) {} + z_(false), ad_(false), cd_(false), rcode_(NOERROR) {} // Convenience functions that take ownership of given pointers. DNSPacket& add_question(DNSQuestion *q) { questions_.push_back(std::unique_ptr<DNSQuestion>(q)); @@ -215,14 +217,14 @@ struct DNSPacket { DNSPacket& set_z(bool v = true) { z_ = v; return *this; } DNSPacket& set_ad(bool v = true) { ad_ = v; return *this; } DNSPacket& set_cd(bool v = true) { cd_ = v; return *this; } - DNSPacket& set_rcode(ns_rcode rcode) { rcode_ = rcode; return *this; } + DNSPacket& set_rcode(int rcode) { rcode_ = rcode; return *this; } // Return the encoded packet. std::vector<byte> data() const; int qid_; bool response_; - ns_opcode opcode_; + int opcode_; bool aa_; bool tc_; bool rd_; @@ -230,7 +232,7 @@ struct DNSPacket { bool z_; bool ad_; bool cd_; - ns_rcode rcode_; + int rcode_; std::vector<std::unique_ptr<DNSQuestion>> questions_; std::vector<std::unique_ptr<DNSRR>> answers_; std::vector<std::unique_ptr<DNSRR>> auths_; diff --git a/contrib/libs/c-ares/test/ya.make b/contrib/libs/c-ares/test/ya.make index ef42eab230..8745fbc2ff 100644 --- a/contrib/libs/c-ares/test/ya.make +++ b/contrib/libs/c-ares/test/ya.make @@ -2,7 +2,12 @@ GTEST(arestest) -OWNER(max42 g:cpp-contrib) +WITHOUT_LICENSE_TEXTS() + +OWNER( + max42 + g:cpp-contrib +) LICENSE(MIT) @@ -17,7 +22,8 @@ PEERDIR( ) ADDINCL( - contrib/libs/c-ares + contrib/libs/c-ares/include + contrib/libs/c-ares/src/lib contrib/libs/c-ares/test ) @@ -43,6 +49,7 @@ SRCS( ares-test-ns.cc ares-test-parse-a.cc ares-test-parse-aaaa.cc + ares-test-parse-caa.cc ares-test-parse-mx.cc ares-test-parse-naptr.cc ares-test-parse-ns.cc diff --git a/contrib/libs/c-ares/ya.make b/contrib/libs/c-ares/ya.make index 899a5a55d1..ca62886c31 100644 --- a/contrib/libs/c-ares/ya.make +++ b/contrib/libs/c-ares/ya.make @@ -1,4 +1,4 @@ -# Generated by devtools/yamaker from nixpkgs e392df43c9f302d4a0892caaadcad3cd693edf9e. +# Generated by devtools/yamaker from nixpkgs 21.11. LIBRARY() @@ -7,14 +7,17 @@ OWNER( g:cpp-contrib ) -VERSION(1.16.1) +VERSION(1.17.2) -ORIGINAL_SOURCE(https://c-ares.haxx.se/download/c-ares-1.16.1.tar.gz) +ORIGINAL_SOURCE(https://c-ares.haxx.se/download/c-ares-1.17.2.tar.gz) OPENSOURCE_EXPORT_REPLACEMENT( - CMAKE c-ares - CMAKE_TARGET c-ares::c-ares - CONAN c-ares/1.16.1 + CMAKE + c-ares + CMAKE_TARGET + c-ares::c-ares + CONAN + c-ares/1.17.2 ) LICENSE( @@ -31,7 +34,8 @@ PEERDIR( ) ADDINCL( - contrib/libs/c-ares + contrib/libs/c-ares/include + contrib/libs/c-ares/src/lib ) NO_COMPILER_WARNINGS() @@ -55,67 +59,68 @@ IF (ARCH_ARM7) ENDIF() SRCS( - ares__close_sockets.c - ares__get_hostent.c - ares__parse_into_addrinfo.c - ares__read_line.c - ares__readaddrinfo.c - ares__sortaddrinfo.c - ares__timeval.c - ares_android.c - ares_cancel.c - ares_create_query.c - ares_data.c - ares_destroy.c - ares_expand_name.c - ares_expand_string.c - ares_fds.c - ares_free_hostent.c - ares_free_string.c - ares_freeaddrinfo.c - ares_getaddrinfo.c - ares_getenv.c - ares_gethostbyaddr.c - ares_gethostbyname.c - ares_getnameinfo.c - ares_getopt.c - ares_getsock.c - ares_init.c - ares_library_init.c - ares_llist.c - ares_mkquery.c - ares_nowarn.c - ares_options.c - ares_parse_a_reply.c - ares_parse_aaaa_reply.c - ares_parse_mx_reply.c - ares_parse_naptr_reply.c - ares_parse_ns_reply.c - ares_parse_ptr_reply.c - ares_parse_soa_reply.c - ares_parse_srv_reply.c - ares_parse_txt_reply.c - ares_platform.c - ares_process.c - ares_query.c - ares_search.c - ares_send.c - ares_strcasecmp.c - ares_strdup.c - ares_strerror.c - ares_strsplit.c - ares_timeout.c - ares_version.c - ares_writev.c - atomic.cpp - bitncmp.c - inet_net_pton.c - inet_ntop.c - windows_port.c + src/lib/ares__close_sockets.c + 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__sortaddrinfo.c + src/lib/ares__timeval.c + src/lib/ares_android.c + src/lib/ares_cancel.c + src/lib/ares_create_query.c + src/lib/ares_data.c + src/lib/ares_destroy.c + src/lib/ares_expand_name.c + src/lib/ares_expand_string.c + src/lib/ares_fds.c + src/lib/ares_free_hostent.c + src/lib/ares_free_string.c + src/lib/ares_freeaddrinfo.c + src/lib/ares_getaddrinfo.c + src/lib/ares_getenv.c + src/lib/ares_gethostbyaddr.c + src/lib/ares_gethostbyname.c + src/lib/ares_getnameinfo.c + src/lib/ares_getsock.c + src/lib/ares_init.c + src/lib/ares_library_init.c + src/lib/ares_llist.c + src/lib/ares_mkquery.c + src/lib/ares_nowarn.c + src/lib/ares_options.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 + src/lib/ares_parse_ns_reply.c + src/lib/ares_parse_ptr_reply.c + src/lib/ares_parse_soa_reply.c + src/lib/ares_parse_srv_reply.c + src/lib/ares_parse_txt_reply.c + src/lib/ares_platform.c + src/lib/ares_process.c + src/lib/ares_query.c + src/lib/ares_search.c + src/lib/ares_send.c + src/lib/ares_strcasecmp.c + src/lib/ares_strdup.c + src/lib/ares_strerror.c + src/lib/ares_strsplit.c + src/lib/ares_timeout.c + src/lib/ares_version.c + src/lib/ares_writev.c + src/lib/atomic.cpp + src/lib/bitncmp.c + src/lib/inet_net_pton.c + src/lib/inet_ntop.c + src/lib/windows_port.c + src/tools/ares_getopt.c ) IF (NOT EXPORT_CMAKE) - CHECK_CONFIG_H(ares_setup.h) + CHECK_CONFIG_H(src/lib/ares_setup.h) ENDIF() END() diff --git a/contrib/libs/curl/ya.make b/contrib/libs/curl/ya.make index 00027df424..b2ce11bcbf 100644 --- a/contrib/libs/curl/ya.make +++ b/contrib/libs/curl/ya.make @@ -28,7 +28,7 @@ PEERDIR( ADDINCL( GLOBAL contrib/libs/curl/include - contrib/libs/c-ares + contrib/libs/c-ares/include contrib/libs/curl/lib ) diff --git a/contrib/libs/grpc/grpc/ya.make b/contrib/libs/grpc/grpc/ya.make index c29c11c0c4..b9991e88ea 100644 --- a/contrib/libs/grpc/grpc/ya.make +++ b/contrib/libs/grpc/grpc/ya.make @@ -29,7 +29,7 @@ PEERDIR( ADDINCL( GLOBAL contrib/libs/grpc/include - contrib/libs/c-ares + contrib/libs/c-ares/include ${ARCADIA_BUILD_ROOT}/contrib/libs/grpc contrib/libs/grpc contrib/libs/grpc/src/core/ext/upb-generated diff --git a/library/cpp/actors/dnscachelib/dnscache.cpp b/library/cpp/actors/dnscachelib/dnscache.cpp index 649339ddb2..71605b9533 100644 --- a/library/cpp/actors/dnscachelib/dnscache.cpp +++ b/library/cpp/actors/dnscachelib/dnscache.cpp @@ -2,7 +2,7 @@ #include "probes.h" #include "timekeeper.h" -#include <contrib/libs/c-ares/ares.h> +#include <contrib/libs/c-ares/include/ares.h> #include <util/system/guard.h> #include <util/datetime/systime.h> diff --git a/library/cpp/actors/dnscachelib/dnscache.h b/library/cpp/actors/dnscachelib/dnscache.h index 3313a251a1..6a7061e2fe 100644 --- a/library/cpp/actors/dnscachelib/dnscache.h +++ b/library/cpp/actors/dnscachelib/dnscache.h @@ -1,6 +1,6 @@ #pragma once -#include <contrib/libs/c-ares/ares.h> +#include <contrib/libs/c-ares/include/ares.h> #include <util/generic/map.h> #include <util/generic/vector.h> #include <util/network/address.h> diff --git a/library/cpp/actors/dnsresolver/ut/ya.make b/library/cpp/actors/dnsresolver/ut/ya.make index ad936bdacd..6024145b03 100644 --- a/library/cpp/actors/dnsresolver/ut/ya.make +++ b/library/cpp/actors/dnsresolver/ut/ya.make @@ -12,7 +12,7 @@ SRCS( dnsresolver_ut.cpp ) -ADDINCL(contrib/libs/c-ares) +ADDINCL(contrib/libs/c-ares/include) TAG(ya:external) REQUIREMENTS(network:full) diff --git a/library/cpp/actors/dnsresolver/ya.make b/library/cpp/actors/dnsresolver/ya.make index 329c56c5b3..d0a61f768d 100644 --- a/library/cpp/actors/dnsresolver/ya.make +++ b/library/cpp/actors/dnsresolver/ya.make @@ -13,7 +13,7 @@ PEERDIR( contrib/libs/c-ares ) -ADDINCL(contrib/libs/c-ares) +ADDINCL(contrib/libs/c-ares/include) END() |