Commit 4e051743 authored by Jason Madden's avatar Jason Madden Committed by GitHub

Merge pull request #1403 from gevent/issue1400

Update c-ares to 1.15
parents 842d801d c15c219e
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
- Upgrade libev from 4.23 to 4.25 and update its embedded - Upgrade libev from 4.23 to 4.25 and update its embedded
``config.guess`` to the latest. ``config.guess`` to the latest.
- Upgrade c-ares from 1.14 to 1.15.
- dnspython >= 1.16.0 is now required for the dnspython resolver. - dnspython >= 1.16.0 is now required for the dnspython resolver.
- Python 3.7 subprocess: Copy a ``STARTUPINFO`` passed as a parameter. - Python 3.7 subprocess: Copy a ``STARTUPINFO`` passed as a parameter.
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Managing Embedded Dependencies Managing Embedded Dependencies
================================ ================================
* Generate patches with ``git diff --patch --minimal -b``
Updating libev Updating libev
============== ==============
...@@ -29,10 +30,33 @@ http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree ) ...@@ -29,10 +30,33 @@ http://git.savannah.gnu.org/gitweb/?p=config.git;a=tree )
Updating c-ares Updating c-ares
=============== ===============
- Modify the c-ares Makefile.in[c] to empty out the MANPAGES variables - Download and clean up the c-ares Makefile.in[c] to empty out the
so that we don't have to ship those in the sdist. MANPAGES variables so that we don't have to ship those in the sdist::
XXX: We need a patch for that. export CARES_VER=1.15.0
cd deps/
wget https://c-ares.haxx.se/download/c-ares-$CARES_VER.tar.gz
tar -xf c-ares-$CARES_VER.tar.gz
rm -rf c-ares c-ares-$CARES_VER.tar.gz
mv c-ares-$CARES_VER c-ares
cp c-ares/ares_build.h c-ares/ares_build.h.dist
rm -f c-ares/*.3 c-ares/*.1
rm -rf c-ares/test
rm -rf c-ares/vc
rm -f c-ares/maketgz
rm -f c-ares/CMakeLists.txt
rm -f c-ares/RELEASE-PROCEDURE.md
rm -f c-ares/*.cmake c-ares/*.cmake.in
git apply cares-make.patch
At this point there might be new files in libuv that need added to
git, evaluate them and add them.
- Evaluate whether the release has
https://github.com/c-ares/c-ares/issues/246 fixed. If not, ``git
apply cares-win32.patch``. If so, then delete that file and this
part of the instructions.
- Follow the same 'config.guess' and 'config.sub' steps as libev. - Follow the same 'config.guess' and 'config.sub' steps as libev.
......
This diff is collapsed.
...@@ -69,7 +69,7 @@ DIST_SUBDIRS = test ...@@ -69,7 +69,7 @@ DIST_SUBDIRS = test
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libcares.pc pkgconfig_DATA = libcares.pc
CARES_VERSION_INFO = -version-info 4:0:2 CARES_VERSION_INFO = -version-info 5:0:3
# This flag accepts an argument of the form current[:revision[:age]]. So, # This flag accepts an argument of the form current[:revision[:age]]. So,
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to # passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
# 1. # 1.
......
This diff is collapsed.
...@@ -41,6 +41,7 @@ CSOURCES = ares__close_sockets.c \ ...@@ -41,6 +41,7 @@ CSOURCES = ares__close_sockets.c \
ares_strcasecmp.c \ ares_strcasecmp.c \
ares_strdup.c \ ares_strdup.c \
ares_strerror.c \ ares_strerror.c \
ares_strsplit.c \
ares_timeout.c \ ares_timeout.c \
ares_version.c \ ares_version.c \
ares_writev.c \ ares_writev.c \
...@@ -50,6 +51,7 @@ CSOURCES = ares__close_sockets.c \ ...@@ -50,6 +51,7 @@ CSOURCES = ares__close_sockets.c \
windows_port.c windows_port.c
HHEADERS = ares.h \ HHEADERS = ares.h \
ares_android.h \
ares_build.h \ ares_build.h \
ares_data.h \ ares_data.h \
ares_dns.h \ ares_dns.h \
...@@ -65,6 +67,7 @@ HHEADERS = ares.h \ ...@@ -65,6 +67,7 @@ HHEADERS = ares.h \
ares_rules.h \ ares_rules.h \
ares_strcasecmp.h \ ares_strcasecmp.h \
ares_strdup.h \ ares_strdup.h \
ares_strsplit.h \
ares_version.h \ ares_version.h \
ares_writev.h \ ares_writev.h \
bitncmp.h \ bitncmp.h \
...@@ -75,6 +78,7 @@ HHEADERS = ares.h \ ...@@ -75,6 +78,7 @@ HHEADERS = ares.h \
MANPAGES = MANPAGES =
HTMLPAGES = ares_cancel.html \ HTMLPAGES = ares_cancel.html \
ares_create_query.html \
ares_destroy.html \ ares_destroy.html \
ares_destroy_options.html \ ares_destroy_options.html \
ares_dup.html \ ares_dup.html \
...@@ -91,13 +95,15 @@ HTMLPAGES = ares_cancel.html \ ...@@ -91,13 +95,15 @@ HTMLPAGES = ares_cancel.html \
ares_gethostbyname_file.html \ ares_gethostbyname_file.html \
ares_getnameinfo.html \ ares_getnameinfo.html \
ares_getsock.html \ ares_getsock.html \
ares_inet_ntop.html \
ares_inet_pton.html \
ares_init.html \ ares_init.html \
ares_init_options.html \ ares_init_options.html \
ares_library_cleanup.html \ ares_library_cleanup.html \
ares_library_init.html \ ares_library_init.html \
ares_library_init_android.html \
ares_library_initialized.html \ ares_library_initialized.html \
ares_mkquery.html \ ares_mkquery.html \
ares_create_query.html \
ares_parse_a_reply.html \ ares_parse_a_reply.html \
ares_parse_aaaa_reply.html \ ares_parse_aaaa_reply.html \
ares_parse_mx_reply.html \ ares_parse_mx_reply.html \
...@@ -120,14 +126,14 @@ HTMLPAGES = ares_cancel.html \ ...@@ -120,14 +126,14 @@ HTMLPAGES = ares_cancel.html \
ares_set_servers_ports_csv.html \ ares_set_servers_ports_csv.html \
ares_set_socket_callback.html \ ares_set_socket_callback.html \
ares_set_socket_configure_callback.html \ ares_set_socket_configure_callback.html \
ares_set_socket_functions.html \
ares_set_sortlist.html \ ares_set_sortlist.html \
ares_strerror.html \ ares_strerror.html \
ares_timeout.html \ ares_timeout.html \
ares_version.html \ ares_version.html
ares_inet_pton.html \
ares_inet_ntop.html
PDFPAGES = ares_cancel.pdf \ PDFPAGES = ares_cancel.pdf \
ares_create_query.pdf \
ares_destroy.pdf \ ares_destroy.pdf \
ares_destroy_options.pdf \ ares_destroy_options.pdf \
ares_dup.pdf \ ares_dup.pdf \
...@@ -144,13 +150,15 @@ PDFPAGES = ares_cancel.pdf \ ...@@ -144,13 +150,15 @@ PDFPAGES = ares_cancel.pdf \
ares_gethostbyname_file.pdf \ ares_gethostbyname_file.pdf \
ares_getnameinfo.pdf \ ares_getnameinfo.pdf \
ares_getsock.pdf \ ares_getsock.pdf \
ares_inet_ntop.pdf \
ares_inet_pton.pdf \
ares_init.pdf \ ares_init.pdf \
ares_init_options.pdf \ ares_init_options.pdf \
ares_library_cleanup.pdf \ ares_library_cleanup.pdf \
ares_library_init.pdf \ ares_library_init.pdf \
ares_library_init_android.pdf \
ares_library_initialized.pdf \ ares_library_initialized.pdf \
ares_mkquery.pdf \ ares_mkquery.pdf \
ares_create_query.pdf \
ares_parse_a_reply.pdf \ ares_parse_a_reply.pdf \
ares_parse_aaaa_reply.pdf \ ares_parse_aaaa_reply.pdf \
ares_parse_mx_reply.pdf \ ares_parse_mx_reply.pdf \
...@@ -173,12 +181,11 @@ PDFPAGES = ares_cancel.pdf \ ...@@ -173,12 +181,11 @@ PDFPAGES = ares_cancel.pdf \
ares_set_servers_ports_csv.pdf \ ares_set_servers_ports_csv.pdf \
ares_set_socket_callback.pdf \ ares_set_socket_callback.pdf \
ares_set_socket_configure_callback.pdf \ ares_set_socket_configure_callback.pdf \
ares_set_socket_functions.pdf \
ares_set_sortlist.pdf \ ares_set_sortlist.pdf \
ares_strerror.pdf \ ares_strerror.pdf \
ares_timeout.pdf \ ares_timeout.pdf \
ares_version.pdf \ ares_version.pdf
ares_inet_pton.pdf \
ares_inet_ntop.pdf
SAMPLESOURCES = ares_getopt.c \ SAMPLESOURCES = ares_getopt.c \
ares_nowarn.c \ ares_nowarn.c \
......
c-ares version 1.14.0 c-ares version 1.15.0
Changes: Changes:
o android: Introduce new ares_library_init_android() call for Oreo support. [5] o Add ares_init_options() configurability for path to resolv.conf file [1]
o Ability to exclude building of tools (adig, ahost, acountry) in CMake [3]
o Android: Support for domain search suffix [4]
o Report ARES_ENOTFOUND for .onion domain names as per RFC7686. [13]
Bug fixes: Bug fixes:
o AIX build fix for trying to include both nameser_compat.h and
o Fix patch for CVE-2017-1000381 to not be overly aggressive. [1] onameser_compat.h [2]
o win32: Preserve DNS server order returned by Windows when sorting and exclude o Windows: Improve DNS suffixes extracting from WinNT registry [5]
DNS servers in legacy subnets. [2] [4] o Fix modern GCC warnings [6]
o win32: Support most recent Visual Studio 2017 o Apply the IPv6 server blacklist to all nameserver sources, not just Windows
o gethostbyaddr should fail with ECANCELLED not ENOTFOUND when ares_cancel [7]
is called. [3] o Fix warnings emitted by MSVC when using -W4 [8]
o win32: Exclude legacy ipv6 subnets [4] o Prevent changing name servers while queries are outstanding [9]
o android: Applications compiled for Oreo can no longer use o Harden and rationalize c-ares timeout computation [10]
__system_property_get and must use Java calls to retrieve DNS servers. o Distribute ares_android.h [11]
[5] [7] o ares_set_servers_csv() on failure should not leave channel in a bad state
o win32: Force use of ANSI functions [6] [12]
o CMake minimum version is now 3.1 o Add missing docs to distribution
o ares_gethostbyname.3: fix callback status values [8]
o docs: Document WSAStartup requirement [9]
o Fix a typo in init_by_resolv_conf [10]
o Android JNI code leaks local references in some cases [11]
o Force using the ANSI versions of WinAPI functions [12]
Thanks go to these friendly people for their efforts and contributions: Thanks go to these friendly people for their efforts and contributions:
@afalin, Andi Schnebinger, Ben Noordhuis, Brad House, Brad Spencer,
AC Thompson, Anna Henningsen, Antonio Tajuelo, Brad House, Brad Spencer, David Hotham, @flyingdutchman23, John Schember, Ruslan Baratov,
Christian Ammer, Daniel Stenberg, David Drysdale, David Hotham, Felix Yan, Sarat Addepalli, Tobias Nießen (11 contributors)
Gergely Nagy, Gregor Jasny, Jakub Hrozek, John Schember,
Konstantinos Sofokleous, Roman Teterin, Sergey Kolomenkin, Sheel Bedi,
(18 contributors)
References to bug reports and discussions on issues: References to bug reports and discussions on issues:
[1] = https://github.com/c-ares/c-ares/issues/220
[2] = https://github.com/c-ares/c-ares/issues/224
[3] = https://github.com/c-ares/c-ares/issues/200
[4] = https://github.com/c-ares/c-ares/issues/207
[5] = https://github.com/c-ares/c-ares/pull/202
[6] = https://github.com/c-ares/c-ares/pull/201
[7] = https://github.com/c-ares/c-ares/pull/193
[8] = https://github.com/c-ares/c-ares/pull/192
[9] = https://github.com/c-ares/c-ares/pull/191
[10] = https://github.com/c-ares/c-ares/pull/187
[11] = https://c-ares.haxx.se/mail/c-ares-archive-2018-04/0000.shtml
[12] = https://c-ares.haxx.se/mail/c-ares-archive-2018-03/0000.shtml
[13] = https://github.com/c-ares/c-ares/issues/196
[1] = https://github.com/c-ares/c-ares/commit/18ea99
[2] = https://github.com/c-ares/c-ares/issues/150
[3] = https://github.com/c-ares/c-ares/pull/138
[4] = https://github.com/c-ares/c-ares/pull/144
[5] = https://github.com/c-ares/c-ares/pull/148
[6] = https://github.com/c-ares/c-ares/pull/142
[7] = https://github.com/c-ares/c-ares/pull/175
[8] = https://c-ares.haxx.se/mail/c-ares-archive-2011-06/0012.shtml
[9] = https://github.com/c-ares/c-ares/pull/180
[10] = https://github.com/c-ares/c-ares/pull/160
[11] = https://github.com/c-ares/c-ares/pull/175
[12] = https://github.com/c-ares/c-ares/pull/142
This diff is collapsed.
...@@ -164,6 +164,7 @@ extern "C" { ...@@ -164,6 +164,7 @@ extern "C" {
#define ARES_OPT_ROTATE (1 << 14) #define ARES_OPT_ROTATE (1 << 14)
#define ARES_OPT_EDNSPSZ (1 << 15) #define ARES_OPT_EDNSPSZ (1 << 15)
#define ARES_OPT_NOROTATE (1 << 16) #define ARES_OPT_NOROTATE (1 << 16)
#define ARES_OPT_RESOLVCONF (1 << 17)
/* Nameinfo flag values */ /* Nameinfo flag values */
#define ARES_NI_NOFQDN (1 << 0) #define ARES_NI_NOFQDN (1 << 0)
...@@ -270,6 +271,7 @@ struct ares_options { ...@@ -270,6 +271,7 @@ struct ares_options {
struct apattern *sortlist; struct apattern *sortlist;
int nsort; int nsort;
int ednspsz; int ednspsz;
char *resolvconf_path;
}; };
struct hostent; struct hostent;
......
...@@ -30,6 +30,8 @@ static jmethodID android_cm_active_net_mid = NULL; ...@@ -30,6 +30,8 @@ static jmethodID android_cm_active_net_mid = NULL;
static jmethodID android_cm_link_props_mid = NULL; static jmethodID android_cm_link_props_mid = NULL;
/* LinkProperties.getDnsServers */ /* LinkProperties.getDnsServers */
static jmethodID android_lp_dns_servers_mid = NULL; static jmethodID android_lp_dns_servers_mid = NULL;
/* LinkProperties.getDomains */
static jmethodID android_lp_domains_mid = NULL;
/* List.size */ /* List.size */
static jmethodID android_list_size_mid = NULL; static jmethodID android_list_size_mid = NULL;
/* List.get */ /* List.get */
...@@ -139,6 +141,12 @@ int ares_library_init_android(jobject connectivity_manager) ...@@ -139,6 +141,12 @@ int ares_library_init_android(jobject connectivity_manager)
if (android_lp_dns_servers_mid == NULL) if (android_lp_dns_servers_mid == NULL)
goto cleanup; goto cleanup;
/* getDomains in API 21. */
android_lp_domains_mid = jni_get_method_id(env, obj_cls, "getDomains",
"()Ljava/lang/String;");
if (android_lp_domains_mid == NULL)
goto cleanup;
(*env)->DeleteLocalRef(env, obj_cls); (*env)->DeleteLocalRef(env, obj_cls);
obj_cls = jni_get_class(env, "java/util/List"); obj_cls = jni_get_class(env, "java/util/List");
if (obj_cls == NULL) if (obj_cls == NULL)
...@@ -173,6 +181,7 @@ cleanup: ...@@ -173,6 +181,7 @@ cleanup:
android_cm_active_net_mid = NULL; android_cm_active_net_mid = NULL;
android_cm_link_props_mid = NULL; android_cm_link_props_mid = NULL;
android_lp_dns_servers_mid = NULL; android_lp_dns_servers_mid = NULL;
android_lp_domains_mid = NULL;
android_list_size_mid = NULL; android_list_size_mid = NULL;
android_list_get_mid = NULL; android_list_get_mid = NULL;
android_ia_host_addr_mid = NULL; android_ia_host_addr_mid = NULL;
...@@ -213,6 +222,7 @@ void ares_library_cleanup_android(void) ...@@ -213,6 +222,7 @@ void ares_library_cleanup_android(void)
android_cm_active_net_mid = NULL; android_cm_active_net_mid = NULL;
android_cm_link_props_mid = NULL; android_cm_link_props_mid = NULL;
android_lp_dns_servers_mid = NULL; android_lp_dns_servers_mid = NULL;
android_lp_domains_mid = NULL;
android_list_size_mid = NULL; android_list_size_mid = NULL;
android_list_get_mid = NULL; android_list_get_mid = NULL;
android_ia_host_addr_mid = NULL; android_ia_host_addr_mid = NULL;
...@@ -341,6 +351,95 @@ done: ...@@ -341,6 +351,95 @@ done:
(*android_jvm)->DetachCurrentThread(android_jvm); (*android_jvm)->DetachCurrentThread(android_jvm);
return dns_list; return dns_list;
} }
char *ares_get_android_search_domains_list(void)
{
JNIEnv *env = NULL;
jobject active_network = NULL;
jobject link_properties = NULL;
jstring domains = NULL;
const char *domain;
int res;
size_t i;
size_t cnt = 0;
char *domain_list = NULL;
int need_detatch = 0;
if (android_jvm == NULL || android_connectivity_manager == NULL)
{
return NULL;
}
if (android_cm_active_net_mid == NULL || android_cm_link_props_mid == NULL ||
android_lp_domains_mid == NULL)
{
return NULL;
}
res = (*android_jvm)->GetEnv(android_jvm, (void **)&env, JNI_VERSION_1_6);
if (res == JNI_EDETACHED)
{
env = NULL;
res = (*android_jvm)->AttachCurrentThread(android_jvm, &env, NULL);
need_detatch = 1;
}
if (res != JNI_OK || env == NULL)
goto done;
/* JNI below is equivalent to this Java code.
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.LinkProperties;
ConnectivityManager cm = (ConnectivityManager)this.getApplicationContext()
.getSystemService(Context.CONNECTIVITY_SERVICE);
Network an = cm.getActiveNetwork();
LinkProperties lp = cm.getLinkProperties(an);
String domains = lp.getDomains();
for (String domain: domains.split(",")) {
String d = domain;
}
Note: The JNI ConnectivityManager object and all method IDs were previously
initialized in ares_library_init_android.
*/
active_network = (*env)->CallObjectMethod(env, android_connectivity_manager,
android_cm_active_net_mid);
if (active_network == NULL)
goto done;
link_properties =
(*env)->CallObjectMethod(env, android_connectivity_manager,
android_cm_link_props_mid, active_network);
if (link_properties == NULL)
goto done;
/* Get the domains. It is a common separated list of domains to search. */
domains = (*env)->CallObjectMethod(env, link_properties,
android_lp_domains_mid);
if (domains == NULL)
goto done;
/* Split on , */
domain = (*env)->GetStringUTFChars(env, domains, 0);
domain_list = ares_strdup(domain);
(*env)->ReleaseStringUTFChars(env, domains, domain);
(*env)->DeleteLocalRef(env, domains);
done:
if ((*env)->ExceptionOccurred(env))
(*env)->ExceptionClear(env);
if (link_properties != NULL)
(*env)->DeleteLocalRef(env, link_properties);
if (active_network != NULL)
(*env)->DeleteLocalRef(env, active_network);
if (need_detatch)
(*android_jvm)->DetachCurrentThread(android_jvm);
return domain_list;
}
#else #else
/* warning: ISO C forbids an empty translation unit */ /* warning: ISO C forbids an empty translation unit */
typedef int dummy_make_iso_compilers_happy; typedef int dummy_make_iso_compilers_happy;
......
/* Copyright (C) 2017 by John Schember <john@nachtimwald.com>
*
* 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.
*/
#ifndef __ARES_ANDROID_H__
#define __ARES_ANDROID_H__
#if defined(ANDROID) || defined(__ANDROID__)
char **ares_get_android_server_list(size_t max_servers, size_t *num_servers);
char *ares_get_android_search_domains_list(void);
void ares_library_cleanup_android(void);
#endif
#endif /* __ARES_ANDROID_H__ */
...@@ -83,148 +83,88 @@ ...@@ -83,148 +83,88 @@
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
/* ================================================================ */ /* ================================================================ */
#ifdef CARES_SIZEOF_LONG
# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined
#endif
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T #ifdef CARES_TYPEOF_ARES_SOCKLEN_T
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" # 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 Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
#endif #endif
#ifdef CARES_SIZEOF_ARES_SOCKLEN_T
# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined
#endif
/* ================================================================ */ /* ================================================================ */
/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */ /* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
/* ================================================================ */ /* ================================================================ */
#if defined(__DJGPP__) || defined(__GO32__) #if defined(__DJGPP__) || defined(__GO32__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__SALFORDC__) #elif defined(__SALFORDC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__TURBOC__) #elif defined(__TURBOC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__POCC__) #elif defined(__POCC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__LCC__) #elif defined(__LCC__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__SYMBIAN32__) #elif defined(__SYMBIAN32__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__MWERKS__) #elif defined(__MWERKS__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(_WIN32_WCE) #elif defined(_WIN32_WCE)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__VMS) #elif defined(__VMS)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int # define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
#elif defined(__OS400__) #elif defined(__OS400__)
# if defined(__ILEC400__) # if defined(__ILEC400__)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
# define CARES_PULL_SYS_TYPES_H 1 # define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1 # define CARES_PULL_SYS_SOCKET_H 1
# endif # endif
#elif defined(__MVS__) #elif defined(__MVS__)
# if defined(__IBMC__) || defined(__IBMCPP__) # if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_ILP32)
# define CARES_SIZEOF_LONG 4
# elif defined(_LP64)
# define CARES_SIZEOF_LONG 8
# endif
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
# define CARES_PULL_SYS_TYPES_H 1 # define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1 # define CARES_PULL_SYS_SOCKET_H 1
# endif # endif
#elif defined(__370__) #elif defined(__370__)
# if defined(__IBMC__) || defined(__IBMCPP__) # if defined(__IBMC__) || defined(__IBMCPP__)
# if defined(_ILP32)
# define CARES_SIZEOF_LONG 4
# elif defined(_LP64)
# define CARES_SIZEOF_LONG 8
# endif
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
# define CARES_PULL_SYS_TYPES_H 1 # define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1 # define CARES_PULL_SYS_SOCKET_H 1
# endif # endif
#elif defined(TPF) #elif defined(TPF)
# define CARES_SIZEOF_LONG 8
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
/* ===================================== */ /* ===================================== */
/* KEEP MSVC THE PENULTIMATE ENTRY */ /* KEEP MSVC THE PENULTIMATE ENTRY */
/* ===================================== */ /* ===================================== */
#elif defined(_MSC_VER) #elif defined(_MSC_VER)
# define CARES_SIZEOF_LONG 4
# define CARES_TYPEOF_ARES_SOCKLEN_T int # define CARES_TYPEOF_ARES_SOCKLEN_T int
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
/* ===================================== */ /* ===================================== */
/* KEEP GENERIC GCC THE LAST ENTRY */ /* KEEP GENERIC GCC THE LAST ENTRY */
/* ===================================== */ /* ===================================== */
#elif defined(__GNUC__) #elif defined(__GNUC__)
# if defined(__LP64__) || \
defined(__x86_64__) || defined(__ppc64__)
# define CARES_SIZEOF_LONG 8
# elif defined(__ILP32__) || \
defined(__i386__) || defined(__ppc__) || defined(__arm__)
# define CARES_SIZEOF_LONG 4
# endif
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t # define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_SIZEOF_ARES_SOCKLEN_T 4
# define CARES_PULL_SYS_TYPES_H 1 # define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1 # define CARES_PULL_SYS_SOCKET_H 1
...@@ -259,7 +199,7 @@ ...@@ -259,7 +199,7 @@
# define CARES_TYPEOF_ARES_SSIZE_T long # define CARES_TYPEOF_ARES_SSIZE_T long
# endif # endif
#else #else
# define CARES_TYPEOF_ARES_SSIZE_T ssize_t; # define CARES_TYPEOF_ARES_SSIZE_T ssize_t
#endif #endif
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
......
...@@ -94,6 +94,10 @@ int ares_create_query(const char *name, int dnsclass, int type, ...@@ -94,6 +94,10 @@ int ares_create_query(const char *name, int dnsclass, int type,
size_t buflen; size_t buflen;
unsigned char *buf; unsigned char *buf;
/* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
if (ares__is_onion_domain(name))
return ARES_ENOTFOUND;
/* Set our results early, in case we bail out early with an error. */ /* Set our results early, in case we bail out early with an error. */
*buflenp = 0; *buflenp = 0;
*bufp = NULL; *bufp = NULL;
...@@ -188,7 +192,7 @@ int ares_create_query(const char *name, int dnsclass, int type, ...@@ -188,7 +192,7 @@ int ares_create_query(const char *name, int dnsclass, int type,
* specified in RFC 1035 ("To simplify implementations, the total length of * specified in RFC 1035 ("To simplify implementations, the total length of
* a domain name (i.e., label octets and label length octets) is restricted * a domain name (i.e., label octets and label length octets) is restricted
* to 255 octets or less."). */ * to 255 octets or less."). */
if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ + if (buflen > (size_t)(MAXCDNAME + HFIXEDSZ + QFIXEDSZ +
(max_udp_size ? EDNSFIXEDSZ : 0))) { (max_udp_size ? EDNSFIXEDSZ : 0))) {
ares_free (buf); ares_free (buf);
return ARES_EBADNAME; return ARES_EBADNAME;
......
...@@ -36,6 +36,8 @@ void ares_destroy_options(struct ares_options *options) ...@@ -36,6 +36,8 @@ void ares_destroy_options(struct ares_options *options)
ares_free(options->sortlist); ares_free(options->sortlist);
if(options->lookups) if(options->lookups)
ares_free(options->lookups); ares_free(options->lookups);
if(options->resolvconf_path)
ares_free(options->resolvconf_path);
} }
void ares_destroy(ares_channel channel) void ares_destroy(ares_channel channel)
...@@ -85,6 +87,9 @@ void ares_destroy(ares_channel channel) ...@@ -85,6 +87,9 @@ void ares_destroy(ares_channel channel)
if (channel->lookups) if (channel->lookups)
ares_free(channel->lookups); ares_free(channel->lookups);
if (channel->resolvconf_path)
ares_free(channel->resolvconf_path);
ares_free(channel); ares_free(channel);
} }
......
...@@ -95,6 +95,13 @@ void ares_gethostbyname(ares_channel channel, const char *name, int family, ...@@ -95,6 +95,13 @@ void ares_gethostbyname(ares_channel channel, const char *name, int family,
return; return;
} }
/* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
if (ares__is_onion_domain(name))
{
callback(arg, ARES_ENOTFOUND, 0, NULL);
return;
}
if (fake_hostent(name, family, callback, arg)) if (fake_hostent(name, family, callback, arg))
return; return;
...@@ -376,6 +383,10 @@ static int file_lookup(const char *name, int family, struct hostent **host) ...@@ -376,6 +383,10 @@ static int file_lookup(const char *name, int family, struct hostent **host)
return ARES_ENOTFOUND; return ARES_ENOTFOUND;
#endif #endif
/* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
if (ares__is_onion_domain(name))
return ARES_ENOTFOUND;
fp = fopen(PATH_HOSTS, "r"); fp = fopen(PATH_HOSTS, "r");
if (!fp) if (!fp)
{ {
......
...@@ -440,3 +440,14 @@ STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2) ...@@ -440,3 +440,14 @@ STATIC_TESTABLE char *ares_striendstr(const char *s1, const char *s2)
} }
return (char *)c1_begin; return (char *)c1_begin;
} }
int ares__is_onion_domain(const char *name)
{
if (ares_striendstr(name, ".onion"))
return 1;
if (ares_striendstr(name, ".onion."))
return 1;
return 0;
}
This diff is collapsed.
...@@ -40,9 +40,19 @@ static unsigned int ares_initialized; ...@@ -40,9 +40,19 @@ static unsigned int ares_initialized;
static int ares_init_flags; static int ares_init_flags;
/* library-private global vars with visibility across the whole library */ /* library-private global vars with visibility across the whole library */
void *(*ares_malloc)(size_t size) = malloc; #if defined(WIN32)
void *(*ares_realloc)(void *ptr, size_t size) = realloc; /* We need indirections to handle Windows DLL rules. */
void (*ares_free)(void *ptr) = free; 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
void *(*ares_malloc)(size_t size) = default_malloc;
void *(*ares_realloc)(void *ptr, size_t size) = default_realloc;
void (*ares_free)(void *ptr) = default_free;
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
static HMODULE hnd_iphlpapi; static HMODULE hnd_iphlpapi;
......
...@@ -153,6 +153,9 @@ int ares_set_servers(ares_channel channel, ...@@ -153,6 +153,9 @@ int ares_set_servers(ares_channel channel,
if (!channel) if (!channel)
return ARES_ENODATA; return ARES_ENODATA;
if (!ares__is_list_empty(&channel->all_queries))
return ARES_ENOTIMP;
ares__destroy_servers_state(channel); ares__destroy_servers_state(channel);
for (srvr = servers; srvr; srvr = srvr->next) for (srvr = servers; srvr; srvr = srvr->next)
...@@ -202,6 +205,9 @@ int ares_set_servers_ports(ares_channel channel, ...@@ -202,6 +205,9 @@ int ares_set_servers_ports(ares_channel channel,
if (!channel) if (!channel)
return ARES_ENODATA; return ARES_ENODATA;
if (!ares__is_list_empty(&channel->all_queries))
return ARES_ENOTIMP;
ares__destroy_servers_state(channel); ares__destroy_servers_state(channel);
for (srvr = servers; srvr; srvr = srvr->next) for (srvr = servers; srvr; srvr = srvr->next)
...@@ -258,8 +264,6 @@ static int set_servers_csv(ares_channel channel, ...@@ -258,8 +264,6 @@ static int set_servers_csv(ares_channel channel,
if (!channel) if (!channel)
return ARES_ENODATA; return ARES_ENODATA;
ares__destroy_servers_state(channel);
i = strlen(_csv); i = strlen(_csv);
if (i == 0) if (i == 0)
return ARES_SUCCESS; /* blank all servers */ return ARES_SUCCESS; /* blank all servers */
......
...@@ -52,6 +52,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, ...@@ -52,6 +52,7 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
int aliascnt = 0; int aliascnt = 0;
int alias_alloc = 8; int alias_alloc = 8;
char ** aliases; char ** aliases;
size_t rr_data_len;
/* Set *host to NULL for all failure cases. */ /* Set *host to NULL for all failure cases. */
*host = NULL; *host = NULL;
...@@ -124,14 +125,15 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, ...@@ -124,14 +125,15 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
if (hostname) if (hostname)
ares_free(hostname); ares_free(hostname);
hostname = rr_data; hostname = rr_data;
aliases[aliascnt] = ares_malloc((strlen(rr_data)+1) * sizeof(char)); rr_data_len = strlen(rr_data)+1;
aliases[aliascnt] = ares_malloc(rr_data_len * sizeof(char));
if (!aliases[aliascnt]) if (!aliases[aliascnt])
{ {
ares_free(rr_name); ares_free(rr_name);
status = ARES_ENOMEM; status = ARES_ENOMEM;
break; break;
} }
strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1); strncpy(aliases[aliascnt], rr_data, rr_data_len);
aliascnt++; aliascnt++;
if (aliascnt >= alias_alloc) { if (aliascnt >= alias_alloc) {
char **ptr; char **ptr;
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" #define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" #define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
#define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" #define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient"
#define WIN_NT_DNSCLIENT "Software\\Policies\\Microsoft\\Windows NT\\DNSClient"
#define NAMESERVER "NameServer" #define NAMESERVER "NameServer"
#define DHCPNAMESERVER "DhcpNameServer" #define DHCPNAMESERVER "DhcpNameServer"
#define DATABASEPATH "DatabasePath" #define DATABASEPATH "DatabasePath"
...@@ -100,6 +101,7 @@ ...@@ -100,6 +101,7 @@
#endif #endif
#include "ares_strdup.h" #include "ares_strdup.h"
#include "ares_strsplit.h"
#ifndef HAVE_STRCASECMP #ifndef HAVE_STRCASECMP
# include "ares_strcasecmp.h" # include "ares_strcasecmp.h"
...@@ -323,8 +325,14 @@ struct ares_channeldata { ...@@ -323,8 +325,14 @@ struct ares_channeldata {
const struct ares_socket_functions * sock_funcs; const struct ares_socket_functions * sock_funcs;
void *sock_func_cb_data; void *sock_func_cb_data;
/* Path for resolv.conf file, configurable via ares_options */
char *resolvconf_path;
}; };
/* Does the domain end in ".onion" or ".onion."? Case-insensitive. */
int ares__is_onion_domain(const char *name);
/* Memory management functions */ /* Memory management functions */
extern void *(*ares_malloc)(size_t size); extern void *(*ares_malloc)(size_t size);
extern void *(*ares_realloc)(void *ptr, size_t size); extern void *(*ares_realloc)(void *ptr, size_t size);
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include <assert.h> #include <assert.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h>
#include "ares.h" #include "ares.h"
#include "ares_dns.h" #include "ares_dns.h"
...@@ -871,8 +872,32 @@ void ares__send_query(ares_channel channel, struct query *query, ...@@ -871,8 +872,32 @@ void ares__send_query(ares_channel channel, struct query *query,
return; return;
} }
} }
timeplus = channel->timeout << (query->try_count / channel->nservers);
timeplus = (timeplus * (9 + (rand () & 7))) / 16; /* For each trip through the entire server list, double the channel's
* assigned timeout, avoiding overflow. If channel->timeout is negative,
* leave it as-is, even though that should be impossible here.
*/
timeplus = channel->timeout;
{
/* How many times do we want to double it? Presume sane values here. */
const int shift = query->try_count / channel->nservers;
/* Is there enough room to shift timeplus left that many times?
*
* To find out, confirm that all of the bits we'll shift away are zero.
* Stop considering a shift if we get to the point where we could shift
* a 1 into the sign bit (i.e. when shift is within two of the bit
* count).
*
* This has the side benefit of leaving negative numbers unchanged.
*/
if(shift <= (int)(sizeof(int) * CHAR_BIT - 1)
&& (timeplus >> (sizeof(int) * CHAR_BIT - 1 - shift)) == 0)
{
timeplus <<= shift;
}
}
query->timeout = *now; query->timeout = *now;
timeadd(&query->timeout, timeplus); timeadd(&query->timeout, timeplus);
/* Keep track of queries bucketed by timeout, so we can process /* Keep track of queries bucketed by timeout, so we can process
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
/* /*
* Verify that the size previously defined and expected for * Verify that the size previously defined and expected for
* ares_socklen_t is actually the the same as the one reported * ares_socklen_t is actually the same as the one reported
* by sizeof() at compile time. * by sizeof() at compile time.
*/ */
......
...@@ -54,6 +54,13 @@ void ares_search(ares_channel channel, const char *name, int dnsclass, ...@@ -54,6 +54,13 @@ void ares_search(ares_channel channel, const char *name, int dnsclass,
const char *p; const char *p;
int status, ndots; int status, ndots;
/* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
if (ares__is_onion_domain(name))
{
callback(arg, ARES_ENOTFOUND, 0, NULL, 0);
return;
}
/* If name only yields one domain to search, then we don't have /* If name only yields one domain to search, then we don't have
* to keep extra state, so just do an ares_query(). * to keep extra state, so just do an ares_query().
*/ */
......
...@@ -60,6 +60,12 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, ...@@ -60,6 +60,12 @@ void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
callback(arg, ARES_ENOMEM, 0, NULL, 0); callback(arg, ARES_ENOMEM, 0, NULL, 0);
return; return;
} }
if (channel->nservers < 1)
{
ares_free(query);
callback(arg, ARES_ESERVFAIL, 0, NULL, 0);
return;
}
query->server_info = ares_malloc(channel->nservers * query->server_info = ares_malloc(channel->nservers *
sizeof(query->server_info[0])); sizeof(query->server_info[0]));
if (!query->server_info) if (!query->server_info)
......
/* Copyright (C) 2018 by John Schember <john@nachtimwald.com>
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include "ares_strsplit.h"
#include "ares.h"
#include "ares_private.h"
static int list_contains(char * const *list, size_t num_elem, const char *str, int insensitive)
{
size_t len;
size_t i;
len = strlen(str);
for (i=0; i<num_elem; i++)
{
if (insensitive)
{
#ifdef WIN32
if (strnicmp(list[i], str, len) == 0)
#else
if (strncasecmp(list[i], str, len) == 0)
#endif
return 1;
}
else
{
if (strncmp(list[i], str, len) == 0)
return 1;
}
}
return 0;
}
static int is_delim(char c, const char *delims, size_t num_delims)
{
size_t i;
for (i=0; i<num_delims; i++)
{
if (c == delims[i])
return 1;
}
return 0;
}
void ares_strsplit_free(char **elms, size_t num_elm)
{
size_t i;
if (elms == NULL)
return;
for (i=0; i<num_elm; i++)
ares_free(elms[i]);
ares_free(elms);
}
char **ares_strsplit(const char *in, const char *delms, int make_set, size_t *num_elm)
{
char *parsestr;
char **temp;
char **out;
size_t cnt;
size_t nelms;
size_t in_len;
size_t num_delims;
size_t i;
if (in == NULL || delms == NULL || num_elm == NULL)
return NULL;
*num_elm = 0;
in_len = strlen(in);
num_delims = strlen(delms);
/* Figure out how many elements. */
nelms = 1;
for (i=0; i<in_len; i++)
{
if (is_delim(in[i], delms, num_delims))
{
nelms++;
}
}
/* Copy of input so we can cut it up. */
parsestr = ares_strdup(in);
if (parsestr == NULL)
return NULL;
/* Temporary array to store locations of start of each element
* within parsestr. */
temp = ares_malloc(nelms * sizeof(*temp));
if (temp == NULL)
{
ares_free(parsestr);
return NULL;
}
temp[0] = parsestr;
cnt = 1;
for (i=0; i<in_len && cnt<nelms; i++)
{
if (!is_delim(parsestr[i], delms, num_delims))
continue;
/* Replace sep with NULL. */
parsestr[i] = '\0';
/* Add the pointer to the array of elements */
temp[cnt] = parsestr+i+1;
cnt++;
}
/* Copy each element to our output array. */
out = ares_malloc(nelms * sizeof(*out));
if (out == NULL)
{
ares_free(parsestr);
ares_free(temp);
return NULL;
}
nelms = 0;
for (i=0; i<cnt; i++)
{
if (temp[i][0] == '\0')
continue;
if (make_set && list_contains(out, nelms, temp[i], 1))
continue;
out[nelms] = ares_strdup(temp[i]);
if (out[nelms] == NULL)
{
ares_strsplit_free(out, nelms);
ares_free(parsestr);
ares_free(temp);
return NULL;
}
nelms++;
}
/* If there are no elements don't return an empty allocated
* array. */
if (nelms == 0)
{
ares_strsplit_free(out, nelms);
out = NULL;
}
/* Get the true number of elements (recalculated because of make_set) */
*num_elm = nelms;
ares_free(parsestr);
ares_free(temp);
return out;
}
#ifndef HEADER_CARES_STRSPLIT_H
#define HEADER_CARES_STRSPLIT_H
/* Copyright (C) 2018 by John Schember <john@nachtimwald.com>
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
/* Split a string on delem skipping empty elements.
*
* param in String to split.
* param delims String of characters to treat as a delimitor.
* Each character in the string is a delimitor so
* there can be multiple delimitors to split on.
* E.g. ", " will split on all comma's and spaces.
* param make_set Have the list be a Set where there are no
* duplicate entries. 1 for true, 0 or false.
* param num_elm Return parameter of the number of elements
* in the result array.
*
* returns an allocated array of allocated string elements.
*
*/
char **ares_strsplit(const char *in, const char *delms, int make_set, size_t *num_elm);
/* Frees the result returned from ares_strsplit(). */
void ares_strsplit_free(char **elms, size_t num_elm);
#endif /* HEADER_CARES_STRSPLIT_H */
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
#define ARES_COPYRIGHT "2004 - 2017 Daniel Stenberg, <daniel@haxx.se>." #define ARES_COPYRIGHT "2004 - 2017 Daniel Stenberg, <daniel@haxx.se>."
#define ARES_VERSION_MAJOR 1 #define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 14 #define ARES_VERSION_MINOR 15
#define ARES_VERSION_PATCH 0 #define ARES_VERSION_PATCH 0
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH)) (ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.14.0" #define ARES_VERSION_STR "1.15.0"
#if (ARES_VERSION >= 0x010700) #if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1 # define CARES_HAVE_ARES_LIBRARY_INIT 1
......
#! /bin/sh #! /bin/sh
# Wrapper for compilers which do not understand '-c -o'. # Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>. # Written by Tom Tromey <tromey@cygnus.com>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
...@@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC ...@@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
...@@ -255,7 +255,8 @@ EOF ...@@ -255,7 +255,8 @@ EOF
echo "compile $scriptversion" echo "compile $scriptversion"
exit $? exit $?
;; ;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
func_cl_wrapper "$@" # Doesn't return... func_cl_wrapper "$@" # Doesn't return...
;; ;;
esac esac
...@@ -339,9 +340,9 @@ exit $ret ...@@ -339,9 +340,9 @@ exit $ret
# Local Variables: # Local Variables:
# mode: shell-script # mode: shell-script
# sh-indentation: 2 # sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC" # time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:
File mode changed from 100644 to 100755
This diff is collapsed.
AC_PREREQ(2.57) AC_PREREQ(2.57)
AC_INIT([c-ares], [1.14.0], AC_INIT([c-ares], [1.15.0],
[c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares]) [c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares])
XC_OVR_ZZ50 XC_OVR_ZZ50
......
#! /bin/sh #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects # depcomp - compile a program generating dependencies as side-effects
scriptversion=2016-01-11.22; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2017 Free Software Foundation, Inc. # Copyright (C) 1999-2018 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC ...@@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
...@@ -783,7 +783,7 @@ exit 0 ...@@ -783,7 +783,7 @@ exit 0
# Local Variables: # Local Variables:
# mode: shell-script # mode: shell-script
# sh-indentation: 2 # sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0" # time-stamp-time-zone: "UTC0"
......
...@@ -180,8 +180,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size) ...@@ -180,8 +180,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
tp += sprintf(tp, "%x", words[i]); tp += sprintf(tp, "%x", words[i]);
} }
/* Was it a trailing run of 0x00's? */ /* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) == if (best.base != -1 && (best.base + best.len) == (NS_IN6ADDRSZ / NS_INT16SZ))
(NS_IN6ADDRSZ / NS_INT16SZ))
*tp++ = ':'; *tp++ = ':';
*tp++ = '\0'; *tp++ = '\0';
......
This diff is collapsed.
...@@ -4063,7 +4063,8 @@ _LT_EOF ...@@ -4063,7 +4063,8 @@ _LT_EOF
if AC_TRY_EVAL(ac_compile); then if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols. # Now try to grab the symbols.
nlist=conftest.nm nlist=conftest.nm
if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD
if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then
# Try sorting and uniquifying the output. # Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist" mv -f "$nlist"T "$nlist"
...@@ -6438,7 +6439,7 @@ if test yes != "$_lt_caught_CXX_error"; then ...@@ -6438,7 +6439,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists # Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when # what "hidden" libraries, object files and flags are used when
# linking a shared library. # linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else else
GXX=no GXX=no
...@@ -6813,7 +6814,7 @@ if test yes != "$_lt_caught_CXX_error"; then ...@@ -6813,7 +6814,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# explicitly linking system object files so we need to strip them # explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library # from the output so that they don't get included in the library
# dependencies. # dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;; ;;
*) *)
if test yes = "$GXX"; then if test yes = "$GXX"; then
...@@ -6878,7 +6879,7 @@ if test yes != "$_lt_caught_CXX_error"; then ...@@ -6878,7 +6879,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# explicitly linking system object files so we need to strip them # explicitly linking system object files so we need to strip them
# from the output so that they don't get included in the library # from the output so that they don't get included in the library
# dependencies. # dependencies.
output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
;; ;;
*) *)
if test yes = "$GXX"; then if test yes = "$GXX"; then
...@@ -7217,7 +7218,7 @@ if test yes != "$_lt_caught_CXX_error"; then ...@@ -7217,7 +7218,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists # Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when # what "hidden" libraries, object files and flags are used when
# linking a shared library. # linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else else
# FIXME: insert proper C++ library support # FIXME: insert proper C++ library support
...@@ -7301,7 +7302,7 @@ if test yes != "$_lt_caught_CXX_error"; then ...@@ -7301,7 +7302,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists # Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when # what "hidden" libraries, object files and flags are used when
# linking a shared library. # linking a shared library.
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
else else
# g++ 2.7 appears to require '-G' NOT '-shared' on this # g++ 2.7 appears to require '-G' NOT '-shared' on this
# platform. # platform.
...@@ -7312,7 +7313,7 @@ if test yes != "$_lt_caught_CXX_error"; then ...@@ -7312,7 +7313,7 @@ if test yes != "$_lt_caught_CXX_error"; then
# Commands to make compiler produce verbose output that lists # Commands to make compiler produce verbose output that lists
# what "hidden" libraries, object files and flags are used when # what "hidden" libraries, object files and flags are used when
# linking a shared library. # linking a shared library.
output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
fi fi
_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
......
#! /bin/sh #! /bin/sh
# Common wrapper for a few potentially missing GNU programs. # Common wrapper for a few potentially missing GNU programs.
scriptversion=2013-10-28.13; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2014 Free Software Foundation, Inc. # Copyright (C) 1996-2018 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
...@@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC ...@@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
...@@ -101,9 +101,9 @@ else ...@@ -101,9 +101,9 @@ else
exit $st exit $st
fi fi
perl_URL=http://www.perl.org/ perl_URL=https://www.perl.org/
flex_URL=http://flex.sourceforge.net/ flex_URL=https://github.com/westes/flex
gnu_software_URL=http://www.gnu.org/software gnu_software_URL=https://www.gnu.org/software
program_details () program_details ()
{ {
...@@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \ ...@@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \
exit $st exit $st
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC" # time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC" # time-stamp-end: "; # UTC"
# End: # End:
diff --git a/deps/c-ares/Makefile.in b/deps/c-ares/Makefile.in
index 28d12c03..b6e9d95d 100644
--- a/deps/c-ares/Makefile.in
+++ b/deps/c-ares/Makefile.in
@@ -731,61 +731,7 @@ HHEADERS = ares.h \
ares_setup.h \
setup_once.h
-MANPAGES = ares_cancel.3 \
- ares_create_query.3 \
- ares_destroy.3 \
- ares_destroy_options.3 \
- ares_dup.3 \
- ares_expand_name.3 \
- ares_expand_string.3 \
- ares_fds.3 \
- ares_free_data.3 \
- ares_free_hostent.3 \
- ares_free_string.3 \
- ares_get_servers.3 \
- ares_get_servers_ports.3 \
- ares_gethostbyaddr.3 \
- ares_gethostbyname.3 \
- ares_gethostbyname_file.3 \
- ares_getnameinfo.3 \
- ares_getsock.3 \
- ares_inet_ntop.3 \
- ares_inet_pton.3 \
- ares_init.3 \
- ares_init_options.3 \
- ares_library_cleanup.3 \
- ares_library_init.3 \
- ares_library_init_android.3 \
- ares_library_initialized.3 \
- ares_mkquery.3 \
- ares_parse_a_reply.3 \
- ares_parse_aaaa_reply.3 \
- ares_parse_mx_reply.3 \
- ares_parse_naptr_reply.3 \
- ares_parse_ns_reply.3 \
- ares_parse_ptr_reply.3 \
- ares_parse_soa_reply.3 \
- ares_parse_srv_reply.3 \
- ares_parse_txt_reply.3 \
- ares_process.3 \
- ares_query.3 \
- ares_save_options.3 \
- ares_search.3 \
- ares_send.3 \
- ares_set_local_dev.3 \
- ares_set_local_ip4.3 \
- ares_set_local_ip6.3 \
- ares_set_servers.3 \
- ares_set_servers_csv.3 \
- ares_set_servers_ports.3 \
- ares_set_servers_ports_csv.3 \
- ares_set_socket_callback.3 \
- ares_set_socket_configure_callback.3 \
- ares_set_socket_functions.3 \
- ares_set_sortlist.3 \
- ares_strerror.3 \
- ares_timeout.3 \
- ares_version.3
+MANPAGES =
HTMLPAGES = ares_cancel.html \
ares_create_query.html \
diff --git a/deps/c-ares/Makefile.inc b/deps/c-ares/Makefile.inc
index 30e00461..d2701c83 100644
--- a/deps/c-ares/Makefile.inc
+++ b/deps/c-ares/Makefile.inc
@@ -75,61 +75,7 @@ HHEADERS = ares.h \
ares_setup.h \
setup_once.h
-MANPAGES = ares_cancel.3 \
- ares_create_query.3 \
- ares_destroy.3 \
- ares_destroy_options.3 \
- ares_dup.3 \
- ares_expand_name.3 \
- ares_expand_string.3 \
- ares_fds.3 \
- ares_free_data.3 \
- ares_free_hostent.3 \
- ares_free_string.3 \
- ares_get_servers.3 \
- ares_get_servers_ports.3 \
- ares_gethostbyaddr.3 \
- ares_gethostbyname.3 \
- ares_gethostbyname_file.3 \
- ares_getnameinfo.3 \
- ares_getsock.3 \
- ares_inet_ntop.3 \
- ares_inet_pton.3 \
- ares_init.3 \
- ares_init_options.3 \
- ares_library_cleanup.3 \
- ares_library_init.3 \
- ares_library_init_android.3 \
- ares_library_initialized.3 \
- ares_mkquery.3 \
- ares_parse_a_reply.3 \
- ares_parse_aaaa_reply.3 \
- ares_parse_mx_reply.3 \
- ares_parse_naptr_reply.3 \
- ares_parse_ns_reply.3 \
- ares_parse_ptr_reply.3 \
- ares_parse_soa_reply.3 \
- ares_parse_srv_reply.3 \
- ares_parse_txt_reply.3 \
- ares_process.3 \
- ares_query.3 \
- ares_save_options.3 \
- ares_search.3 \
- ares_send.3 \
- ares_set_local_dev.3 \
- ares_set_local_ip4.3 \
- ares_set_local_ip6.3 \
- ares_set_servers.3 \
- ares_set_servers_csv.3 \
- ares_set_servers_ports.3 \
- ares_set_servers_ports_csv.3 \
- ares_set_socket_callback.3 \
- ares_set_socket_configure_callback.3 \
- ares_set_socket_functions.3 \
- ares_set_sortlist.3 \
- ares_strerror.3 \
- ares_timeout.3 \
- ares_version.3
+MANPAGES =
HTMLPAGES = ares_cancel.html \
ares_create_query.html \
diff --git a/deps/c-ares/ares_gethostbyname.c b/deps/c-ares/ares_gethostbyname.c
index 8187746b..fb73826b 100644
--- a/deps/c-ares/ares_gethostbyname.c
+++ b/deps/c-ares/ares_gethostbyname.c
@@ -346,10 +346,6 @@ static int file_lookup(const char *name, int family, struct hostent **host)
int status;
int error;
- /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
- if (ares__is_onion_domain(name))
- return ARES_ENOTFOUND;
-
#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
win_platform platform;
@@ -387,6 +383,10 @@ static int file_lookup(const char *name, int family, struct hostent **host)
return ARES_ENOTFOUND;
#endif
+ /* Per RFC 7686, reject queries for ".onion" domain names with NXDOMAIN. */
+ if (ares__is_onion_domain(name))
+ return ARES_ENOTFOUND;
+
fp = fopen(PATH_HOSTS, "r");
if (!fp)
{
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment