From 58d477a055ab9880fd81513b26ab257d991126ab Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Fri, 28 Oct 2016 14:40:47 +1100 Subject: [PATCH 1/7] debs: upgrade to c-ares v1.12.0 Updated with manual config for Android Updated with automatic for sunos, *bsd, darwin, linux, aix PR-URL: https://github.com/nodejs/node/pull/15378 --- deps/cares/LICENSE.md | 15 +++ deps/cares/cares.gyp | 1 + deps/cares/config/aix/ares_config.h | 79 +++++------- deps/cares/config/android/ares_config.h | 88 ++++++------- deps/cares/config/darwin/ares_config.h | 78 +++++------ deps/cares/config/freebsd/ares_config.h | 84 ++++++------ deps/cares/config/linux/ares_config.h | 88 ++++++------- deps/cares/config/netbsd/ares_config.h | 82 ++++++------ deps/cares/config/openbsd/ares_config.h | 82 ++++++------ deps/cares/config/sunos/ares_config.h | 78 +++++------ deps/cares/get_ver.awk | 27 ++++ deps/cares/include/ares.h | 1 + deps/cares/include/ares_build.h | 165 +++++++++++++++++------- deps/cares/include/ares_rules.h | 7 +- deps/cares/include/ares_version.h | 8 +- deps/cares/src/AUTHORS | 24 ++++ deps/cares/src/README.cares | 18 +-- deps/cares/src/RELEASE-NOTES | 63 +++++---- deps/cares/src/ares_getnameinfo.c | 1 + deps/cares/src/ares_init.c | 58 ++++----- deps/cares/src/ares_ipv6.h | 6 +- deps/cares/src/ares_library_init.c | 3 +- deps/cares/src/ares_nowarn.c | 46 ++----- deps/cares/src/ares_process.c | 3 +- deps/cares/src/ares_setup.h | 4 - deps/cares/src/config-win32.h | 18 +-- 26 files changed, 579 insertions(+), 548 deletions(-) create mode 100644 deps/cares/LICENSE.md create mode 100644 deps/cares/get_ver.awk diff --git a/deps/cares/LICENSE.md b/deps/cares/LICENSE.md new file mode 100644 index 00000000000000..86b520b91d3705 --- /dev/null +++ b/deps/cares/LICENSE.md @@ -0,0 +1,15 @@ +# c-ares license + +Copyright (c) 2007 - 2016, Daniel Stenberg with many contributors, see AUTHORS +file. + +Copyright 1998 by the Massachusetts Institute of Technology. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that +the above copyright notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting documentation, and that +the name of M.I.T. not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior permission. +M.I.T. makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. diff --git a/deps/cares/cares.gyp b/deps/cares/cares.gyp index 158cef39b514a9..03ae185fcce85a 100644 --- a/deps/cares/cares.gyp +++ b/deps/cares/cares.gyp @@ -111,6 +111,7 @@ 'defines': [ 'CARES_BUILDING_LIBRARY' ] }], [ 'OS=="win"', { + 'defines': [ 'CARES_PULL_WS2TCPIP_H=1' ], 'include_dirs': [ 'config/win32' ], 'sources': [ 'src/config-win32.h', diff --git a/deps/cares/config/aix/ares_config.h b/deps/cares/config/aix/ares_config.h index 9e61d37bd84fe5..62235e3e1e25b5 100644 --- a/deps/cares/config/aix/ares_config.h +++ b/deps/cares/config/aix/ares_config.h @@ -10,21 +10,24 @@ /* when building as static part of libcurl */ /* #undef BUILDING_LIBCURL */ -/* when building c-ares library */ -/* #undef CARES_BUILDING_LIBRARY */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ -/* when not building a shared library */ -/* #undef CARES_STATICLIB */ - -/* Define to 1 to enable hiding of library internal symbols. */ -#define CARES_SYMBOL_HIDING 1 +/* Defined for build with symbol hiding. */ +/* #undef CARES_SYMBOL_HIDING */ /* Definition to make a library symbol externally visible. */ -#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((visibility ("default"))) +/* #undef CARES_SYMBOL_SCOPE_EXTERN */ + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 size_t + /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const @@ -79,6 +82,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 header file. */ #define HAVE_DLFCN_H 1 @@ -103,6 +109,9 @@ /* Define to 1 if the getaddrinfo function is threadsafe. */ #define HAVE_GETADDRINFO_THREADSAFE 1 +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -124,11 +133,8 @@ /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 -/* Define to 1 if you have the `inet_net_pton' function. */ -#define HAVE_INET_NET_PTON 1 - -/* Define to 1 if inet_net_pton supports IPv6. */ -/* #undef HAVE_INET_NET_PTON_IPV6 */ +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ +/* #undef HAVE_INET_NET_PTON */ /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ #define HAVE_INET_NTOP 1 @@ -329,13 +335,9 @@ /* 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 to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 1 if you are building a native Windows target. */ -/* #undef NATIVE_WINDOWS */ - /* Define to 1 if you need the malloc.h header file even with stdlib.h */ /* #undef NEED_MALLOC_H */ @@ -348,23 +350,20 @@ /* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ #define NEED_THREAD_SAFE 1 -/* 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 "rs6000-ibm-aix" +#define OS "powerpc-ibm-aix6.1.9.0" /* Name of package */ #define PACKAGE "c-ares" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares" +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" /* Define to the full name of this package. */ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.12.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,11 +372,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.12.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -444,24 +446,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 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* 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 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 - /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -472,7 +456,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.7.1" +#define VERSION "1.12.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ @@ -494,6 +478,11 @@ # define _ALL_SOURCE 1 #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ @@ -511,5 +500,3 @@ /* the signed version of size_t */ /* #undef ssize_t */ - -#define HAVE_GETENV 1 diff --git a/deps/cares/config/android/ares_config.h b/deps/cares/config/android/ares_config.h index 9e6ef3cade6803..0a7bc7acd277bd 100644 --- a/deps/cares/config/android/ares_config.h +++ b/deps/cares/config/android/ares_config.h @@ -10,21 +10,24 @@ /* when building as static part of libcurl */ /* #undef BUILDING_LIBCURL */ -/* when building c-ares library */ -/* #undef CARES_BUILDING_LIBRARY */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ -/* when not building a shared library */ -/* #undef CARES_STATICLIB */ - -/* Define to 1 to enable hiding of library internal symbols. */ +/* 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"))) +#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((__visibility__ ("default"))) + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 size_t + /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const @@ -35,10 +38,10 @@ #define GETNAMEINFO_TYPE_ARG2 socklen_t /* Define to the type of args 4 and 6 for getnameinfo. */ -#define GETNAMEINFO_TYPE_ARG46 size_t +#define GETNAMEINFO_TYPE_ARG46 socklen_t /* Define to the type of arg 7 for getnameinfo. */ -#define GETNAMEINFO_TYPE_ARG7 unsigned int +#define GETNAMEINFO_TYPE_ARG7 int /* Specifies the number of arguments to getservbyport_r */ #define GETSERVBYPORT_R_ARGS 6 @@ -79,6 +82,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 header file. */ #define HAVE_DLFCN_H 1 @@ -103,6 +109,9 @@ /* Define to 1 if the getaddrinfo function is threadsafe. */ #define HAVE_GETADDRINFO_THREADSAFE 1 +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -124,12 +133,9 @@ /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 -/* Define to 1 if you have the `inet_net_pton' function. */ +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ /* #undef HAVE_INET_NET_PTON */ -/* Define to 1 if inet_net_pton supports IPv6. */ -/* #undef HAVE_INET_NET_PTON_IPV6 */ - /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ #define HAVE_INET_NTOP 1 @@ -329,13 +335,9 @@ /* 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 to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 1 if you are building a native Windows target. */ -/* #undef NATIVE_WINDOWS */ - /* Define to 1 if you need the malloc.h header file even with stdlib.h */ /* #undef NEED_MALLOC_H */ @@ -348,9 +350,6 @@ /* 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 "i686-pc-linux-gnu" @@ -358,13 +357,13 @@ #define PACKAGE "c-ares" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares" +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" /* Define to the full name of this package. */ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.12.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,11 +372,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.12.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -406,7 +408,7 @@ /* #undef RECVFROM_TYPE_ARG6_IS_VOID */ /* Define to the function return type for recvfrom. */ -#define RECVFROM_TYPE_RETV int +#define RECVFROM_TYPE_RETV ssize_t /* Define to the type of arg 1 for recv. */ #define RECV_TYPE_ARG1 int @@ -421,7 +423,7 @@ #define RECV_TYPE_ARG4 int /* Define to the function return type for recv. */ -#define RECV_TYPE_RETV int +#define RECV_TYPE_RETV ssize_t /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -442,25 +444,7 @@ #define SEND_TYPE_ARG4 int /* Define to the function return type for send. */ -#define SEND_TYPE_RETV int - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* 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 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 +#define SEND_TYPE_RETV ssize_t /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -472,7 +456,10 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.7.1" +#define VERSION "1.12.0" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ @@ -491,8 +478,13 @@ /* # undef _ALL_SOURCE */ #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ -#define _FILE_OFFSET_BITS 64 +/* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ @@ -508,5 +500,3 @@ /* the signed version of size_t */ /* #undef ssize_t */ - -#define HAVE_GETENV 1 diff --git a/deps/cares/config/darwin/ares_config.h b/deps/cares/config/darwin/ares_config.h index 920d922c81c155..36b8b7a7177072 100644 --- a/deps/cares/config/darwin/ares_config.h +++ b/deps/cares/config/darwin/ares_config.h @@ -10,21 +10,24 @@ /* when building as static part of libcurl */ /* #undef BUILDING_LIBCURL */ -/* when building c-ares library */ -/* #undef CARES_BUILDING_LIBRARY */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ -/* when not building a shared library */ -/* #undef CARES_STATICLIB */ - -/* Define to 1 to enable hiding of library internal symbols. */ +/* 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"))) +#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((__visibility__ ("default"))) + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 size_t + /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const @@ -79,6 +82,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 header file. */ #define HAVE_DLFCN_H 1 @@ -103,6 +109,9 @@ /* Define to 1 if the getaddrinfo function is threadsafe. */ #define HAVE_GETADDRINFO_THREADSAFE 1 +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -124,12 +133,9 @@ /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 -/* Define to 1 if you have the `inet_net_pton' function. */ +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ #define HAVE_INET_NET_PTON 1 -/* Define to 1 if inet_net_pton supports IPv6. */ -#define HAVE_INET_NET_PTON_IPV6 1 - /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ #define HAVE_INET_NTOP 1 @@ -329,13 +335,9 @@ /* 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 to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 1 if you are building a native Windows target. */ -/* #undef NATIVE_WINDOWS */ - /* Define to 1 if you need the malloc.h header file even with stdlib.h */ /* #undef NEED_MALLOC_H */ @@ -348,23 +350,20 @@ /* 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 "i386-apple-darwin9.8.0" +#define OS "x86_64-apple-darwin14.5.0" /* Name of package */ #define PACKAGE "c-ares" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares" +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" /* Define to the full name of this package. */ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.12.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,11 +372,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.12.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -444,24 +446,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 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* 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 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 - /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -472,7 +456,10 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.7.1" +#define VERSION "1.12.0" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ @@ -491,6 +478,11 @@ /* # undef _ALL_SOURCE */ #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ @@ -508,5 +500,3 @@ /* the signed version of size_t */ /* #undef ssize_t */ - -#define HAVE_GETENV 1 diff --git a/deps/cares/config/freebsd/ares_config.h b/deps/cares/config/freebsd/ares_config.h index 2f9b75d02c254f..562ea225d1820c 100644 --- a/deps/cares/config/freebsd/ares_config.h +++ b/deps/cares/config/freebsd/ares_config.h @@ -10,21 +10,24 @@ /* when building as static part of libcurl */ /* #undef BUILDING_LIBCURL */ -/* when building c-ares library */ -/* #undef CARES_BUILDING_LIBRARY */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ -/* when not building a shared library */ -/* #undef CARES_STATICLIB */ - -/* Define to 1 to enable hiding of library internal symbols. */ +/* 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"))) +#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((__visibility__ ("default"))) + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 size_t + /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const @@ -79,6 +82,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 header file. */ #define HAVE_DLFCN_H 1 @@ -103,6 +109,9 @@ /* Define to 1 if the getaddrinfo function is threadsafe. */ #define HAVE_GETADDRINFO_THREADSAFE 1 +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -124,12 +133,9 @@ /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 -/* Define to 1 if you have the `inet_net_pton' function. */ +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ #define HAVE_INET_NET_PTON 1 -/* Define to 1 if inet_net_pton supports IPv6. */ -/* #undef HAVE_INET_NET_PTON_IPV6 */ - /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ #define HAVE_INET_NTOP 1 @@ -329,13 +335,9 @@ /* 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 to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 1 if you are building a native Windows target. */ -/* #undef NATIVE_WINDOWS */ - /* Define to 1 if you need the malloc.h header file even with stdlib.h */ /* #undef NEED_MALLOC_H */ @@ -348,23 +350,20 @@ /* 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 "i386-portbld-freebsd8.0" +#define OS "x86_64-unknown-freebsd10.3" /* Name of package */ #define PACKAGE "c-ares" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares" +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" /* Define to the full name of this package. */ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.12.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,11 +372,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.12.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -406,7 +408,7 @@ /* #undef RECVFROM_TYPE_ARG6_IS_VOID */ /* Define to the function return type for recvfrom. */ -#define RECVFROM_TYPE_RETV int +#define RECVFROM_TYPE_RETV ssize_t /* Define to the type of arg 1 for recv. */ #define RECV_TYPE_ARG1 int @@ -421,7 +423,7 @@ #define RECV_TYPE_ARG4 int /* Define to the function return type for recv. */ -#define RECV_TYPE_RETV int +#define RECV_TYPE_RETV ssize_t /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -442,25 +444,7 @@ #define SEND_TYPE_ARG4 int /* Define to the function return type for send. */ -#define SEND_TYPE_RETV int - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* 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 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 +#define SEND_TYPE_RETV ssize_t /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -472,7 +456,10 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.7.1" +#define VERSION "1.12.0" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ @@ -491,6 +478,11 @@ /* # undef _ALL_SOURCE */ #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ @@ -508,5 +500,3 @@ /* the signed version of size_t */ /* #undef ssize_t */ - -#define HAVE_GETENV 1 diff --git a/deps/cares/config/linux/ares_config.h b/deps/cares/config/linux/ares_config.h index 8f8e3307434962..99a6e9a452b4cd 100644 --- a/deps/cares/config/linux/ares_config.h +++ b/deps/cares/config/linux/ares_config.h @@ -10,21 +10,24 @@ /* when building as static part of libcurl */ /* #undef BUILDING_LIBCURL */ -/* when building c-ares library */ -/* #undef CARES_BUILDING_LIBRARY */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ -/* when not building a shared library */ -/* #undef CARES_STATICLIB */ - -/* Define to 1 to enable hiding of library internal symbols. */ +/* 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"))) +#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((__visibility__ ("default"))) + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 size_t + /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const @@ -35,10 +38,10 @@ #define GETNAMEINFO_TYPE_ARG2 socklen_t /* Define to the type of args 4 and 6 for getnameinfo. */ -#define GETNAMEINFO_TYPE_ARG46 size_t +#define GETNAMEINFO_TYPE_ARG46 socklen_t /* Define to the type of arg 7 for getnameinfo. */ -#define GETNAMEINFO_TYPE_ARG7 unsigned int +#define GETNAMEINFO_TYPE_ARG7 int /* Specifies the number of arguments to getservbyport_r */ #define GETSERVBYPORT_R_ARGS 6 @@ -79,6 +82,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 header file. */ #define HAVE_DLFCN_H 1 @@ -103,6 +109,9 @@ /* Define to 1 if the getaddrinfo function is threadsafe. */ #define HAVE_GETADDRINFO_THREADSAFE 1 +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -124,12 +133,9 @@ /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 -/* Define to 1 if you have the `inet_net_pton' function. */ +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ /* #undef HAVE_INET_NET_PTON */ -/* Define to 1 if inet_net_pton supports IPv6. */ -/* #undef HAVE_INET_NET_PTON_IPV6 */ - /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ #define HAVE_INET_NTOP 1 @@ -329,13 +335,9 @@ /* 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 to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 1 if you are building a native Windows target. */ -/* #undef NATIVE_WINDOWS */ - /* Define to 1 if you need the malloc.h header file even with stdlib.h */ /* #undef NEED_MALLOC_H */ @@ -348,9 +350,6 @@ /* 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 "i686-pc-linux-gnu" @@ -358,13 +357,13 @@ #define PACKAGE "c-ares" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares" +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" /* Define to the full name of this package. */ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.12.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,11 +372,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.12.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -406,7 +408,7 @@ /* #undef RECVFROM_TYPE_ARG6_IS_VOID */ /* Define to the function return type for recvfrom. */ -#define RECVFROM_TYPE_RETV int +#define RECVFROM_TYPE_RETV ssize_t /* Define to the type of arg 1 for recv. */ #define RECV_TYPE_ARG1 int @@ -421,7 +423,7 @@ #define RECV_TYPE_ARG4 int /* Define to the function return type for recv. */ -#define RECV_TYPE_RETV int +#define RECV_TYPE_RETV ssize_t /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -442,25 +444,7 @@ #define SEND_TYPE_ARG4 int /* Define to the function return type for send. */ -#define SEND_TYPE_RETV int - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* 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 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 +#define SEND_TYPE_RETV ssize_t /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -472,7 +456,10 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.7.1" +#define VERSION "1.12.0" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ @@ -491,8 +478,13 @@ /* # undef _ALL_SOURCE */ #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ -#define _FILE_OFFSET_BITS 64 +/* #undef _FILE_OFFSET_BITS */ /* Define for large files, on AIX-style hosts. */ /* #undef _LARGE_FILES */ @@ -508,5 +500,3 @@ /* the signed version of size_t */ /* #undef ssize_t */ - -#define HAVE_GETENV 1 diff --git a/deps/cares/config/netbsd/ares_config.h b/deps/cares/config/netbsd/ares_config.h index b5891486553d7b..b724f37d2baf45 100644 --- a/deps/cares/config/netbsd/ares_config.h +++ b/deps/cares/config/netbsd/ares_config.h @@ -10,21 +10,24 @@ /* when building as static part of libcurl */ /* #undef BUILDING_LIBCURL */ -/* when building c-ares library */ -/* #undef CARES_BUILDING_LIBRARY */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ -/* when not building a shared library */ -/* #undef CARES_STATICLIB */ - -/* Define to 1 to enable hiding of library internal symbols. */ +/* Defined for build with symbol hiding. */ /* #undef CARES_SYMBOL_HIDING */ /* Definition to make a library symbol externally visible. */ /* #undef CARES_SYMBOL_SCOPE_EXTERN */ +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ + /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 size_t + /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const @@ -79,6 +82,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 header file. */ #define HAVE_DLFCN_H 1 @@ -103,6 +109,9 @@ /* Define to 1 if the getaddrinfo function is threadsafe. */ /* #undef HAVE_GETADDRINFO_THREADSAFE */ +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -124,12 +133,9 @@ /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 -/* Define to 1 if you have the `inet_net_pton' function. */ +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ #define HAVE_INET_NET_PTON 1 -/* Define to 1 if inet_net_pton supports IPv6. */ -/* #undef HAVE_INET_NET_PTON_IPV6 */ - /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ #define HAVE_INET_NTOP 1 @@ -329,13 +335,9 @@ /* 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 to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 1 if you are building a native Windows target. */ -/* #undef NATIVE_WINDOWS */ - /* Define to 1 if you need the malloc.h header file even with stdlib.h */ /* #undef NEED_MALLOC_H */ @@ -348,23 +350,20 @@ /* 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 "i386-unknown-openbsd4.7" +#define OS "x86_64-unknown-freebsd10.3" /* Name of package */ #define PACKAGE "c-ares" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares" +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" /* Define to the full name of this package. */ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.12.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,11 +372,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.12.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -406,7 +408,7 @@ /* #undef RECVFROM_TYPE_ARG6_IS_VOID */ /* Define to the function return type for recvfrom. */ -#define RECVFROM_TYPE_RETV int +#define RECVFROM_TYPE_RETV ssize_t /* Define to the type of arg 1 for recv. */ #define RECV_TYPE_ARG1 int @@ -421,7 +423,7 @@ #define RECV_TYPE_ARG4 int /* Define to the function return type for recv. */ -#define RECV_TYPE_RETV int +#define RECV_TYPE_RETV ssize_t /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -442,25 +444,7 @@ #define SEND_TYPE_ARG4 int /* Define to the function return type for send. */ -#define SEND_TYPE_RETV int - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* 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 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 +#define SEND_TYPE_RETV ssize_t /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -472,7 +456,10 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.7.1" +#define VERSION "1.12.0" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ @@ -491,6 +478,11 @@ /* # undef _ALL_SOURCE */ #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ @@ -508,5 +500,3 @@ /* the signed version of size_t */ /* #undef ssize_t */ - -#define HAVE_GETENV 1 diff --git a/deps/cares/config/openbsd/ares_config.h b/deps/cares/config/openbsd/ares_config.h index b5891486553d7b..b724f37d2baf45 100644 --- a/deps/cares/config/openbsd/ares_config.h +++ b/deps/cares/config/openbsd/ares_config.h @@ -10,21 +10,24 @@ /* when building as static part of libcurl */ /* #undef BUILDING_LIBCURL */ -/* when building c-ares library */ -/* #undef CARES_BUILDING_LIBRARY */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ -/* when not building a shared library */ -/* #undef CARES_STATICLIB */ - -/* Define to 1 to enable hiding of library internal symbols. */ +/* Defined for build with symbol hiding. */ /* #undef CARES_SYMBOL_HIDING */ /* Definition to make a library symbol externally visible. */ /* #undef CARES_SYMBOL_SCOPE_EXTERN */ +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ + /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 size_t + /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const @@ -79,6 +82,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 header file. */ #define HAVE_DLFCN_H 1 @@ -103,6 +109,9 @@ /* Define to 1 if the getaddrinfo function is threadsafe. */ /* #undef HAVE_GETADDRINFO_THREADSAFE */ +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -124,12 +133,9 @@ /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 -/* Define to 1 if you have the `inet_net_pton' function. */ +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ #define HAVE_INET_NET_PTON 1 -/* Define to 1 if inet_net_pton supports IPv6. */ -/* #undef HAVE_INET_NET_PTON_IPV6 */ - /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ #define HAVE_INET_NTOP 1 @@ -329,13 +335,9 @@ /* 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 to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 1 if you are building a native Windows target. */ -/* #undef NATIVE_WINDOWS */ - /* Define to 1 if you need the malloc.h header file even with stdlib.h */ /* #undef NEED_MALLOC_H */ @@ -348,23 +350,20 @@ /* 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 "i386-unknown-openbsd4.7" +#define OS "x86_64-unknown-freebsd10.3" /* Name of package */ #define PACKAGE "c-ares" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares" +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" /* Define to the full name of this package. */ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.12.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,11 +372,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.12.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -406,7 +408,7 @@ /* #undef RECVFROM_TYPE_ARG6_IS_VOID */ /* Define to the function return type for recvfrom. */ -#define RECVFROM_TYPE_RETV int +#define RECVFROM_TYPE_RETV ssize_t /* Define to the type of arg 1 for recv. */ #define RECV_TYPE_ARG1 int @@ -421,7 +423,7 @@ #define RECV_TYPE_ARG4 int /* Define to the function return type for recv. */ -#define RECV_TYPE_RETV int +#define RECV_TYPE_RETV ssize_t /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -442,25 +444,7 @@ #define SEND_TYPE_ARG4 int /* Define to the function return type for send. */ -#define SEND_TYPE_RETV int - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* 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 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 +#define SEND_TYPE_RETV ssize_t /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -472,7 +456,10 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.7.1" +#define VERSION "1.12.0" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ @@ -491,6 +478,11 @@ /* # undef _ALL_SOURCE */ #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ /* #undef _FILE_OFFSET_BITS */ @@ -508,5 +500,3 @@ /* the signed version of size_t */ /* #undef ssize_t */ - -#define HAVE_GETENV 1 diff --git a/deps/cares/config/sunos/ares_config.h b/deps/cares/config/sunos/ares_config.h index fb8565e15b61a7..00e4190fb10a5a 100644 --- a/deps/cares/config/sunos/ares_config.h +++ b/deps/cares/config/sunos/ares_config.h @@ -10,21 +10,24 @@ /* when building as static part of libcurl */ /* #undef BUILDING_LIBCURL */ -/* when building c-ares library */ -/* #undef CARES_BUILDING_LIBRARY */ +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ -/* when not building a shared library */ -/* #undef CARES_STATICLIB */ - -/* Define to 1 to enable hiding of library internal symbols. */ -/* #undef CARES_SYMBOL_HIDING */ +/* Defined for build with symbol hiding. */ +#define CARES_SYMBOL_HIDING 1 /* Definition to make a library symbol externally visible. */ -/* #undef CARES_SYMBOL_SCOPE_EXTERN */ +#define CARES_SYMBOL_SCOPE_EXTERN __attribute__ ((__visibility__ ("default"))) + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ /* if a /etc/inet dir is being used */ #define ETC_INET 1 +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 int + /* Define to the type qualifier of arg 1 for getnameinfo. */ #define GETNAMEINFO_QUAL_ARG1 const @@ -79,6 +82,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 header file. */ #define HAVE_DLFCN_H 1 @@ -103,6 +109,9 @@ /* Define to 1 if the getaddrinfo function is threadsafe. */ #define HAVE_GETADDRINFO_THREADSAFE 1 +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + /* Define to 1 if you have the gethostbyaddr function. */ #define HAVE_GETHOSTBYADDR 1 @@ -124,12 +133,9 @@ /* Define to 1 if you have the `if_indextoname' function. */ #define HAVE_IF_INDEXTONAME 1 -/* Define to 1 if you have the `inet_net_pton' function. */ +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ /* #undef HAVE_INET_NET_PTON */ -/* Define to 1 if inet_net_pton supports IPv6. */ -/* #undef HAVE_INET_NET_PTON_IPV6 */ - /* Define to 1 if you have a IPv6 capable working inet_ntop function. */ #define HAVE_INET_NTOP 1 @@ -329,13 +335,9 @@ /* 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 to the sub-directory where libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" -/* Define to 1 if you are building a native Windows target. */ -/* #undef NATIVE_WINDOWS */ - /* Define to 1 if you need the malloc.h header file even with stdlib.h */ /* #undef NEED_MALLOC_H */ @@ -348,9 +350,6 @@ /* 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 "i386-pc-solaris2.11" @@ -358,13 +357,13 @@ #define PACKAGE "c-ares" /* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "c-ares mailing list => http://cool.haxx.se/mailman/listinfo/c-ares" +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" /* Define to the full name of this package. */ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.12.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,11 +372,14 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.12.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + /* Define to the type of arg 1 for recvfrom. */ #define RECVFROM_TYPE_ARG1 int @@ -444,24 +446,6 @@ /* Define to the function return type for send. */ #define SEND_TYPE_RETV int -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* 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 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 - /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -472,7 +456,10 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.7.1" +#define VERSION "1.12.0" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ @@ -491,6 +478,11 @@ /* # undef _ALL_SOURCE */ #endif +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + /* Number of bits in a file offset, on hosts where this is settable. */ #define _FILE_OFFSET_BITS 64 @@ -508,5 +500,3 @@ /* the signed version of size_t */ /* #undef ssize_t */ - -#define HAVE_GETENV 1 diff --git a/deps/cares/get_ver.awk b/deps/cares/get_ver.awk new file mode 100644 index 00000000000000..5e3db6db99a96b --- /dev/null +++ b/deps/cares/get_ver.awk @@ -0,0 +1,27 @@ +# *************************************************************************** +# * Project: c-ares +# * +# *************************************************************************** +# awk script which fetches c-ares version number and string from input +# file and writes them to STDOUT. Here you can get an awk version for Win32: +# http://www.gknw.net/development/prgtools/awk-20100523.zip +# +BEGIN { + while ((getline < ARGV[1]) > 0) { + sub("\r", "") # make MSYS gawk work with CRLF header input. + if (match ($0, /^#define ARES_COPYRIGHT "[^"]+"$/)) + copyright_string = substr($0, 25, length($0)-25) + else if (match ($0, /^#define ARES_VERSION_STR "[^"]+"$/)) + version_string = substr($3, 2, length($3)-2) + else if (match ($0, /^#define ARES_VERSION_MAJOR [0-9]+$/)) + version_major = $3 + else if (match ($0, /^#define ARES_VERSION_MINOR [0-9]+$/)) + version_minor = $3 + else if (match ($0, /^#define ARES_VERSION_PATCH [0-9]+$/)) + version_patch = $3 + } + print "LIBCARES_VERSION = " version_major "," version_minor "," version_patch + print "LIBCARES_VERSION_STR = " version_string + print "LIBCARES_COPYRIGHT_STR = " copyright_string +} + diff --git a/deps/cares/include/ares.h b/deps/cares/include/ares.h index c23ea3e2e0ad27..8c80f0740bebce 100644 --- a/deps/cares/include/ares.h +++ b/deps/cares/include/ares.h @@ -158,6 +158,7 @@ extern "C" { #define ARES_OPT_TIMEOUTMS (1 << 13) #define ARES_OPT_ROTATE (1 << 14) #define ARES_OPT_EDNSPSZ (1 << 15) +#define ARES_OPT_NOROTATE (1 << 16) /* Nameinfo flag values */ #define ARES_NI_NOFQDN (1 << 0) diff --git a/deps/cares/include/ares_build.h b/deps/cares/include/ares_build.h index 199eae8b8e9978..9a865e34492758 100644 --- a/deps/cares/include/ares_build.h +++ b/deps/cares/include/ares_build.h @@ -1,9 +1,8 @@ -/* 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 +/* 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 @@ -20,6 +19,20 @@ /* 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: * ------- @@ -31,87 +44,151 @@ * 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.in or ares_build.h, - * this is due to the following reason: + * 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_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 # 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 -#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 CONFIGURE CAPABLE SYSTEMS ONLY */ +/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE 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. */ +#if defined(__DJGPP__) || defined(__GO32__) +# define CARES_TYPEOF_ARES_SOCKLEN_T int -#ifdef WIN32 -# define CARES_PULL_WS2TCPIP_H 1 -#else -# define CARES_PULL_SYS_TYPES_H 1 -# define CARES_PULL_SYS_SOCKET_H 1 -#endif +#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 -/* #undef CARES_PULL_WS2TCPIP_H */ -#ifdef CARES_PULL_WS2TCPIP_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN +#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 -# include -# include -# include + +#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 -/* Configure process defines this to 1 when it finds out that system */ -/* header file sys/types.h must be included by the external interface. */ +/* 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 #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. */ +/* 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 # include #endif -/* The size of `long', as computed by sizeof. */ -/* #undef CARES_SIZEOF_LONG */ - -/* Integral data type used for ares_socklen_t. */ -#define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t - -/* The size of `ares_socklen_t', as computed by sizeof. */ -#define CARES_SIZEOF_ARES_SOCKLEN_T 4 - /* Data type definition of ares_socklen_t. */ -typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; + +#ifdef CARES_TYPEOF_ARES_SOCKLEN_T + typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; +#endif #endif /* __CARES_BUILD_H */ diff --git a/deps/cares/include/ares_rules.h b/deps/cares/include/ares_rules.h index 44f08f807c3cb7..e617fdc6daaa49 100644 --- a/deps/cares/include/ares_rules.h +++ b/deps/cares/include/ares_rules.h @@ -73,11 +73,6 @@ Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing #endif -#ifndef CARES_SIZEOF_ARES_SOCKLEN_T -# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!" - Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing -#endif - /* * Macros private to this header file. */ @@ -94,7 +89,7 @@ typedef char __cares_rule_02__ - [CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)]; + [CareschkszEQ(ares_socklen_t, sizeof(CARES_TYPEOF_ARES_SOCKLEN_T))]; /* * Verify at compile time that the size of ares_socklen_t as reported diff --git a/deps/cares/include/ares_version.h b/deps/cares/include/ares_version.h index 2c9146d7d954a6..92c858415bfa2a 100644 --- a/deps/cares/include/ares_version.h +++ b/deps/cares/include/ares_version.h @@ -3,15 +3,15 @@ #define ARES__VERSION_H /* This is the global package copyright */ -#define ARES_COPYRIGHT "2004 - 2013 Daniel Stenberg, ." +#define ARES_COPYRIGHT "2004 - 2016 Daniel Stenberg, ." #define ARES_VERSION_MAJOR 1 -#define ARES_VERSION_MINOR 10 -#define ARES_VERSION_PATCH 1 +#define ARES_VERSION_MINOR 12 +#define ARES_VERSION_PATCH 0 #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ (ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.10.1-DEV" +#define ARES_VERSION_STR "1.12.0" #if (ARES_VERSION >= 0x010700) # define CARES_HAVE_ARES_LIBRARY_INIT 1 diff --git a/deps/cares/src/AUTHORS b/deps/cares/src/AUTHORS index 905c1bbace1c65..af29ec86471fa0 100644 --- a/deps/cares/src/AUTHORS +++ b/deps/cares/src/AUTHORS @@ -2,9 +2,13 @@ c-ares is based on ares, and these are the people that have worked on it since the fork was made: Albert Chin +Alex Loukissas +Alexander Klauer Alexander Lazic Alexey Simak Andreas Rieke +Andrew Andkjar +Andrew Ayer Andrew C. Morrow Ashish Sharma Ben Greear @@ -13,20 +17,27 @@ BogDan Vatra Brad House Brad Spencer Bram Matthys +Chris Araman Dan Fandrich Daniel Johnson Daniel Stenberg +David Drysdale David Stuart Denis Bilenko Dima Tisnek Dirk Manske Dominick Meglio Doug Goldstein +Doug Kwan Duncan Wilcox Eino Tuominen Erik Kline +Fedor Indutny +Frederic Germain +Geert Uytterhoeven George Neill Gisle Vanem +Gregor Jasny Guenter Knauf Guilherme Balena Versiani Gunter Knauf @@ -34,25 +45,38 @@ Henrik Stoerner Jakub Hrozek James Bursa Jérémy Lal +Keith Shaw +Lei Shi Marko Kreen Michael Wallner Mike Crowe Nick Alcock Nick Mathewson +Nicolas "Pixel" Noble +Ning Dong +Oleg Pudeyev +Patrick Valsecchi Patrik Thunstrom +Paul Saab Peter Pentchev Phil Blundell Poul Thomas Lomholt Ravi Pratap Robin Cornelius +Saúl Ibarra Corretgé Sebastian at basti79.de Shmulik Regev Stefan Bühler Steinar H. Gunderson +Svante Karlsson Tofu Linden Tom Hughes Tor Arntsen +Viktor Szakats Vlad Dinulescu William Ahern Yang Tse +hpopescu at ixiacom.com liren at vivisimo.com +nordsturm +saghul diff --git a/deps/cares/src/README.cares b/deps/cares/src/README.cares index aca54c8cd1fc77..4dee46eabf8f4b 100644 --- a/deps/cares/src/README.cares +++ b/deps/cares/src/README.cares @@ -1,13 +1,15 @@ c-ares ====== -This package is based on ares 1.1.1 (written by Greg Hudson). I decided to -fork and release a separate project since the ares author didn't want the -improvements that were vital for our use of it. +This package is based on ares 1.1.1 (written by Greg Hudson). Daniel Stenberg +decided to fork and release a separate project since the original ares author +didn't want the improvements that were vital for our use of it. -This package is dubbed 'c-ares' since I (Daniel Stenberg) wanted this for use -within the curl project (hence the letter C) and it makes a nice pun. Also, -c-ares is not API compatible with ares: a new name makes that more obvious to -the public. +This package is dubbed 'c-ares' since Daniel wanted this for use within the +curl project (hence the letter C) and it makes a nice pun. c-ares is not API +compatible with ares: a new name makes that more obvious to the public. -The original libares was distributed at athena-dist.mit.edu:pub/ATHENA/ares. +The original libares was distributed at +ftp://athena-dist.mit.edu:pub/ATHENA/ares (which seems to not be alive +anymore). A local copy of the original ares package is kept here: +https://c-ares.haxx.se/download/ares-1.1.1.tar.gz diff --git a/deps/cares/src/RELEASE-NOTES b/deps/cares/src/RELEASE-NOTES index 1f3f0efd4809f7..dffb023744aad6 100644 --- a/deps/cares/src/RELEASE-NOTES +++ b/deps/cares/src/RELEASE-NOTES @@ -1,35 +1,46 @@ -c-ares version 1.10.0 +c-ares version 1.12.0 Changes: - o Added ares_create_query(), to be used instead of ares_mkquery() - o ares_inet_ntop() and ares_inet_pton() are now recognized c-ares functions - + o api: add ARES_OPT_NOROTATE optmask value + Bug fixes: - o include the ares_parse_soa_reply.* files in the tarball - o read_udp_packets: bail out loop on bad sockets - o get_DNS_AdaptersAddresses: fix IPv6 parsing - o adig: perror() doesn't work for socket errors on windows - o ares_parse_aaaa_reply: fix memory leak - o setup_once.h: HP-UX issue workaround - o configure: several fixes - o config-dos.h: define strerror() to strerror_s_() for High-C - o config-dos.h: define HAVE_CLOSE_S for MSDOS/Watt-32 - o ares_build.h.dist: enhance non-configure GCC ABI detection logic - o ares.h: stricter CARES_EXTERN linkage decorations logic - o ares_cancel(): cancel requests safely - o protocol parsing: check input data stricter - o library init: be recursive, reference count inits/cleanups - o ares_parse_txt_reply: return a ares_txt_reply node for each sub-string - o ares_set_servers_csv: fixed IPv6 address parsing - o build: fix build on msvc11 + o CVE-2016-5180: ares_create_query single byte out of buffer write [4] + o configure: acknowledge --disable-tests [1] + o man pages: fix typos detected by Lintian + o test: add missing #includes for dns-proto.cc + o test: avoid in6addr_* constants + o test: Build with MinGW on AppVeyor + o Makefile.m32: add support for extra flags + o Makefile.m32: add support for CROSSPREFIX + o configure: check if tests can get built before enabled + o ares_library_cleanup: reset ares_realloc too + o ahost.c: add cast to fix C++ compile + o test: Only pass unused args to GoogleTest + o build: commonize MSVC version detection + o msvc_ver.inc: support Visual Studio 2015 Update 1, 2, 3 + o test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record + o ares_getnameinfo: explicitly clear struct servent before use + o test: Update fuzzing function prototype + o init: fix nsort initialization + o test: add fuzzing check script to tests + o web: http => https + o read_tcp_data: remove superfluous NULL check + o LICENSE.md: add a stand-alone license file + o SECURITY.md: suggested "security process" for the project + o ares_init_options: only propagate init failures from options [2] + o headers: remove checks for and defines of variable sizes + o test: fix gMock to work with gcc >= 6.x [3] Thanks go to these friendly people for their efforts and contributions: - Eugeny Gladkih, Yang Tse, Gisle Vanem, Guenter Knauf, Horatiu Popescu, - Alexander Klauer, Patrick Valsecchi, Paul Saab, Keith Shaw, - Alex Loukissas - + Alexander Drachevskiy, Brad House, Chris Araman, Daniel Stenberg, + David Drysdale, Gregor Jasny, Svante Karlsson, Viktor Szakats + +References to bug reports and discussions on issues: -Have fun! + [1] = https://github.com/c-ares/c-ares/issues/44 + [2] = https://github.com/c-ares/c-ares/issues/60 + [3] = https://github.com/google/googletest/issues/705#issuecomment-235067917 + [4] = https://c-ares.haxx.se/adv_20160929.html diff --git a/deps/cares/src/ares_getnameinfo.c b/deps/cares/src/ares_getnameinfo.c index d5571a7fd2d2a8..45161124caff91 100644 --- a/deps/cares/src/ares_getnameinfo.c +++ b/deps/cares/src/ares_getnameinfo.c @@ -299,6 +299,7 @@ static char *lookup_service(unsigned short port, int flags, else proto = "tcp"; #ifdef HAVE_GETSERVBYPORT_R + memset(&se, 0, sizeof(se)); sep = &se; memset(tmpbuf, 0, sizeof(tmpbuf)); #if GETSERVBYPORT_R_ARGS == 6 diff --git a/deps/cares/src/ares_init.c b/deps/cares/src/ares_init.c index d978820f9a9b0d..f557947aa14373 100644 --- a/deps/cares/src/ares_init.c +++ b/deps/cares/src/ares_init.c @@ -112,7 +112,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ares_channel channel; int i; int status = ARES_SUCCESS; - int status2; struct timeval now; #ifdef CURLDEBUG @@ -190,18 +189,17 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, * precedence to lowest. */ - if (status == ARES_SUCCESS) { - status = init_by_options(channel, options, optmask); - if (status != ARES_SUCCESS) - DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", - ares_strerror(status))); - } - if (status == ARES_SUCCESS) { - status = init_by_environment(channel); - if (status != ARES_SUCCESS) - DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", - ares_strerror(status))); + status = init_by_options(channel, options, optmask); + if (status != ARES_SUCCESS) { + DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", + ares_strerror(status))); + /* If we fail to apply user-specified options, fail the whole init process */ + goto done; } + status = init_by_environment(channel); + if (status != ARES_SUCCESS) + DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", + ares_strerror(status))); if (status == ARES_SUCCESS) { status = init_by_resolv_conf(channel); if (status != ARES_SUCCESS) @@ -213,13 +211,10 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, * No matter what failed or succeeded, seed defaults to provide * useful behavior for things that we missed. */ - status2 = init_by_defaults(channel); - if (status2 != ARES_SUCCESS) { + status = init_by_defaults(channel); + if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", ares_strerror(status))); - if (status == ARES_SUCCESS) - status = status2; - } /* Generate random key */ @@ -232,6 +227,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ares_strerror(status))); } +done: if (status != ARES_SUCCESS) { /* Something failed; clean up memory we may have allocated. */ @@ -350,8 +346,8 @@ int ares_save_options(ares_channel channel, struct ares_options *options, (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS| ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB| ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS| - ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS) | - (channel->optmask & ARES_OPT_ROTATE); + ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS); + (*optmask) |= (channel->rotate ? ARES_OPT_ROTATE : ARES_OPT_NOROTATE); /* Copy easy stuff */ options->flags = channel->flags; @@ -447,6 +443,8 @@ static int init_by_options(ares_channel channel, channel->ndots = options->ndots; if ((optmask & ARES_OPT_ROTATE) && channel->rotate == -1) channel->rotate = 1; + if ((optmask & ARES_OPT_NOROTATE) && channel->rotate == -1) + channel->rotate = 0; if ((optmask & ARES_OPT_UDP_PORT) && channel->udp_port == -1) channel->udp_port = htons(options->udp_port); if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1) @@ -520,13 +518,14 @@ static int init_by_options(ares_channel channel, } /* copy sortlist */ - if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1) && - (options->nsort>0)) { - channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern)); - if (!channel->sortlist) - return ARES_ENOMEM; - for (i = 0; i < options->nsort; i++) - channel->sortlist[i] = options->sortlist[i]; + if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1)) { + if (options->nsort > 0) { + channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern)); + if (!channel->sortlist) + return ARES_ENOMEM; + for (i = 0; i < options->nsort; i++) + channel->sortlist[i] = options->sortlist[i]; + } channel->nsort = options->nsort; } @@ -1030,11 +1029,6 @@ static int get_DNS_AdaptersAddresses(char **outptr) } else if (namesrvr.sa->sa_family == AF_INET6) { - /* Windows apparently always reports some IPv6 DNS servers that - * prefixed with fec0:0:0:ffff. These ususally do not point to - * working DNS servers, so we ignore them. */ - if (strncmp(txtaddr, "fec0:0:0:ffff:", 14) == 0) - continue; if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any, sizeof(namesrvr.sa6->sin6_addr)) == 0) continue; @@ -1628,7 +1622,7 @@ static int config_lookup(ares_channel channel, const char *str, channel->lookups = ares_strdup(lookups); return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; } -#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ */ +#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ & !CARES_USE_LIBRESOLV */ #ifndef WATT32 static int config_nameserver(struct server_state **servers, int *nservers, diff --git a/deps/cares/src/ares_ipv6.h b/deps/cares/src/ares_ipv6.h index 1830076a81092a..b0017f16c79d20 100644 --- a/deps/cares/src/ares_ipv6.h +++ b/deps/cares/src/ares_ipv6.h @@ -47,16 +47,16 @@ struct addrinfo #endif #ifndef NS_IN6ADDRSZ -#if SIZEOF_STRUCT_IN6_ADDR == 0 +#ifndef HAVE_STRUCT_IN6_ADDR /* We cannot have it set to zero, so we pick a fixed value here */ #define NS_IN6ADDRSZ 16 #else -#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR +#define NS_IN6ADDRSZ sizeof(struct in6_addr) #endif #endif #ifndef NS_INADDRSZ -#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR +#define NS_INADDRSZ sizeof(struct in_addr) #endif #ifndef NS_INT16SZ diff --git a/deps/cares/src/ares_library_init.c b/deps/cares/src/ares_library_init.c index c2bfb093e2203b..c885a16c807a8f 100644 --- a/deps/cares/src/ares_library_init.c +++ b/deps/cares/src/ares_library_init.c @@ -152,6 +152,7 @@ void ares_library_cleanup(void) ares_init_flags = ARES_LIB_INIT_NONE; ares_malloc = malloc; + ares_realloc = realloc; ares_free = free; } @@ -164,5 +165,3 @@ int ares_library_initialized(void) #endif return ARES_SUCCESS; } - - diff --git a/deps/cares/src/ares_nowarn.c b/deps/cares/src/ares_nowarn.c index d4bd272c6d9e8c..7f9035c1a1ee8f 100644 --- a/deps/cares/src/ares_nowarn.c +++ b/deps/cares/src/ares_nowarn.c @@ -40,42 +40,22 @@ #include "ares_nowarn.h" -#if (SIZEOF_SHORT == 2) +#ifndef HAVE_LIMITS_H +/* systems without we guess have 16 bit shorts, 32bit ints and + 32bit longs */ # define CARES_MASK_SSHORT 0x7FFF # define CARES_MASK_USHORT 0xFFFF -#elif (SIZEOF_SHORT == 4) -# define CARES_MASK_SSHORT 0x7FFFFFFF -# define CARES_MASK_USHORT 0xFFFFFFFF -#elif (SIZEOF_SHORT == 8) -# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF -# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF -#else -# error "SIZEOF_SHORT not defined" -#endif - -#if (SIZEOF_INT == 2) -# define CARES_MASK_SINT 0x7FFF -# define CARES_MASK_UINT 0xFFFF -#elif (SIZEOF_INT == 4) -# define CARES_MASK_SINT 0x7FFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFF -#elif (SIZEOF_INT == 8) -# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF -#elif (SIZEOF_INT == 16) -# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -#else -# error "SIZEOF_INT not defined" -#endif - -#ifndef HAVE_LIMITS_H -/* systems without we guess have 32 bit longs */ -#define CARES_MASK_SLONG 0x7FFFFFFFL -#define CARES_MASK_ULONG 0xFFFFFFFFUL +# define CARES_MASK_SINT 0x7FFFFFFF +# define CARES_MASK_UINT 0xFFFFFFFF +# define CARES_MASK_SLONG 0x7FFFFFFFL +# define CARES_MASK_ULONG 0xFFFFFFFFUL #else -#define CARES_MASK_ULONG ULONG_MAX -#define CARES_MASK_SLONG LONG_MAX +# define CARES_MASK_SSHORT SHRT_MAX +# define CARES_MASK_USHORT USHRT_MAX +# define CARES_MASK_SINT INT_MAX +# define CARES_MASK_UINT UINT_MAX +# define CARES_MASK_SLONG LONG_MAX +# define CARES_MASK_ULONG ULONG_MAX #endif /* diff --git a/deps/cares/src/ares_process.c b/deps/cares/src/ares_process.c index 0325f5191d8baa..1d1e7b8b85f277 100644 --- a/deps/cares/src/ares_process.c +++ b/deps/cares/src/ares_process.c @@ -391,8 +391,7 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, */ process_answer(channel, server->tcp_buffer, server->tcp_length, i, 1, now); - if (server->tcp_buffer) - ares_free(server->tcp_buffer); + ares_free(server->tcp_buffer); server->tcp_buffer = NULL; server->tcp_lenbuf_pos = 0; server->tcp_buffer_pos = 0; diff --git a/deps/cares/src/ares_setup.h b/deps/cares/src/ares_setup.h index dee3e6ba6e4c05..4df796116a0f51 100644 --- a/deps/cares/src/ares_setup.h +++ b/deps/cares/src/ares_setup.h @@ -75,9 +75,6 @@ /* please, do it beyond the point further indicated in this file. */ /* ================================================================ */ -#if 1 -# define SIZEOF_SHORT 2 -#else /* Disabled for the gyp-ified build. */ /* * c-ares external interface definitions are also used internally, * and might also include required system header files to define them. @@ -90,7 +87,6 @@ */ #include -#endif /* ================================================================= */ /* No system header file shall be included in this file before this */ diff --git a/deps/cares/src/config-win32.h b/deps/cares/src/config-win32.h index 1245ba2abbef89..dd955252bdf574 100644 --- a/deps/cares/src/config-win32.h +++ b/deps/cares/src/config-win32.h @@ -211,6 +211,11 @@ /* Define to the return type of signal handlers (int or void). */ #define RETSIGTYPE void +#ifdef __cplusplus +/* Compiling headers in C++ mode means bool is available */ +#define HAVE_BOOL_T +#endif + /* Define if ssize_t is not an available 'typedefed' type. */ #ifndef _SSIZE_T_DEFINED # if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ @@ -229,19 +234,6 @@ /* TYPE SIZES */ /* ---------------------------------------------------------------- */ -/* Define to the size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* Define to the size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* Define to the size of `size_t', as computed by sizeof. */ -#if defined(_WIN64) -# define SIZEOF_SIZE_T 8 -#else -# define SIZEOF_SIZE_T 4 -#endif - /* ---------------------------------------------------------------- */ /* STRUCT RELATED */ /* ---------------------------------------------------------------- */ From 120fda228ed2299e86b545d3e8a3c62e1cb3ec78 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Sat, 29 Oct 2016 14:33:15 +1100 Subject: [PATCH 2/7] deps: update license-builder & LICENSE for c-ares c-ares now includes a LICENSE file so we no longer need to pull from the heading of a file. PR-URL: https://github.com/nodejs/node/pull/15378 --- LICENSE | 25 ++++++++++++------------- tools/license-builder.sh | 3 +-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/LICENSE b/LICENSE index c7ed5897ecd057..b3b7636c967703 100644 --- a/LICENSE +++ b/LICENSE @@ -53,20 +53,19 @@ The externally maintained libraries used by Node.js are: - c-ares, located at deps/cares, is licensed as follows: """ + Copyright (c) 2007 - 2016, Daniel Stenberg with many contributors, see AUTHORS + file. + Copyright 1998 by the Massachusetts Institute of Technology. - Copyright (C) 2007-2013 by Daniel Stenberg - - Permission to use, copy, modify, and distribute this - software and its documentation for any purpose and without - fee is hereby granted, provided that the above copyright - notice appear in all copies and that both that copyright - notice and this permission notice appear in supporting - documentation, and that the name of M.I.T. not be used in - advertising or publicity pertaining to distribution of the - software without specific, written prior permission. - M.I.T. makes no representations about the suitability of - this software for any purpose. It is provided "as is" - without express or implied warranty. + + 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. """ - HTTP Parser, located at deps/http_parser, is licensed as follows: diff --git a/tools/license-builder.sh b/tools/license-builder.sh index 62eabf0e1f8c0a..3e8cc01f651801 100755 --- a/tools/license-builder.sh +++ b/tools/license-builder.sh @@ -29,8 +29,7 @@ fi # Dependencies bundled in distributions -addlicense "c-ares" "deps/cares" \ - "$(sed -e '/^ \*\/$/,$d' -e '/^$/d' -e 's/^[/ ]\* *//' ${rootdir}/deps/cares/src/ares_init.c)" +addlicense "c-ares" "deps/cares" "$(tail -n +3 ${rootdir}/deps/cares/LICENSE.md)" addlicense "HTTP Parser" "deps/http_parser" "$(cat deps/http_parser/LICENSE-MIT)" if [ -f "${rootdir}/deps/icu/LICENSE" ]; then # ICU 57 and following. Drop the BOM From dff60447b62fde09ad80843b98e02e07ff05f0e6 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Wed, 13 Sep 2017 12:51:23 +1000 Subject: [PATCH 3/7] deps: upgrade to c-ares v1.13.0 PR-URL: https://github.com/nodejs/node/pull/15378 --- deps/cares/config/aix/ares_config.h | 9 +- deps/cares/config/android/ares_config.h | 9 +- deps/cares/config/cygwin/ares_config.h | 7 +- deps/cares/config/darwin/ares_config.h | 14 +- deps/cares/config/freebsd/ares_config.h | 9 +- deps/cares/config/linux/ares_config.h | 14 +- deps/cares/config/netbsd/ares_config.h | 9 +- deps/cares/config/openbsd/ares_config.h | 9 +- deps/cares/config/sunos/ares_config.h | 9 +- deps/cares/include/ares.h | 24 +- deps/cares/include/ares_build.h | 13 + deps/cares/include/ares_version.h | 4 +- deps/cares/src/README | 58 --- deps/cares/src/README.md | 65 ++++ deps/cares/src/RELEASE-NOTES | 76 ++-- deps/cares/src/ares__close_sockets.c | 4 +- deps/cares/src/ares_create_query.c | 6 +- deps/cares/src/ares_expand_name.c | 8 +- deps/cares/src/ares_expand_string.c | 2 +- deps/cares/src/ares_gethostbyaddr.c | 2 +- deps/cares/src/ares_getnameinfo.c | 34 +- deps/cares/src/ares_init.c | 446 +++++++++++++++++++++--- deps/cares/src/ares_library_init.c | 10 + deps/cares/src/ares_library_init.h | 3 +- deps/cares/src/ares_nowarn.c | 12 +- deps/cares/src/ares_nowarn.h | 4 +- deps/cares/src/ares_parse_naptr_reply.c | 13 +- deps/cares/src/ares_private.h | 11 + deps/cares/src/ares_process.c | 163 +++++++-- deps/cares/src/ares_writev.c | 4 +- deps/cares/src/ares_writev.h | 2 +- deps/cares/src/config-win32.h | 42 +-- deps/cares/src/inet_net_pton.c | 4 +- deps/cares/src/setup_once.h | 10 +- 34 files changed, 828 insertions(+), 281 deletions(-) delete mode 100644 deps/cares/src/README create mode 100644 deps/cares/src/README.md diff --git a/deps/cares/config/aix/ares_config.h b/deps/cares/config/aix/ares_config.h index 62235e3e1e25b5..edc71fc7f87a6c 100644 --- a/deps/cares/config/aix/ares_config.h +++ b/deps/cares/config/aix/ares_config.h @@ -16,6 +16,9 @@ /* Defined for build with symbol hiding. */ /* #undef CARES_SYMBOL_HIDING */ +/* the signed version of size_t */ +#define CARES_TYPEOF_ARES_SSIZE_T ssize_t + /* Definition to make a library symbol externally visible. */ /* #undef CARES_SYMBOL_SCOPE_EXTERN */ @@ -363,7 +366,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.12.0" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -372,7 +375,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12.0" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -456,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.12.0" +#define VERSION "1.13.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ diff --git a/deps/cares/config/android/ares_config.h b/deps/cares/config/android/ares_config.h index 0a7bc7acd277bd..d7e51cf1fb7816 100644 --- a/deps/cares/config/android/ares_config.h +++ b/deps/cares/config/android/ares_config.h @@ -19,6 +19,9 @@ /* 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 */ @@ -363,7 +366,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.12.0" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -372,7 +375,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12.0" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -456,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.12.0" +#define VERSION "1.13.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ diff --git a/deps/cares/config/cygwin/ares_config.h b/deps/cares/config/cygwin/ares_config.h index 592a245985e02d..3818ad0b4612a9 100644 --- a/deps/cares/config/cygwin/ares_config.h +++ b/deps/cares/config/cygwin/ares_config.h @@ -22,6 +22,9 @@ /* 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 + /* if a /etc/inet dir is being used */ /* #undef ETC_INET */ @@ -364,7 +367,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.7.1" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -373,7 +376,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.7.1" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" diff --git a/deps/cares/config/darwin/ares_config.h b/deps/cares/config/darwin/ares_config.h index 36b8b7a7177072..5ea9e09b8d1d0a 100644 --- a/deps/cares/config/darwin/ares_config.h +++ b/deps/cares/config/darwin/ares_config.h @@ -19,6 +19,9 @@ /* 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 */ @@ -351,7 +354,7 @@ /* #undef NEED_THREAD_SAFE */ /* cpu-machine-OS */ -#define OS "x86_64-apple-darwin14.5.0" +#define OS "x86_64-apple-darwin16.7.0" /* Name of package */ #define PACKAGE "c-ares" @@ -363,7 +366,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.12.0" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -372,7 +375,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12.0" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -456,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.12.0" +#define VERSION "1.13.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ @@ -497,6 +500,3 @@ /* Define to `unsigned int' if does not define. */ /* #undef size_t */ - -/* the signed version of size_t */ -/* #undef ssize_t */ diff --git a/deps/cares/config/freebsd/ares_config.h b/deps/cares/config/freebsd/ares_config.h index 562ea225d1820c..5c0a73954e1186 100644 --- a/deps/cares/config/freebsd/ares_config.h +++ b/deps/cares/config/freebsd/ares_config.h @@ -19,6 +19,9 @@ /* 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 */ @@ -363,7 +366,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.12.0" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -372,7 +375,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12.0" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -456,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.12.0" +#define VERSION "1.13.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ diff --git a/deps/cares/config/linux/ares_config.h b/deps/cares/config/linux/ares_config.h index 99a6e9a452b4cd..d398b265658d5f 100644 --- a/deps/cares/config/linux/ares_config.h +++ b/deps/cares/config/linux/ares_config.h @@ -19,6 +19,9 @@ /* 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 */ @@ -351,7 +354,7 @@ /* #undef NEED_THREAD_SAFE */ /* cpu-machine-OS */ -#define OS "i686-pc-linux-gnu" +#define OS "x86_64-pc-linux-gnu" /* Name of package */ #define PACKAGE "c-ares" @@ -363,7 +366,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.12.0" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -372,7 +375,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12.0" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -456,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.12.0" +#define VERSION "1.13.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ @@ -497,6 +500,3 @@ /* Define to `unsigned int' if does not define. */ /* #undef size_t */ - -/* the signed version of size_t */ -/* #undef ssize_t */ diff --git a/deps/cares/config/netbsd/ares_config.h b/deps/cares/config/netbsd/ares_config.h index b724f37d2baf45..2c919b44afea65 100644 --- a/deps/cares/config/netbsd/ares_config.h +++ b/deps/cares/config/netbsd/ares_config.h @@ -16,6 +16,9 @@ /* Defined for build with symbol hiding. */ /* #undef CARES_SYMBOL_HIDING */ +/* the signed version of size_t */ +#define CARES_TYPEOF_ARES_SSIZE_T ssize_t + /* Definition to make a library symbol externally visible. */ /* #undef CARES_SYMBOL_SCOPE_EXTERN */ @@ -363,7 +366,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.12.0" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -372,7 +375,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12.0" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -456,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.12.0" +#define VERSION "1.13.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ diff --git a/deps/cares/config/openbsd/ares_config.h b/deps/cares/config/openbsd/ares_config.h index b724f37d2baf45..2c919b44afea65 100644 --- a/deps/cares/config/openbsd/ares_config.h +++ b/deps/cares/config/openbsd/ares_config.h @@ -16,6 +16,9 @@ /* Defined for build with symbol hiding. */ /* #undef CARES_SYMBOL_HIDING */ +/* the signed version of size_t */ +#define CARES_TYPEOF_ARES_SSIZE_T ssize_t + /* Definition to make a library symbol externally visible. */ /* #undef CARES_SYMBOL_SCOPE_EXTERN */ @@ -363,7 +366,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.12.0" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -372,7 +375,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12.0" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -456,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.12.0" +#define VERSION "1.13.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ diff --git a/deps/cares/config/sunos/ares_config.h b/deps/cares/config/sunos/ares_config.h index 00e4190fb10a5a..dce2e5ad16f2e1 100644 --- a/deps/cares/config/sunos/ares_config.h +++ b/deps/cares/config/sunos/ares_config.h @@ -19,6 +19,9 @@ /* 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 */ @@ -363,7 +366,7 @@ #define PACKAGE_NAME "c-ares" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "c-ares 1.12.0" +#define PACKAGE_STRING "c-ares 1.13.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "c-ares" @@ -372,7 +375,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.12.0" +#define PACKAGE_VERSION "1.13.0" /* a suitable file/device to read random data from */ #define RANDOM_FILE "/dev/urandom" @@ -456,7 +459,7 @@ /* #undef USE_BLOCKING_SOCKETS */ /* Version number of package */ -#define VERSION "1.12.0" +#define VERSION "1.13.0" /* Define to avoid automatic inclusion of winsock.h */ /* #undef WIN32_LEAN_AND_MEAN */ diff --git a/deps/cares/include/ares.h b/deps/cares/include/ares.h index 8c80f0740bebce..cfd72b0c51be3e 100644 --- a/deps/cares/include/ares.h +++ b/deps/cares/include/ares.h @@ -38,7 +38,8 @@ require it! */ #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ - defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) + defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \ + defined(__QNXNTO__) #include #endif #if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) @@ -356,6 +357,27 @@ CARES_EXTERN void ares_set_socket_configure_callback(ares_channel channel, CARES_EXTERN int ares_set_sortlist(ares_channel channel, const char *sortstr); +/* + * Virtual function set to have user-managed socket IO. + * Note that all functions need to be defined, and when + * set, the library will not do any bind nor set any + * socket options, assuming the client handles these + * through either socket creation or the + * ares_sock_config_callback call. + */ +struct iovec; +struct ares_socket_functions { + ares_socket_t(*asocket)(int, int, int, void *); + int(*aclose)(ares_socket_t, void *); + int(*aconnect)(ares_socket_t, const struct sockaddr *, ares_socklen_t, void *); + ares_ssize_t(*arecvfrom)(ares_socket_t, void *, size_t, int, struct sockaddr *, ares_socklen_t *, void *); + ares_ssize_t(*asendv)(ares_socket_t, const struct iovec *, int, void *); +}; + +CARES_EXTERN void ares_set_socket_functions(ares_channel channel, + const struct ares_socket_functions * funcs, + void *user_data); + CARES_EXTERN void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, diff --git a/deps/cares/include/ares_build.h b/deps/cares/include/ares_build.h index 9a865e34492758..f94bb2962a0540 100644 --- a/deps/cares/include/ares_build.h +++ b/deps/cares/include/ares_build.h @@ -191,4 +191,17 @@ 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/deps/cares/include/ares_version.h b/deps/cares/include/ares_version.h index 92c858415bfa2a..afa46c632fd991 100644 --- a/deps/cares/include/ares_version.h +++ b/deps/cares/include/ares_version.h @@ -6,12 +6,12 @@ #define ARES_COPYRIGHT "2004 - 2016 Daniel Stenberg, ." #define ARES_VERSION_MAJOR 1 -#define ARES_VERSION_MINOR 12 +#define ARES_VERSION_MINOR 13 #define ARES_VERSION_PATCH 0 #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ (ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.12.0" +#define ARES_VERSION_STR "1.13.0" #if (ARES_VERSION >= 0x010700) # define CARES_HAVE_ARES_LIBRARY_INIT 1 diff --git a/deps/cares/src/README b/deps/cares/src/README deleted file mode 100644 index 2c128c8d7e0d30..00000000000000 --- a/deps/cares/src/README +++ /dev/null @@ -1,58 +0,0 @@ -c-ares -====== - -This is c-ares, an asynchronous resolver library. It is intended for -applications which need to perform DNS queries without blocking, or need to -perform multiple DNS queries in parallel. The primary examples of such -applications are servers which communicate with multiple clients and programs -with graphical user interfaces. - -The full source code is available in the 'c-ares' release archives, and in a -git repository: http://github.com/bagder/c-ares - -If you find bugs, correct flaws, have questions or have comments in general in -regard to c-ares (or by all means the original ares too), get in touch with us -on the c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares - -c-ares is of course distributed under the same MIT-style license as the -original ares. - -You'll find all c-ares details and news here: - - http://c-ares.haxx.se/ - - -NOTES FOR C-ARES HACKERS - -* The distributed ares_build.h file is only intended to be used on systems - which can not run the also distributed configure script. - -* The distributed ares_build.h file is generated as a copy of ares_build.h.dist - when the c-ares source code distribution archive file is originally created. - -* If you check out from git on a non-configure platform, you must run the - appropriate buildconf* script to set up ares_build.h and other local files - before being able of compiling the library. - -* On systems capable of running the configure script, the configure process - will overwrite the distributed ares_build.h file with one that is suitable - and specific to the library being configured and built, this new file is - generated from the ares_build.h.in template file. - -* If you intend to distribute an already compiled c-ares library you _MUST_ - also distribute along with it the generated ares_build.h which has been - used to compile it. Otherwise the library will be of no use for the users of - the library that you have built. It is _your_ responsibility to provide this - file. No one at the c-ares project can know how you have built the library. - -* File ares_build.h includes platform and configuration dependent info, - and must not be modified by anyone. Configure script generates it for you. - -* We cannot assume anything else but very basic compiler features being - present. While c-ares requires an ANSI C compiler to build, some of the - earlier ANSI compilers clearly can't deal with some preprocessor operators. - -* Newlines must remain unix-style for older compilers' sake. - -* Comments must be written in the old-style /* unnested C-fashion */ - diff --git a/deps/cares/src/README.md b/deps/cares/src/README.md new file mode 100644 index 00000000000000..6ad0168dc9a842 --- /dev/null +++ b/deps/cares/src/README.md @@ -0,0 +1,65 @@ +c-ares +====== + +[![Build Status](https://travis-ci.org/c-ares/c-ares.svg?branch=master)](https://travis-ci.org/c-ares/c-ares) +[![Windows Build Status](https://ci.appveyor.com/api/projects/status/03i7151772eq3wn3/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares) +[![Coverage Status](https://coveralls.io/repos/c-ares/c-ares/badge.svg?branch=master&service=github)](https://coveralls.io/github/c-ares/c-ares?branch=master) +[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/291/badge)](https://bestpractices.coreinfrastructure.org/projects/291) + +This is c-ares, an asynchronous resolver library. It is intended for +applications which need to perform DNS queries without blocking, or need to +perform multiple DNS queries in parallel. The primary examples of such +applications are servers which communicate with multiple clients and programs +with graphical user interfaces. + +The full source code is available in the ['c-ares' release archives](https://c-ares.haxx.se/download/), +and in a git repository: http://github.com/c-ares/c-ares. See the +[INSTALL.md](INSTALL.md) file for build information. + +If you find bugs, correct flaws, have questions or have comments in general in +regard to c-ares (or by all means the original ares too), get in touch with us +on the c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares + +c-ares is of course distributed under the same MIT-style license as the +original ares. + +You'll find all c-ares details and news here: + https://c-ares.haxx.se/ + + +Notes for c-ares hackers +------------------------ + +* The distributed `ares_build.h` file is only intended to be used on systems + which can not run the also distributed configure script. + +* The distributed `ares_build.h` file is generated as a copy of `ares_build.h.dist` + when the c-ares source code distribution archive file is originally created. + +* If you check out from git on a non-configure platform, you must run the + appropriate `buildconf*` script to set up `ares_build.h` and other local files + before being able to compile the library. + +* On systems capable of running the `configure` script, the `configure` process + will overwrite the distributed `ares_build.h` file with one that is suitable + and specific to the library being configured and built, this new file is + generated from the `ares_build.h.in` template file. + +* If you intend to distribute an already compiled c-ares library you **MUST** + also distribute along with it the generated `ares_build.h` which has been + used to compile it. Otherwise the library will be of no use for the users of + the library that you have built. It is **your** responsibility to provide this + file. No one at the c-ares project can know how you have built the library. + +* File `ares_build.h` includes platform and configuration dependent info, + and must not be modified by anyone. Configure script generates it for you. + +* We cannot assume anything else but very basic compiler features being + present. While c-ares requires an ANSI C compiler to build, some of the + earlier ANSI compilers clearly can't deal with some preprocessor operators. + +* Newlines must remain unix-style for older compilers' sake. + +* Comments must be written in the old-style /* unnested C-fashion */ + +* Try to keep line lengths below 80 columns. diff --git a/deps/cares/src/RELEASE-NOTES b/deps/cares/src/RELEASE-NOTES index dffb023744aad6..2bdde15030308a 100644 --- a/deps/cares/src/RELEASE-NOTES +++ b/deps/cares/src/RELEASE-NOTES @@ -1,46 +1,54 @@ -c-ares version 1.12.0 +c-ares version 1.13.0 Changes: - o api: add ARES_OPT_NOROTATE optmask value + o cmake build system support added + o Add virtual function set for socket IO: ares_set_socket_functions [5] Bug fixes: - o CVE-2016-5180: ares_create_query single byte out of buffer write [4] - o configure: acknowledge --disable-tests [1] - o man pages: fix typos detected by Lintian - o test: add missing #includes for dns-proto.cc - o test: avoid in6addr_* constants - o test: Build with MinGW on AppVeyor - o Makefile.m32: add support for extra flags - o Makefile.m32: add support for CROSSPREFIX - o configure: check if tests can get built before enabled - o ares_library_cleanup: reset ares_realloc too - o ahost.c: add cast to fix C++ compile - o test: Only pass unused args to GoogleTest - o build: commonize MSVC version detection - o msvc_ver.inc: support Visual Studio 2015 Update 1, 2, 3 - o test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record - o ares_getnameinfo: explicitly clear struct servent before use - o test: Update fuzzing function prototype - o init: fix nsort initialization - o test: add fuzzing check script to tests - o web: http => https - o read_tcp_data: remove superfluous NULL check - o LICENSE.md: add a stand-alone license file - o SECURITY.md: suggested "security process" for the project - o ares_init_options: only propagate init failures from options [2] - o headers: remove checks for and defines of variable sizes - o test: fix gMock to work with gcc >= 6.x [3] + o CVE-2017-1000381: c-ares NAPTR parser out of bounds access [1] + o macos: do not set HAVE_CLOCK_GETTIME_MONOTONIC + o test: check ares_create_query with too-long name + o dist: add ares_library_initialized.* to the tarball + o fix build on OpenBSD + o dist: ship msvc_ver.inc too [2] + o test: Add gTest/gMock files to SOURCES + o test: add fuzz entrypoint for ares_create_query() + o configure: clock_gettime workaround [3] + o docs: convert INSTALL to MarkDown & tweak [4] + o ares_process: fix return type of socket_create function (win32 warning) + o docs: fixed references to ares_set_local_ip4 and ares_set_local_ip6 + o Windows DNS server sorting [6] + o Use ares_socklen_t instead of socket_t [7] + o ares_create_query: use ares_free not naked free + o msvc_ver.inc support most recent Visual Studio 2017 [8] + o acountry: Convert char from ISO-8859-1 to UTF-8 [9] + o ares_expand_name: limit number of indirections + o configure: do not check for ar if specified manually [10] + o Added support for Windows DNS Suffix Search List [11] + o ares.h: support compiling with QNX [12] Thanks go to these friendly people for their efforts and contributions: - Alexander Drachevskiy, Brad House, Chris Araman, Daniel Stenberg, - David Drysdale, Gregor Jasny, Svante Karlsson, Viktor Szakats + Aaron Bieber, Andrew Sullivan, Brad House, Bruce Stephens, Calle Wilund, + Chris Araman, Christian Ammer, Daniel Stenberg, David Drysdale, David Hotham, + Dionna Glaze, Gregor Jasny, Michael Osei, Mulle kybernetiK, noiz at github, + Sergii Pylypenko, Stephen Sorley, Thomas Köckerbauer, + (18 contributors) References to bug reports and discussions on issues: - [1] = https://github.com/c-ares/c-ares/issues/44 - [2] = https://github.com/c-ares/c-ares/issues/60 - [3] = https://github.com/google/googletest/issues/705#issuecomment-235067917 - [4] = https://c-ares.haxx.se/adv_20160929.html + [1] = https://c-ares.haxx.se/adv_20170620.html + [2] = https://github.com/c-ares/c-ares/issues/69 + [3] = https://github.com/c-ares/c-ares/issues/71 + [4] = https://github.com/c-ares/c-ares/issues/83 + [5] = https://github.com/c-ares/c-ares/issues/72 + [6] = https://github.com/c-ares/c-ares/issues/81 + [7] = https://github.com/c-ares/c-ares/issues/92 + [8] = https://github.com/c-ares/c-ares/issues/101 + [9] = https://github.com/c-ares/c-ares/issues/97 + [10] = https://github.com/c-ares/c-ares/issues/62 + [11] = https://github.com/c-ares/c-ares/issues/93 + [12] = https://github.com/c-ares/c-ares/issues/113 + diff --git a/deps/cares/src/ares__close_sockets.c b/deps/cares/src/ares__close_sockets.c index 6c66483b03579a..f07904e8735bcd 100644 --- a/deps/cares/src/ares__close_sockets.c +++ b/deps/cares/src/ares__close_sockets.c @@ -48,14 +48,14 @@ void ares__close_sockets(ares_channel channel, struct server_state *server) if (server->tcp_socket != ARES_SOCKET_BAD) { SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); - sclose(server->tcp_socket); + ares__socket_close(channel, server->tcp_socket); server->tcp_socket = ARES_SOCKET_BAD; server->tcp_connection_generation = ++channel->tcp_connection_generation; } if (server->udp_socket != ARES_SOCKET_BAD) { SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); - sclose(server->udp_socket); + ares__socket_close(channel, server->udp_socket); server->udp_socket = ARES_SOCKET_BAD; } } diff --git a/deps/cares/src/ares_create_query.c b/deps/cares/src/ares_create_query.c index 7f4c52d41dfbf4..07d7570114403b 100644 --- a/deps/cares/src/ares_create_query.c +++ b/deps/cares/src/ares_create_query.c @@ -134,7 +134,7 @@ int ares_create_query(const char *name, int dnsclass, int type, while (*name) { if (*name == '.') { - free (buf); + ares_free (buf); return ARES_EBADNAME; } @@ -147,7 +147,7 @@ int ares_create_query(const char *name, int dnsclass, int type, len++; } if (len > MAXLABEL) { - free (buf); + ares_free (buf); return ARES_EBADNAME; } @@ -190,7 +190,7 @@ int ares_create_query(const char *name, int dnsclass, int type, * to 255 octets or less."). */ if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ + (max_udp_size ? EDNSFIXEDSZ : 0))) { - free (buf); + ares_free (buf); return ARES_EBADNAME; } diff --git a/deps/cares/src/ares_expand_name.c b/deps/cares/src/ares_expand_name.c index 738be8dccb96bc..3a38e6737e93cf 100644 --- a/deps/cares/src/ares_expand_name.c +++ b/deps/cares/src/ares_expand_name.c @@ -32,6 +32,9 @@ #include "ares_nowarn.h" #include "ares_private.h" /* for the memdebug */ +/* Maximum number of indirections allowed for a name */ +#define MAX_INDIRS 50 + static int name_length(const unsigned char *encoded, const unsigned char *abuf, int alen); @@ -66,7 +69,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, char *q; const unsigned char *p; union { - ssize_t sig; + ares_ssize_t sig; size_t uns; } nlen; @@ -162,7 +165,8 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf, /* If we've seen more indirects than the message length, * then there's a loop. */ - if (++indir > alen) + ++indir; + if (indir > alen || indir > MAX_INDIRS) return -1; } else if (top == 0x00) diff --git a/deps/cares/src/ares_expand_string.c b/deps/cares/src/ares_expand_string.c index ed5476b91d866d..d35df752486ff8 100644 --- a/deps/cares/src/ares_expand_string.c +++ b/deps/cares/src/ares_expand_string.c @@ -41,7 +41,7 @@ int ares_expand_string(const unsigned char *encoded, { unsigned char *q; union { - ssize_t sig; + ares_ssize_t sig; size_t uns; } elen; diff --git a/deps/cares/src/ares_gethostbyaddr.c b/deps/cares/src/ares_gethostbyaddr.c index a0a90f6bb1712b..9258919a385699 100644 --- a/deps/cares/src/ares_gethostbyaddr.c +++ b/deps/cares/src/ares_gethostbyaddr.c @@ -157,7 +157,7 @@ static void addr_callback(void *arg, int status, int timeouts, } end_aquery(aquery, status, host); } - else if (status == ARES_EDESTRUCTION || status == ARES_ECANCELLED) + else if (status == ARES_EDESTRUCTION) end_aquery(aquery, status, NULL); else next_lookup(aquery); diff --git a/deps/cares/src/ares_getnameinfo.c b/deps/cares/src/ares_getnameinfo.c index 45161124caff91..c77b1f81537834 100644 --- a/deps/cares/src/ares_getnameinfo.c +++ b/deps/cares/src/ares_getnameinfo.c @@ -356,12 +356,9 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, #ifdef HAVE_IF_INDEXTONAME int is_ll, is_mcll; #endif - static const char fmt_u[] = "%u"; - static const char fmt_lu[] = "%lu"; char tmpbuf[IF_NAMESIZE + 2]; size_t bufl; - const char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))? - fmt_lu:fmt_u; + int is_scope_long = sizeof(addr6->sin6_scope_id) > sizeof(unsigned int); tmpbuf[0] = '%'; @@ -371,15 +368,38 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, if ((flags & ARES_NI_NUMERICSCOPE) || (!is_ll && !is_mcll)) { - sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); + if (is_scope_long) + { + sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); + } + else + { + sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); + } } else { if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL) - sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); + { + if (is_scope_long) + { + sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); + } + else + { + sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); + } + } } #else - sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id); + if (is_scope_long) + { + sprintf(&tmpbuf[1], "%lu", (unsigned long)addr6->sin6_scope_id); + } + else + { + sprintf(&tmpbuf[1], "%u", (unsigned int)addr6->sin6_scope_id); + } (void) flags; #endif tmpbuf[IF_NAMESIZE + 1] = '\0'; diff --git a/deps/cares/src/ares_init.c b/deps/cares/src/ares_init.c index f557947aa14373..f7b700bfd82cd7 100644 --- a/deps/cares/src/ares_init.c +++ b/deps/cares/src/ares_init.c @@ -84,7 +84,7 @@ static int config_sortlist(struct apattern **sortlist, int *nsort, const char *str); static int sortlist_alloc(struct apattern **sortlist, int *nsort, struct apattern *pat); -static int ip_addr(const char *s, ssize_t len, struct in_addr *addr); +static int ip_addr(const char *s, ares_ssize_t len, struct in_addr *addr); static void natural_mask(struct apattern *pat); #if !defined(WIN32) && !defined(WATT32) && \ !defined(ANDROID) && !defined(__ANDROID__) && !defined(CARES_USE_LIBRESOLV) @@ -166,6 +166,8 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, channel->sock_create_cb_data = NULL; channel->sock_config_cb = NULL; channel->sock_config_cb_data = NULL; + channel->sock_funcs = NULL; + channel->sock_func_cb_data = NULL; channel->last_server = 0; channel->last_timeout_processed = (time_t)now.tv_sec; @@ -292,6 +294,8 @@ int ares_dup(ares_channel *dest, ares_channel src) (*dest)->sock_create_cb_data = src->sock_create_cb_data; (*dest)->sock_config_cb = src->sock_config_cb; (*dest)->sock_config_cb_data = src->sock_config_cb_data; + (*dest)->sock_funcs = src->sock_funcs; + (*dest)->sock_func_cb_data = src->sock_func_cb_data; strncpy((*dest)->local_dev_name, src->local_dev_name, sizeof(src->local_dev_name)); @@ -828,6 +832,24 @@ static int get_DNS_Registry(char **outptr) return 1; } +static void commanjoin(char** dst, const char* const src, const size_t len) +{ + char *newbuf; + size_t newsize; + + /* 1 for terminating 0 and 2 for , and terminating 0 */ + newsize = len + (*dst ? (strlen(*dst) + 2) : 1); + newbuf = ares_realloc(*dst, newsize); + if (!newbuf) + return; + if (*dst == NULL) + *newbuf = '\0'; + *dst = newbuf; + if (strlen(*dst) != 0) + strcat(*dst, ","); + strncat(*dst, src, len); +} + /* * commajoin() * @@ -835,24 +857,7 @@ static int get_DNS_Registry(char **outptr) */ static void commajoin(char **dst, const char *src) { - char *tmp; - - if (*dst) - { - tmp = ares_malloc(strlen(*dst) + strlen(src) + 2); - if (!tmp) - return; - sprintf(tmp, "%s,%s", *dst, src); - ares_free(*dst); - *dst = tmp; - } - else - { - *dst = ares_malloc(strlen(src) + 1); - if (!*dst) - return; - strcpy(*dst, src); - } + commanjoin(dst, src, strlen(src)); } /* @@ -939,6 +944,116 @@ static int get_DNS_NetworkParams(char **outptr) return 1; } +static BOOL ares_IsWindowsVistaOrGreater(void) +{ + OSVERSIONINFO vinfo; + memset(&vinfo, 0, sizeof(vinfo)); + vinfo.dwOSVersionInfoSize = sizeof(vinfo); + if (!GetVersionEx(&vinfo) || vinfo.dwMajorVersion < 6) + return FALSE; + return TRUE; +} + +/* A structure to hold the string form of IPv4 and IPv6 addresses so we can + * sort them by a metric. + */ +typedef struct +{ + /* The metric we sort them by. */ + ULONG metric; + + /* Room enough for the string form of any IPv4 or IPv6 address that + * ares_inet_ntop() will create. Based on the existing c-ares practice. + */ + char text[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; +} Address; + +/* Sort Address values \a left and \a right by metric, returning the usual + * indicators for qsort(). + */ +static int compareAddresses(const void *arg1, + const void *arg2) +{ + const Address * const left = arg1; + const Address * const right = arg2; + if(left->metric < right->metric) return -1; + if(left->metric > right->metric) return 1; + return 0; +} + +/* There can be multiple routes to "the Internet". And there can be different + * DNS servers associated with each of the interfaces that offer those routes. + * We have to assume that any DNS server can serve any request. But, some DNS + * servers may only respond if requested over their associated interface. But + * we also want to use "the preferred route to the Internet" whenever possible + * (and not use DNS servers on a non-preferred route even by forcing request + * to go out on the associated non-preferred interface). i.e. We want to use + * the DNS servers associated with the same interface that we would use to + * make a general request to anything else. + * + * But, Windows won't sort the DNS servers by the metrics associated with the + * routes and interfaces _even_ though it obviously sends IP packets based on + * those same routes and metrics. So, we must do it ourselves. + * + * So, we sort the DNS servers by the same metric values used to determine how + * an outgoing IP packet will go, thus effectively using the DNS servers + * associated with the interface that the DNS requests themselves will + * travel. This gives us optimal routing and avoids issues where DNS servers + * won't respond to requests that don't arrive via some specific subnetwork + * (and thus some specific interface). + * + * This function computes the metric we use to sort. On the interface + * identified by \a luid, it determines the best route to \a dest and combines + * that route's metric with \a interfaceMetric to compute a metric for the + * destination address on that interface. This metric can be used as a weight + * to sort the DNS server addresses associated with each interface (lower is + * better). + * + * Note that by restricting the route search to the specific interface with + * which the DNS servers are associated, this function asks the question "What + * is the metric for sending IP packets to this DNS server?" which allows us + * to sort the DNS servers correctly. + */ +static ULONG getBestRouteMetric(IF_LUID * const luid, /* Can't be const :( */ + const SOCKADDR_INET * const dest, + const ULONG interfaceMetric) +{ + /* On this interface, get the best route to that destination. */ + MIB_IPFORWARD_ROW2 row; + SOCKADDR_INET ignored; + if(!ares_fpGetBestRoute2 || + ares_fpGetBestRoute2(/* The interface to use. The index is ignored since we are + * passing a LUID. + */ + luid, 0, + /* No specific source address. */ + NULL, + /* Our destination address. */ + dest, + /* No options. */ + 0, + /* The route row. */ + &row, + /* The best source address, which we don't need. */ + &ignored) != NO_ERROR + /* If the metric is "unused" (-1) or too large for us to add the two + * metrics, use the worst possible, thus sorting this last. + */ + || row.Metric == (ULONG)-1 + || row.Metric > ((ULONG)-1) - interfaceMetric) { + /* Return the worst possible metric. */ + return (ULONG)-1; + } + + /* Return the metric value from that row, plus the interface metric. + * + * See + * http://msdn.microsoft.com/en-us/library/windows/desktop/aa814494(v=vs.85).aspx + * which describes the combination as a "sum". + */ + return row.Metric + interfaceMetric; +} + /* * get_DNS_AdaptersAddresses() * @@ -965,14 +1080,19 @@ static int get_DNS_AdaptersAddresses(char **outptr) int trying = IPAA_MAX_TRIES; int res; + /* The capacity of addresses, in elements. */ + size_t addressesSize; + /* The number of elements in addresses. */ + size_t addressesIndex = 0; + /* The addresses we will sort. */ + Address *addresses; + union { struct sockaddr *sa; struct sockaddr_in *sa4; struct sockaddr_in6 *sa6; } namesrvr; - char txtaddr[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; - *outptr = NULL; /* Verify run-time availability of GetAdaptersAddresses() */ @@ -983,6 +1103,17 @@ static int get_DNS_AdaptersAddresses(char **outptr) if (!ipaa) return 0; + /* Start with enough room for a few DNS server addresses and we'll grow it + * as we encounter more. + */ + addressesSize = 4; + addresses = (Address*)ares_malloc(sizeof(Address) * addressesSize); + if(addresses == NULL) { + /* We need room for at least some addresses to function. */ + ares_free(ipaa); + return 0; + } + /* Usually this call suceeds with initial buffer size */ res = (*ares_fpGetAdaptersAddresses) (AF_UNSPEC, AddrFlags, NULL, ipaa, &ReqBufsz); @@ -1012,6 +1143,12 @@ static int get_DNS_AdaptersAddresses(char **outptr) if(ipaaEntry->OperStatus != IfOperStatusUp) continue; + /* For each interface, find any associated DNS servers as IPv4 or IPv6 + * addresses. For each found address, find the best route to that DNS + * server address _on_ _that_ _interface_ (at this moment in time) and + * compute the resulting total metric, just as Windows routing will do. + * Then, sort all the addresses found by the metric. + */ for (ipaDNSAddr = ipaaEntry->FirstDnsServerAddress; ipaDNSAddr; ipaDNSAddr = ipaDNSAddr->Next) @@ -1023,35 +1160,117 @@ static int get_DNS_AdaptersAddresses(char **outptr) if ((namesrvr.sa4->sin_addr.S_un.S_addr == INADDR_ANY) || (namesrvr.sa4->sin_addr.S_un.S_addr == INADDR_NONE)) continue; + + /* Allocate room for another address, if necessary, else skip. */ + if(addressesIndex == addressesSize) { + const size_t newSize = addressesSize + 4; + Address * const newMem = + (Address*)ares_realloc(addresses, sizeof(Address) * newSize); + if(newMem == NULL) { + continue; + } + addresses = newMem; + addressesSize = newSize; + } + + /* Vista required for Luid or Ipv4Metric */ + if (ares_IsWindowsVistaOrGreater()) + { + /* Save the address as the next element in addresses. */ + addresses[addressesIndex].metric = + getBestRouteMetric(&ipaaEntry->Luid, + (SOCKADDR_INET*)(namesrvr.sa), + ipaaEntry->Ipv4Metric); + } + else + { + addresses[addressesIndex].metric = -1; + } + if (! ares_inet_ntop(AF_INET, &namesrvr.sa4->sin_addr, - txtaddr, sizeof(txtaddr))) + addresses[addressesIndex].text, + sizeof(addresses[0].text))) { continue; + } + ++addressesIndex; } else if (namesrvr.sa->sa_family == AF_INET6) { if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any, sizeof(namesrvr.sa6->sin6_addr)) == 0) continue; + + /* Allocate room for another address, if necessary, else skip. */ + if(addressesIndex == addressesSize) { + const size_t newSize = addressesSize + 4; + Address * const newMem = + (Address*)ares_realloc(addresses, sizeof(Address) * newSize); + if(newMem == NULL) { + continue; + } + addresses = newMem; + addressesSize = newSize; + } + + /* Vista required for Luid or Ipv4Metric */ + if (ares_IsWindowsVistaOrGreater()) + { + /* Save the address as the next element in addresses. */ + addresses[addressesIndex].metric = + getBestRouteMetric(&ipaaEntry->Luid, + (SOCKADDR_INET*)(namesrvr.sa), + ipaaEntry->Ipv6Metric); + } + else + { + addresses[addressesIndex].metric = -1; + } + if (! ares_inet_ntop(AF_INET6, &namesrvr.sa6->sin6_addr, - txtaddr, sizeof(txtaddr))) + addresses[addressesIndex].text, + sizeof(addresses[0].text))) { continue; + } + ++addressesIndex; } - else + else { + /* Skip non-IPv4/IPv6 addresses completely. */ continue; + } + } + } - commajoin(outptr, txtaddr); + /* Sort all of the textual addresses by their metric. */ + qsort(addresses, addressesIndex, sizeof(*addresses), compareAddresses); - if (!*outptr) - goto done; + /* Join them all into a single string, removing duplicates. */ + { + size_t i; + for(i = 0; i < addressesIndex; ++i) { + size_t j; + /* Look for this address text appearing previously in the results. */ + for(j = 0; j < i; ++j) { + if(strcmp(addresses[j].text, addresses[i].text) == 0) { + break; + } + } + /* Iff we didn't emit this address already, emit it now. */ + if(j == i) { + /* Add that to outptr (if we can). */ + commajoin(outptr, addresses[i].text); + } } } done: + ares_free(addresses); + if (ipaa) ares_free(ipaa); - if (!*outptr) + if (!*outptr) { return 0; + } return 1; } @@ -1072,23 +1291,158 @@ static int get_DNS_AdaptersAddresses(char **outptr) */ static int get_DNS_Windows(char **outptr) { - /* - Use GetNetworkParams First in case of - multiple adapter is enabled on this machine. - GetAdaptersAddresses will retrive dummy dns servers. - That will slowing DNS lookup. - */ - /* Try using IP helper API GetNetworkParams() */ - if (get_DNS_NetworkParams(outptr)) + /* Try using IP helper API GetAdaptersAddresses(). IPv4 + IPv6, also sorts + * DNS servers by interface route metrics to try to use the best DNS server. */ + if (get_DNS_AdaptersAddresses(outptr)) return 1; - /* Try using IP helper API GetAdaptersAddresses() */ - if (get_DNS_AdaptersAddresses(outptr)) + /* Try using IP helper API GetNetworkParams(). IPv4 only. */ + if (get_DNS_NetworkParams(outptr)) return 1; /* Fall-back to registry information */ return get_DNS_Registry(outptr); } + +static void replace_comma_by_space(char* str) +{ + /* replace ',' by ' ' to coincide with resolv.conf search parameter */ + char *p; + for (p = str; *p != '\0'; p++) + { + if (*p == ',') + *p = ' '; + } +} + +/* Search if 'suffix' is containted in the 'searchlist'. Returns true if yes, + * otherwise false. 'searchlist' is a comma separated list of domain suffixes, + * 'suffix' is one domain suffix, 'len' is the length of 'suffix'. + * The search ignores case. E.g.: + * contains_suffix("abc.def,ghi.jkl", "ghi.JKL") returns true */ +static bool contains_suffix(const char* const searchlist, + const char* const suffix, const size_t len) +{ + const char* beg = searchlist; + const char* end; + if (!*suffix) + return true; + for (;;) + { + while (*beg && (ISSPACE(*beg) || (*beg == ','))) + ++beg; + if (!*beg) + return false; + end = beg; + while (*end && !ISSPACE(*end) && (*end != ',')) + ++end; + if (len == (end - beg) && !strnicmp(beg, suffix, len)) + return true; + beg = end; + } +} + +/* advances list to the next suffix within a comma separated search list. + * len is the length of the next suffix. */ +static size_t next_suffix(const char** list, const size_t advance) +{ + const char* beg = *list + advance; + const char* end; + while (*beg && (ISSPACE(*beg) || (*beg == ','))) + ++beg; + end = beg; + while (*end && !ISSPACE(*end) && (*end != ',')) + ++end; + *list = beg; + return end - beg; +} + +/* + * get_SuffixList_Windows() + * + * Reads the "DNS Suffix Search List" from registry and writes the list items + * whitespace separated to outptr. If the Search List is empty, the + * "Primary Dns Suffix" is written to outptr. + * + * Returns 0 and nullifies *outptr upon inability to return the suffix list. + * + * Returns 1 and sets *outptr when returning a dynamically allocated string. + * + * Implementation supports Windows Server 2003 and newer + */ +static int get_SuffixList_Windows(char **outptr) +{ + HKEY hKey, hKeyEnum; + char keyName[256]; + DWORD keyNameBuffSize; + DWORD keyIdx = 0; + char *p = NULL; + char *pp; + size_t len = 0; + + *outptr = NULL; + + if (ares__getplatform() != WIN_NT) + return 0; + + /* 1. Global DNS Suffix Search List */ + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, + KEY_READ, &hKey) == ERROR_SUCCESS) + { + if (get_REG_SZ(hKey, SEARCHLIST_KEY, outptr)) + replace_comma_by_space(*outptr); + RegCloseKey(hKey); + if (*outptr) + return 1; + } + + /* 2. Connection Specific Search List composed of: + * a. Primary DNS Suffix */ + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_DNSCLIENT, 0, + KEY_READ, &hKey) == ERROR_SUCCESS) + { + get_REG_SZ(hKey, PRIMARYDNSSUFFIX_KEY, outptr); + RegCloseKey(hKey); + } + if (!*outptr) + return 0; + + /* b. Interface SearchList, Domain, DhcpDomain */ + if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY "\\" INTERFACES_KEY, 0, + KEY_READ, &hKey) == ERROR_SUCCESS) + return 0; + for(;;) + { + keyNameBuffSize = sizeof(keyName); + if (RegEnumKeyEx(hKey, keyIdx++, keyName, &keyNameBuffSize, + 0, NULL, NULL, NULL) + != ERROR_SUCCESS) + break; + if (RegOpenKeyEx(hKey, keyName, 0, KEY_QUERY_VALUE, &hKeyEnum) + != ERROR_SUCCESS) + continue; + if (get_REG_SZ(hKeyEnum, SEARCHLIST_KEY, &p) || + get_REG_SZ(hKeyEnum, DOMAIN_KEY, &p) || + get_REG_SZ(hKeyEnum, DHCPDOMAIN_KEY, &p)) + { + /* p can be comma separated (SearchList) */ + pp = p; + while (len = next_suffix(&pp, len)) + { + if (!contains_suffix(*outptr, pp, len)) + commanjoin(outptr, pp, len); + } + ares_free(p); + p = NULL; + } + RegCloseKey(hKeyEnum); + } + RegCloseKey(hKey); + if (*outptr) + replace_comma_by_space(*outptr); + return *outptr != NULL; +} + #endif static int init_by_resolv_conf(ares_channel channel) @@ -1112,6 +1466,12 @@ static int init_by_resolv_conf(ares_channel channel) ares_free(line); } + if (channel->ndomains == -1 && get_SuffixList_Windows(&line)) + { + status = set_search(channel, line); + ares_free(line); + } + if (status == ARES_SUCCESS) status = ARES_EOF; else @@ -1950,7 +2310,7 @@ static char *try_config(char *s, const char *opt, char scc) } #endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ */ -static int ip_addr(const char *ipbuf, ssize_t len, struct in_addr *addr) +static int ip_addr(const char *ipbuf, ares_ssize_t len, struct in_addr *addr) { /* Four octets and three periods yields at most 15 characters. */ @@ -2103,6 +2463,14 @@ void ares_set_socket_configure_callback(ares_channel channel, channel->sock_config_cb_data = data; } +void ares_set_socket_functions(ares_channel channel, + const struct ares_socket_functions * funcs, + void *data) +{ + channel->sock_funcs = funcs; + channel->sock_func_cb_data = data; +} + int ares_set_sortlist(ares_channel channel, const char *sortstr) { int nsort = 0; diff --git a/deps/cares/src/ares_library_init.c b/deps/cares/src/ares_library_init.c index c885a16c807a8f..0a853d72cfa4e7 100644 --- a/deps/cares/src/ares_library_init.c +++ b/deps/cares/src/ares_library_init.c @@ -27,6 +27,7 @@ fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL; fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL; fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses = ZERO_NULL; +fpGetBestRoute2_t ares_fpGetBestRoute2 = ZERO_NULL; #endif /* library-private global vars with source visibility restricted to this file */ @@ -71,6 +72,15 @@ static int ares_win32_init(void) support Windows 2000 anymore */ } + ares_fpGetBestRoute2 = (fpGetBestRoute2_t) + GetProcAddress(hnd_iphlpapi, "GetBestRoute2"); + if (!ares_fpGetBestRoute2) + { + /* This can happen on clients before Vista, I don't + think it should be an error, unless we don't want to + support Windows XP anymore */ + } + /* * When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036, * also known as RtlGenRandom, which is the case for Windows versions prior diff --git a/deps/cares/src/ares_library_init.h b/deps/cares/src/ares_library_init.h index 59e5cc5893da27..2a2ba118b5fe32 100644 --- a/deps/cares/src/ares_library_init.h +++ b/deps/cares/src/ares_library_init.h @@ -28,13 +28,14 @@ typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*); typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG); typedef ULONG (WINAPI *fpGetAdaptersAddresses_t) ( ULONG, ULONG, void*, IP_ADAPTER_ADDRESSES*, ULONG* ); - +typedef NETIO_STATUS (WINAPI *fpGetBestRoute2_t) ( NET_LUID *, NET_IFINDEX, const SOCKADDR_INET *, const SOCKADDR_INET *, ULONG, PMIB_IPFORWARD_ROW2, SOCKADDR_INET * ); /* Forward-declaration of variables defined in ares_library_init.c */ /* that are global and unique instances for whole c-ares library. */ extern fpGetNetworkParams_t ares_fpGetNetworkParams; extern fpSystemFunction036_t ares_fpSystemFunction036; extern fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses; +extern fpGetBestRoute2_t ares_fpGetBestRoute2; #endif /* USE_WINSOCK */ diff --git a/deps/cares/src/ares_nowarn.c b/deps/cares/src/ares_nowarn.c index 7f9035c1a1ee8f..f63d9135ecc8d0 100644 --- a/deps/cares/src/ares_nowarn.c +++ b/deps/cares/src/ares_nowarn.c @@ -151,10 +151,10 @@ int aresx_sltosi(long slnum) } /* -** signed ssize_t to signed int +** signed ares_ssize_t to signed int */ -int aresx_sztosi(ssize_t sznum) +int aresx_sztosi(ares_ssize_t sznum) { #ifdef __INTEL_COMPILER # pragma warning(push) @@ -162,7 +162,7 @@ int aresx_sztosi(ssize_t sznum) #endif DEBUGASSERT(sznum >= 0); - return (int)(sznum & (ssize_t) CARES_MASK_SINT); + return (int)(sznum & (ares_ssize_t) CARES_MASK_SINT); #ifdef __INTEL_COMPILER # pragma warning(pop) @@ -170,10 +170,10 @@ int aresx_sztosi(ssize_t sznum) } /* -** signed ssize_t to unsigned int +** signed ares_ssize_t to unsigned int */ -unsigned int aresx_sztoui(ssize_t sznum) +unsigned int aresx_sztoui(ares_ssize_t sznum) { #ifdef __INTEL_COMPILER # pragma warning(push) @@ -181,7 +181,7 @@ unsigned int aresx_sztoui(ssize_t sznum) #endif DEBUGASSERT(sznum >= 0); - return (unsigned int)(sznum & (ssize_t) CARES_MASK_UINT); + return (unsigned int)(sznum & (ares_ssize_t) CARES_MASK_UINT); #ifdef __INTEL_COMPILER # pragma warning(pop) diff --git a/deps/cares/src/ares_nowarn.h b/deps/cares/src/ares_nowarn.h index 9b76d663259adf..505e62209810f0 100644 --- a/deps/cares/src/ares_nowarn.h +++ b/deps/cares/src/ares_nowarn.h @@ -25,9 +25,9 @@ short aresx_sitoss(int sinum); int aresx_sltosi(long slnum); -int aresx_sztosi(ssize_t sznum); +int aresx_sztosi(ares_ssize_t sznum); -unsigned int aresx_sztoui(ssize_t sznum); +unsigned int aresx_sztoui(ares_ssize_t sznum); unsigned short aresx_sitous(int sinum); diff --git a/deps/cares/src/ares_parse_naptr_reply.c b/deps/cares/src/ares_parse_naptr_reply.c index a14c226a9e7e25..717d355778117f 100644 --- a/deps/cares/src/ares_parse_naptr_reply.c +++ b/deps/cares/src/ares_parse_naptr_reply.c @@ -110,19 +110,18 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen, status = ARES_EBADRESP; break; } + /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ + if (rr_len < 7) + { + status = ARES_EBADRESP; + break; + } /* Check if we are really looking at a NAPTR record */ if (rr_class == C_IN && rr_type == T_NAPTR) { /* parse the NAPTR record itself */ - /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ - if (rr_len < 7) - { - status = ARES_EBADRESP; - break; - } - /* Allocate storage for this NAPTR answer appending it to the list */ naptr_curr = ares_malloc_data(ARES_DATATYPE_NAPTR_REPLY); if (!naptr_curr) diff --git a/deps/cares/src/ares_private.h b/deps/cares/src/ares_private.h index 33a23e76d1abcf..5d773869c72a97 100644 --- a/deps/cares/src/ares_private.h +++ b/deps/cares/src/ares_private.h @@ -54,10 +54,16 @@ #define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" #define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient" #define NAMESERVER "NameServer" #define DHCPNAMESERVER "DhcpNameServer" #define DATABASEPATH "DatabasePath" #define WIN_PATH_HOSTS "\\hosts" +#define SEARCHLIST_KEY "SearchList" +#define PRIMARYDNSSUFFIX_KEY "PrimaryDNSSuffix" +#define INTERFACES_KEY "Interfaces" +#define DOMAIN_KEY "Domain" +#define DHCPDOMAIN_KEY "DhcpDomain" #elif defined(WATT32) @@ -314,6 +320,9 @@ struct ares_channeldata { ares_sock_config_callback sock_config_cb; void *sock_config_cb_data; + + const struct ares_socket_functions * sock_funcs; + void *sock_func_cb_data; }; /* Memory management functions */ @@ -342,6 +351,8 @@ void ares__destroy_servers_state(ares_channel channel); long ares__tvdiff(struct timeval t1, struct timeval t2); #endif +void ares__socket_close(ares_channel, ares_socket_t); + #define ARES_SWAP_BYTE(a,b) \ { unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; } diff --git a/deps/cares/src/ares_process.c b/deps/cares/src/ares_process.c index 1d1e7b8b85f277..df85524f624cfd 100644 --- a/deps/cares/src/ares_process.c +++ b/deps/cares/src/ares_process.c @@ -1,6 +1,6 @@ /* Copyright 1998 by the Massachusetts Institute of Technology. - * Copyright (C) 2004-2016 by Daniel Stenberg + * Copyright (C) 2004-2017 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without @@ -29,6 +29,9 @@ #ifdef HAVE_NETDB_H # include #endif +#ifdef HAVE_ARPA_INET_H +# include +#endif #ifdef HAVE_ARPA_NAMESER_H # include #else @@ -65,7 +68,7 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, static void read_udp_packets(ares_channel channel, fd_set *read_fds, ares_socket_t read_fd, struct timeval *now); static void advance_tcp_send_queue(ares_channel channel, int whichserver, - ssize_t num_bytes); + ares_ssize_t num_bytes); static void process_timeouts(ares_channel channel, struct timeval *now); static void process_broken_connections(ares_channel channel, struct timeval *now); @@ -175,6 +178,26 @@ static int try_again(int errnum) return 0; } +static ares_ssize_t socket_writev(ares_channel channel, ares_socket_t s, const struct iovec * vec, int len) +{ + if (channel->sock_funcs) + return channel->sock_funcs->asendv(s, vec, len, channel->sock_func_cb_data); + + return writev(s, vec, len); +} + +static ares_ssize_t socket_write(ares_channel channel, ares_socket_t s, const void * data, size_t len) +{ + if (channel->sock_funcs) + { + struct iovec vec; + vec.iov_base = (void*)data; + vec.iov_len = len; + return channel->sock_funcs->asendv(s, &vec, 1, channel->sock_func_cb_data); + } + return swrite(s, data, len); +} + /* If any TCP sockets select true for writing, write out queued data * we have for them. */ @@ -187,8 +210,8 @@ static void write_tcp_data(ares_channel channel, struct send_request *sendreq; struct iovec *vec; int i; - ssize_t scount; - ssize_t wcount; + ares_ssize_t scount; + ares_ssize_t wcount; size_t n; if(!write_fds && (write_fd == ARES_SOCKET_BAD)) @@ -238,7 +261,7 @@ static void write_tcp_data(ares_channel channel, vec[n].iov_len = sendreq->len; n++; } - wcount = (ssize_t)writev(server->tcp_socket, vec, (int)n); + wcount = socket_writev(channel, server->tcp_socket, vec, (int)n); ares_free(vec); if (wcount < 0) { @@ -255,7 +278,7 @@ static void write_tcp_data(ares_channel channel, /* Can't allocate iovecs; just send the first request. */ sendreq = server->qhead; - scount = swrite(server->tcp_socket, sendreq->data, sendreq->len); + scount = socket_write(channel, server->tcp_socket, sendreq->data, sendreq->len); if (scount < 0) { if (!try_again(SOCKERRNO)) @@ -271,7 +294,7 @@ static void write_tcp_data(ares_channel channel, /* Consume the given number of bytes from the head of the TCP send queue. */ static void advance_tcp_send_queue(ares_channel channel, int whichserver, - ssize_t num_bytes) + ares_ssize_t num_bytes) { struct send_request *sendreq; struct server_state *server = &channel->servers[whichserver]; @@ -299,6 +322,38 @@ static void advance_tcp_send_queue(ares_channel channel, int whichserver, } } +static ares_ssize_t socket_recvfrom(ares_channel channel, + ares_socket_t s, + void * data, + size_t data_len, + int flags, + struct sockaddr *from, + ares_socklen_t *from_len) +{ + if (channel->sock_funcs) + return channel->sock_funcs->arecvfrom(s, data, data_len, + flags, from, from_len, + channel->sock_func_cb_data); + +#ifdef HAVE_RECVFROM + return recvfrom(s, data, data_len, flags, from, from_len); +#else + return sread(s, data, data_len); +#endif +} + +static ares_ssize_t socket_recv(ares_channel channel, + ares_socket_t s, + void * data, + size_t data_len) +{ + if (channel->sock_funcs) + return channel->sock_funcs->arecvfrom(s, data, data_len, 0, 0, 0, + channel->sock_func_cb_data); + + return sread(s, data, data_len); +} + /* If any TCP socket selects true for reading, read some data, * allocate a buffer if we finish reading the length word, and process * a packet if we finish reading one. @@ -308,7 +363,7 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, { struct server_state *server; int i; - ssize_t count; + ares_ssize_t count; if(!read_fds && (read_fd == ARES_SOCKET_BAD)) /* no possible action */ @@ -343,9 +398,9 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, /* We haven't yet read a length word, so read that (or * what's left to read of it). */ - count = sread(server->tcp_socket, - server->tcp_lenbuf + server->tcp_lenbuf_pos, - 2 - server->tcp_lenbuf_pos); + count = socket_recv(channel, server->tcp_socket, + server->tcp_lenbuf + server->tcp_lenbuf_pos, + 2 - server->tcp_lenbuf_pos); if (count <= 0) { if (!(count == -1 && try_again(SOCKERRNO))) @@ -373,9 +428,9 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, else { /* Read data into the allocated buffer. */ - count = sread(server->tcp_socket, - server->tcp_buffer + server->tcp_buffer_pos, - server->tcp_length - server->tcp_buffer_pos); + count = socket_recv(channel, server->tcp_socket, + server->tcp_buffer + server->tcp_buffer_pos, + server->tcp_length - server->tcp_buffer_pos); if (count <= 0) { if (!(count == -1 && try_again(SOCKERRNO))) @@ -406,7 +461,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds, { struct server_state *server; int i; - ssize_t count; + ares_ssize_t count; unsigned char buf[MAXENDSSZ + 1]; #ifdef HAVE_RECVFROM ares_socklen_t fromlen; @@ -453,16 +508,12 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds, count = 0; else { -#ifdef HAVE_RECVFROM if (server->addr.family == AF_INET) fromlen = sizeof(from.sa4); else fromlen = sizeof(from.sa6); - count = (ssize_t)recvfrom(server->udp_socket, (void *)buf, - sizeof(buf), 0, &from.sa, &fromlen); -#else - count = sread(server->udp_socket, buf, sizeof(buf)); -#endif + count = socket_recvfrom(channel, server->udp_socket, (void *)buf, + sizeof(buf), 0, &from.sa, &fromlen); } if (count == -1 && try_again(SOCKERRNO)) @@ -812,7 +863,7 @@ void ares__send_query(ares_channel channel, struct query *query, return; } } - if (swrite(server->udp_socket, query->qbuf, query->qlen) == -1) + if (socket_write(channel, server->udp_socket, query->qbuf, query->qlen) == -1) { /* FIXME: Handle EAGAIN here since it likely can happen. */ skip_server(channel, query, query->server); @@ -904,6 +955,10 @@ static int configure_socket(ares_socket_t s, int family, ares_channel channel) struct sockaddr_in6 sa6; } local; + /* do not set options for user-managed sockets */ + if (channel->sock_funcs) + return 0; + (void)setsocknonblock(s, TRUE); #if defined(FD_CLOEXEC) && !defined(MSDOS) @@ -959,6 +1014,30 @@ static int configure_socket(ares_socket_t s, int family, ares_channel channel) return 0; } +static ares_socket_t open_socket(ares_channel channel, int af, int type, int protocol) +{ + if (channel->sock_funcs != 0) + return channel->sock_funcs->asocket(af, + type, + protocol, + channel->sock_func_cb_data); + + return socket(af, type, protocol); +} + +static int connect_socket(ares_channel channel, ares_socket_t sockfd, + const struct sockaddr * addr, + ares_socklen_t addrlen) +{ + if (channel->sock_funcs != 0) + return channel->sock_funcs->aconnect(sockfd, + addr, + addrlen, + channel->sock_func_cb_data); + + return connect(sockfd, addr, addrlen); +} + static int open_tcp_socket(ares_channel channel, struct server_state *server) { ares_socket_t s; @@ -1003,14 +1082,14 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) } /* Acquire a socket. */ - s = socket(server->addr.family, SOCK_STREAM, 0); + s = open_socket(channel, server->addr.family, SOCK_STREAM, 0); if (s == ARES_SOCKET_BAD) return -1; /* Configure it. */ if (configure_socket(s, server->addr.family, channel) < 0) { - sclose(s); + ares__socket_close(channel, s); return -1; } @@ -1022,10 +1101,12 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) * so batching isn't very interesting. */ opt = 1; - if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, - (void *)&opt, sizeof(opt)) == -1) + if (channel->sock_funcs == 0 + && + setsockopt(s, IPPROTO_TCP, TCP_NODELAY, + (void *)&opt, sizeof(opt)) == -1) { - sclose(s); + ares__socket_close(channel, s); return -1; } #endif @@ -1036,19 +1117,19 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) channel->sock_config_cb_data); if (err < 0) { - sclose(s); + ares__socket_close(channel, s); return err; } } /* Connect to the server. */ - if (connect(s, sa, salen) == -1) + if (connect_socket(channel, s, sa, salen) == -1) { int err = SOCKERRNO; if (err != EINPROGRESS && err != EWOULDBLOCK) { - sclose(s); + ares__socket_close(channel, s); return -1; } } @@ -1059,7 +1140,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) channel->sock_create_cb_data); if (err < 0) { - sclose(s); + ares__socket_close(channel, s); return err; } } @@ -1114,14 +1195,14 @@ static int open_udp_socket(ares_channel channel, struct server_state *server) } /* Acquire a socket. */ - s = socket(server->addr.family, SOCK_DGRAM, 0); + s = open_socket(channel, server->addr.family, SOCK_DGRAM, 0); if (s == ARES_SOCKET_BAD) return -1; /* Set the socket non-blocking. */ if (configure_socket(s, server->addr.family, channel) < 0) { - sclose(s); + ares__socket_close(channel, s); return -1; } @@ -1131,19 +1212,19 @@ static int open_udp_socket(ares_channel channel, struct server_state *server) channel->sock_config_cb_data); if (err < 0) { - sclose(s); + ares__socket_close(channel, s); return err; } } /* Connect to the server. */ - if (connect(s, sa, salen) == -1) + if (connect_socket(channel, s, sa, salen) == -1) { int err = SOCKERRNO; if (err != EINPROGRESS && err != EWOULDBLOCK) { - sclose(s); + ares__socket_close(channel, s); return -1; } } @@ -1154,7 +1235,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server) channel->sock_create_cb_data); if (err < 0) { - sclose(s); + ares__socket_close(channel, s); return err; } } @@ -1357,3 +1438,11 @@ void ares__free_query(struct query *query) ares_free(query->server_info); ares_free(query); } + +void ares__socket_close(ares_channel channel, ares_socket_t s) +{ + if (channel->sock_funcs) + channel->sock_funcs->aclose(s, channel->sock_func_cb_data); + else + sclose(s); +} diff --git a/deps/cares/src/ares_writev.c b/deps/cares/src/ares_writev.c index 008efddc57377d..e812c09e1c5ced 100644 --- a/deps/cares/src/ares_writev.c +++ b/deps/cares/src/ares_writev.c @@ -25,12 +25,12 @@ #include "ares_private.h" #ifndef HAVE_WRITEV -ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt) +ares_ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt) { char *buffer, *bp; int i; size_t bytes = 0; - ssize_t result; + ares_ssize_t result; /* Validate iovcnt */ if (iovcnt <= 0) diff --git a/deps/cares/src/ares_writev.h b/deps/cares/src/ares_writev.h index 1a23a0f3d10929..65cea8708fc3db 100644 --- a/deps/cares/src/ares_writev.h +++ b/deps/cares/src/ares_writev.h @@ -29,7 +29,7 @@ struct iovec size_t iov_len; /* Length of data. */ }; -extern ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt); +extern ares_ssize_t ares_writev(ares_socket_t s, const struct iovec *iov, int iovcnt); #endif diff --git a/deps/cares/src/config-win32.h b/deps/cares/src/config-win32.h index dd955252bdf574..8d704745269ae3 100644 --- a/deps/cares/src/config-win32.h +++ b/deps/cares/src/config-win32.h @@ -216,20 +216,6 @@ #define HAVE_BOOL_T #endif -/* Define if ssize_t is not an available 'typedefed' type. */ -#ifndef _SSIZE_T_DEFINED -# if (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ - defined(__POCC__) || \ - defined(__MINGW32__) -# elif defined(_WIN64) -# define _SSIZE_T_DEFINED -# define ssize_t __int64 -# else -# define _SSIZE_T_DEFINED -# define ssize_t int -# endif -#endif - /* ---------------------------------------------------------------- */ /* TYPE SIZES */ /* ---------------------------------------------------------------- */ @@ -259,31 +245,19 @@ # define _CRT_NONSTDC_NO_DEPRECATE 1 #endif -/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows - 2000 as a supported build target. VS2008 default installations provide - an embedded Windows SDK v6.0A along with the claim that Windows 2000 is - a valid build target for VS2008. Popular belief is that binaries built - with VS2008 using Windows SDK versions 6.X and Windows 2000 as a build - target are functional. */ -#if defined(_MSC_VER) && (_MSC_VER >= 1500) -# define VS2008_MIN_TARGET 0x0500 -#endif - -/* When no build target is specified VS2008 default build target is Windows - Vista, which leaves out even Winsows XP. If no build target has been given - for VS2008 we will target the minimum Officially supported build target, - which happens to be Windows XP. */ +/* Set the Target to Vista. However, any symbols required above Win2000 + * should be loaded via LoadLibrary() */ #if defined(_MSC_VER) && (_MSC_VER >= 1500) -# define VS2008_DEF_TARGET 0x0501 +# define VS2008_MIN_TARGET 0x0600 #endif /* VS2008 default target settings and minimum build target check. */ #if defined(_MSC_VER) && (_MSC_VER >= 1500) # ifndef _WIN32_WINNT -# define _WIN32_WINNT VS2008_DEF_TARGET +# define _WIN32_WINNT VS2008_MIN_TARGET # endif # ifndef WINVER -# define WINVER VS2008_DEF_TARGET +# define WINVER VS2008_MIN_TARGET # endif # if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET) # error VS2008 does not support Windows build targets prior to Windows 2000 @@ -291,13 +265,13 @@ #endif /* When no build target is specified Pelles C 5.00 and later default build - target is Windows Vista. We override default target to be Windows 2000. */ + target is Windows Vista. */ #if defined(__POCC__) && (__POCC__ >= 500) # ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0500 +# define _WIN32_WINNT 0x0600 # endif # ifndef WINVER -# define WINVER 0x0500 +# define WINVER 0x0600 # endif #endif diff --git a/deps/cares/src/inet_net_pton.c b/deps/cares/src/inet_net_pton.c index b64fc5b1d17072..af1a534a05a18d 100644 --- a/deps/cares/src/inet_net_pton.c +++ b/deps/cares/src/inet_net_pton.c @@ -357,8 +357,8 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) * Since some memmove()'s erroneously fail to handle * overlapping regions, we'll do the shift by hand. */ - const ssize_t n = tp - colonp; - ssize_t i; + const ares_ssize_t n = tp - colonp; + ares_ssize_t i; if (tp == endp) goto enoent; diff --git a/deps/cares/src/setup_once.h b/deps/cares/src/setup_once.h index 25b144ae2fba94..a8cfe6beccddb7 100644 --- a/deps/cares/src/setup_once.h +++ b/deps/cares/src/setup_once.h @@ -131,7 +131,7 @@ struct timeval { #if defined(__minix) /* Minix doesn't support recv on TCP sockets */ -#define sread(x,y,z) (ssize_t)read((RECV_TYPE_ARG1)(x), \ +#define sread(x,y,z) (ares_ssize_t)read((RECV_TYPE_ARG1)(x), \ (RECV_TYPE_ARG2)(y), \ (RECV_TYPE_ARG3)(z)) @@ -167,7 +167,7 @@ struct timeval { Error Missing_definition_of_return_and_arguments_types_of_recv /* */ #else -#define sread(x,y,z) (ssize_t)recv((RECV_TYPE_ARG1)(x), \ +#define sread(x,y,z) (ares_ssize_t)recv((RECV_TYPE_ARG1)(x), \ (RECV_TYPE_ARG2)(y), \ (RECV_TYPE_ARG3)(z), \ (RECV_TYPE_ARG4)(0)) @@ -183,7 +183,7 @@ struct timeval { #if defined(__minix) /* Minix doesn't support send on TCP sockets */ -#define swrite(x,y,z) (ssize_t)write((SEND_TYPE_ARG1)(x), \ +#define swrite(x,y,z) (ares_ssize_t)write((SEND_TYPE_ARG1)(x), \ (SEND_TYPE_ARG2)(y), \ (SEND_TYPE_ARG3)(z)) @@ -198,7 +198,7 @@ struct timeval { Error Missing_definition_of_return_and_arguments_types_of_send /* */ #else -#define swrite(x,y,z) (ssize_t)send((SEND_TYPE_ARG1)(x), \ +#define swrite(x,y,z) (ares_ssize_t)send((SEND_TYPE_ARG1)(x), \ (SEND_TYPE_ARG2)(y), \ (SEND_TYPE_ARG3)(z), \ (SEND_TYPE_ARG4)(SEND_4TH_ARG)) @@ -228,7 +228,7 @@ struct timeval { Error Missing_definition_of_return_and_arguments_types_of_recvfrom /* */ #else -#define sreadfrom(s,b,bl,f,fl) (ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \ +#define sreadfrom(s,b,bl,f,fl) (ares_ssize_t)recvfrom((RECVFROM_TYPE_ARG1) (s), \ (RECVFROM_TYPE_ARG2 *)(b), \ (RECVFROM_TYPE_ARG3) (bl), \ (RECVFROM_TYPE_ARG4) (0), \ From 09caa661fcb85aa326c2d71745e685b15e2e606b Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Wed, 13 Sep 2017 19:43:43 +1000 Subject: [PATCH 4/7] deps: c-ares float, manual ares_ssize_t definition c-ares switched to using ares_ssize_t for platform-independent ssize_t, our GYP usage to include config//ares_config.h causes problems when including gyp as a library in core, i.e. in env.h and cares_wrap.h, where the defines don't get pulled in properly. This, so far, is the easiest approach to just making it work nicely--explicitly defining ares_ssize_t for the different Windows variants and ssize_t for non-Windows where we don't have a configured type from an ares_config.h. In all of our non-Windows platforms it is ssize_t anyway so this is safe. PR-URL: https://github.com/nodejs/node/pull/15378 --- deps/cares/include/ares_build.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/deps/cares/include/ares_build.h b/deps/cares/include/ares_build.h index f94bb2962a0540..f5535b38493fcb 100644 --- a/deps/cares/include/ares_build.h +++ b/deps/cares/include/ares_build.h @@ -194,14 +194,16 @@ /* Data type definition of ares_ssize_t. */ #ifdef _WIN32 # ifdef _WIN64 -# define CARES_TYPEOF_ARES_SSIZE_T __int64 + typedef __int64 ares_ssize_t; # else -# define CARES_TYPEOF_ARES_SSIZE_T long + typedef long ares_ssize_t; # endif #else -# define CARES_TYPEOF_ARES_SSIZE_T ssize_t; +# ifdef CARES_TYPEOF_ARES_SSIZE_T + typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; +# else + typedef ssize_t ares_ssize_t; +# endif #endif -typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t; - #endif /* __CARES_BUILD_H */ From 12767a7d2f745a20325118585d146a928f3c2819 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Wed, 15 May 2013 21:25:11 +0200 Subject: [PATCH 5/7] deps: c-ares float, win ipv6 bad fec0 prefix Was 72c5458aee: PR-URL: https://github.com/nodejs/node/pull/5090 Reviewed-By: Fedor Indutny Reimplemented for c-ares 1.13.0 PR-URL: https://github.com/nodejs/node/pull/15378 --- deps/cares/src/ares_init.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deps/cares/src/ares_init.c b/deps/cares/src/ares_init.c index f7b700bfd82cd7..94141a0c2fddd4 100644 --- a/deps/cares/src/ares_init.c +++ b/deps/cares/src/ares_init.c @@ -1196,6 +1196,11 @@ static int get_DNS_AdaptersAddresses(char **outptr) } else if (namesrvr.sa->sa_family == AF_INET6) { + /* Windows apparently always reports some IPv6 DNS servers that + * prefixed with fec0:0:0:ffff. These ususally do not point to + * working DNS servers, so we ignore them. */ + if (strncmp(addresses[addressesIndex].text, "fec0:0:0:ffff:", 14) == 0) + continue; if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any, sizeof(namesrvr.sa6->sin6_addr)) == 0) continue; From 2e1ba559dc9d7110e4c83c9f6c1125f15f635f43 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 15 Jul 2017 14:55:06 +0800 Subject: [PATCH 6/7] deps: cherry-pick 18ea996 from c-ares upstream Original commit message: ares_parse_naptr_reply: make buffer length check more accurate 9478908a490a6bf009ba58d81de8c1d06d50a117 introduced a length check for records parsed by `ares_parse_naptr_reply()`. However, that function is designed to parse replies which also contain non-NAPTR records; for A records, the `rr_len > 7` check will fail as there are only 4 bytes of payload. In particular, parsing ANY replies for NAPTR records was broken by that patch. Fix that by moving the check into the case in which it is already known that the record is a NAPTR record. Ref: https://github.com/c-ares/c-ares/commit/18ea99693d63f957ecb670045adbd2c1da8a4641 PR-URL: https://github.com/nodejs/node/pull/13883 Reviewed-By: James M Snell --- deps/cares/src/ares_parse_naptr_reply.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/deps/cares/src/ares_parse_naptr_reply.c b/deps/cares/src/ares_parse_naptr_reply.c index 717d355778117f..a14c226a9e7e25 100644 --- a/deps/cares/src/ares_parse_naptr_reply.c +++ b/deps/cares/src/ares_parse_naptr_reply.c @@ -110,18 +110,19 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen, status = ARES_EBADRESP; break; } - /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ - if (rr_len < 7) - { - status = ARES_EBADRESP; - break; - } /* Check if we are really looking at a NAPTR record */ if (rr_class == C_IN && rr_type == T_NAPTR) { /* parse the NAPTR record itself */ + /* RR must contain at least 7 bytes = 2 x int16 + 3 x name */ + if (rr_len < 7) + { + status = ARES_EBADRESP; + break; + } + /* Allocate storage for this NAPTR answer appending it to the list */ naptr_curr = ares_malloc_data(ARES_DATATYPE_NAPTR_REPLY); if (!naptr_curr) From b02613f28d623d656335f2798e2d25b5ae4e2cdd Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Mon, 14 Aug 2017 18:12:30 +0200 Subject: [PATCH 7/7] deps: cherry-pick 0ef4a0c64b6 from c-ares upstream Original commit message: gethostbyaddr: fail with `ECANCELLED` for `ares_cancel()` When `ares_cancel()` was invoked, `ares_gethostbyaddr()` queries would fail with `ENOTFOUND` instead of `ECANCELLED`. It seems appropriate to treat `ares_cancel()` like `ares_destroy()`, but I would appreciate review of the correctness of this change. Ref: https://github.com/nodejs/node/issues/14814 Fixes: https://github.com/nodejs/node/issues/14814 PR-URL: https://github.com/nodejs/node/pull/15023 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- deps/cares/src/ares_gethostbyaddr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/cares/src/ares_gethostbyaddr.c b/deps/cares/src/ares_gethostbyaddr.c index 9258919a385699..a0a90f6bb1712b 100644 --- a/deps/cares/src/ares_gethostbyaddr.c +++ b/deps/cares/src/ares_gethostbyaddr.c @@ -157,7 +157,7 @@ static void addr_callback(void *arg, int status, int timeouts, } end_aquery(aquery, status, host); } - else if (status == ARES_EDESTRUCTION) + else if (status == ARES_EDESTRUCTION || status == ARES_ECANCELLED) end_aquery(aquery, status, NULL); else next_lookup(aquery);