Commit cdc54afd authored by Jason Madden's avatar Jason Madden

Upgrade c-ares to 1.13.0. Fixes #990

parent bee87cfd
...@@ -80,6 +80,8 @@ ...@@ -80,6 +80,8 @@
- ``socket.send()`` now catches ``EPROTYPE`` on macOS to handle a race - ``socket.send()`` now catches ``EPROTYPE`` on macOS to handle a race
condition during shutdown. Fixed in :pr:`1035` by Jay Oster. condition during shutdown. Fixed in :pr:`1035` by Jay Oster.
- Update c-ares to 1.13.0. See :issue:`990`.
1.2.2 (2017-06-05) 1.2.2 (2017-06-05)
================== ==================
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -52,7 +52,7 @@ LFLAGS += debug all ...@@ -52,7 +52,7 @@ LFLAGS += debug all
CFLAGS += -d0 CFLAGS += -d0
!endif !endif
CFLAGS += -d_WIN32_WINNT=0x0501 CFLAGS += -d_WIN32_WINNT=0x0600
# #
# Change to suite. # Change to suite.
......
...@@ -38,8 +38,9 @@ lib_LTLIBRARIES = libcares.la ...@@ -38,8 +38,9 @@ lib_LTLIBRARIES = libcares.la
man_MANS = $(MANPAGES) man_MANS = $(MANPAGES)
MSVCFILES = vc/vc6aws.dsw vc/acountry/vc6acountry.dsp vc/adig/vc6adig.dsp \ MSVCFILES = vc/vc6aws.dsw vc/acountry/vc6acountry.dsp vc/adig/vc6adig.dsp \
vc/ahost/vc6ahost.dsp vc/cares/vc6cares.dsp vc/cares/vc6cares.dsw vc/ahost/vc6ahost.dsp vc/cares/vc6cares.dsp vc/cares/vc6cares.dsw \
msvc_ver.inc
if CURLDEBUG if CURLDEBUG
PROGS = PROGS =
...@@ -55,7 +56,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \ ...@@ -55,7 +56,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \ Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \ config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \ TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \
$(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL \ $(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL.md \
README.md LICENSE.md README.md LICENSE.md
CLEANFILES = $(PDFPAGES) $(HTMLPAGES) CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
......
...@@ -321,7 +321,7 @@ CTAGS = ctags ...@@ -321,7 +321,7 @@ CTAGS = ctags
CSCOPE = cscope CSCOPE = cscope
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \
$(srcdir)/ares_build.h.in $(srcdir)/ares_config.h.in \ $(srcdir)/ares_build.h.in $(srcdir)/ares_config.h.in \
$(srcdir)/libcares.pc.in AUTHORS INSTALL NEWS TODO compile \ $(srcdir)/libcares.pc.in AUTHORS NEWS TODO compile \
config.guess config.sub depcomp install-sh ltmain.sh missing \ config.guess config.sub depcomp install-sh ltmain.sh missing \
mkinstalldirs mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
...@@ -535,8 +535,9 @@ ACLOCAL_AMFLAGS = -I m4 ...@@ -535,8 +535,9 @@ ACLOCAL_AMFLAGS = -I m4
@CURLDEBUG_TRUE@ -I$(top_srcdir) $(am__append_4) @CURLDEBUG_TRUE@ -I$(top_srcdir) $(am__append_4)
lib_LTLIBRARIES = libcares.la lib_LTLIBRARIES = libcares.la
man_MANS = $(MANPAGES) man_MANS = $(MANPAGES)
MSVCFILES = vc/vc6aws.dsw vc/acountry/vc6acountry.dsp vc/adig/vc6adig.dsp \ MSVCFILES = vc/vc6aws.dsw vc/acountry/vc6acountry.dsp vc/adig/vc6adig.dsp \
vc/ahost/vc6ahost.dsp vc/cares/vc6cares.dsp vc/cares/vc6cares.dsw vc/ahost/vc6ahost.dsp vc/cares/vc6cares.dsp vc/cares/vc6cares.dsw \
msvc_ver.inc
@CURLDEBUG_FALSE@PROGS = ahost adig acountry @CURLDEBUG_FALSE@PROGS = ahost adig acountry
@CURLDEBUG_TRUE@PROGS = @CURLDEBUG_TRUE@PROGS =
...@@ -547,7 +548,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \ ...@@ -547,7 +548,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \ Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \ config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \ TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES) \
$(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL \ $(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL.md \
README.md LICENSE.md README.md LICENSE.md
CLEANFILES = $(PDFPAGES) $(HTMLPAGES) CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
...@@ -685,6 +686,7 @@ MANPAGES = ares_cancel.3 \ ...@@ -685,6 +686,7 @@ MANPAGES = ares_cancel.3 \
ares_init_options.3 \ ares_init_options.3 \
ares_library_cleanup.3 \ ares_library_cleanup.3 \
ares_library_init.3 \ ares_library_init.3 \
ares_library_initialized.3 \
ares_mkquery.3 \ ares_mkquery.3 \
ares_create_query.3 \ ares_create_query.3 \
ares_parse_a_reply.3 \ ares_parse_a_reply.3 \
...@@ -738,6 +740,7 @@ HTMLPAGES = ares_cancel.html \ ...@@ -738,6 +740,7 @@ HTMLPAGES = ares_cancel.html \
ares_init_options.html \ ares_init_options.html \
ares_library_cleanup.html \ ares_library_cleanup.html \
ares_library_init.html \ ares_library_init.html \
ares_library_initialized.html \
ares_mkquery.html \ ares_mkquery.html \
ares_create_query.html \ ares_create_query.html \
ares_parse_a_reply.html \ ares_parse_a_reply.html \
...@@ -790,6 +793,7 @@ PDFPAGES = ares_cancel.pdf \ ...@@ -790,6 +793,7 @@ PDFPAGES = ares_cancel.pdf \
ares_init_options.pdf \ ares_init_options.pdf \
ares_library_cleanup.pdf \ ares_library_cleanup.pdf \
ares_library_init.pdf \ ares_library_init.pdf \
ares_library_initialized.pdf \
ares_mkquery.pdf \ ares_mkquery.pdf \
ares_create_query.pdf \ ares_create_query.pdf \
ares_parse_a_reply.pdf \ ares_parse_a_reply.pdf \
......
...@@ -92,6 +92,7 @@ MANPAGES = ares_cancel.3 \ ...@@ -92,6 +92,7 @@ MANPAGES = ares_cancel.3 \
ares_init_options.3 \ ares_init_options.3 \
ares_library_cleanup.3 \ ares_library_cleanup.3 \
ares_library_init.3 \ ares_library_init.3 \
ares_library_initialized.3 \
ares_mkquery.3 \ ares_mkquery.3 \
ares_create_query.3 \ ares_create_query.3 \
ares_parse_a_reply.3 \ ares_parse_a_reply.3 \
...@@ -145,6 +146,7 @@ HTMLPAGES = ares_cancel.html \ ...@@ -145,6 +146,7 @@ HTMLPAGES = ares_cancel.html \
ares_init_options.html \ ares_init_options.html \
ares_library_cleanup.html \ ares_library_cleanup.html \
ares_library_init.html \ ares_library_init.html \
ares_library_initialized.html \
ares_mkquery.html \ ares_mkquery.html \
ares_create_query.html \ ares_create_query.html \
ares_parse_a_reply.html \ ares_parse_a_reply.html \
...@@ -197,6 +199,7 @@ PDFPAGES = ares_cancel.pdf \ ...@@ -197,6 +199,7 @@ PDFPAGES = ares_cancel.pdf \
ares_init_options.pdf \ ares_init_options.pdf \
ares_library_cleanup.pdf \ ares_library_cleanup.pdf \
ares_library_init.pdf \ ares_library_init.pdf \
ares_library_initialized.pdf \
ares_mkquery.pdf \ ares_mkquery.pdf \
ares_create_query.pdf \ ares_create_query.pdf \
ares_parse_a_reply.pdf \ ares_parse_a_reply.pdf \
......
...@@ -17,7 +17,7 @@ RANLIB = $(CROSSPREFIX)ranlib ...@@ -17,7 +17,7 @@ RANLIB = $(CROSSPREFIX)ranlib
#RM = rm -f #RM = rm -f
CP = cp -afv CP = cp -afv
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I. CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I. -D_WIN32_WINNT=0x0600
CFLAGS += -DCARES_STATICLIB CFLAGS += -DCARES_STATICLIB
LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
LIBS = -lwsock32 LIBS = -lwsock32
......
...@@ -184,7 +184,7 @@ CFLAGS = /UWIN32 /DWATT32 /I$(WATT_ROOT)\inc ...@@ -184,7 +184,7 @@ CFLAGS = /UWIN32 /DWATT32 /I$(WATT_ROOT)\inc
EX_LIBS_REL = $(WATT_ROOT)\lib\wattcpvc_imp.lib EX_LIBS_REL = $(WATT_ROOT)\lib\wattcpvc_imp.lib
EX_LIBS_DBG = $(WATT_ROOT)\lib\wattcpvc_imp_d.lib EX_LIBS_DBG = $(WATT_ROOT)\lib\wattcpvc_imp_d.lib
!ELSE !ELSE
CFLAGS = /DWIN32 CFLAGS = /DWIN32 /D_WIN32_WINNT=0x0600
EX_LIBS_REL = ws2_32.lib advapi32.lib kernel32.lib EX_LIBS_REL = ws2_32.lib advapi32.lib kernel32.lib
EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib
!ENDIF !ENDIF
......
...@@ -12,8 +12,9 @@ perform multiple DNS queries in parallel. The primary examples of such ...@@ -12,8 +12,9 @@ perform multiple DNS queries in parallel. The primary examples of such
applications are servers which communicate with multiple clients and programs applications are servers which communicate with multiple clients and programs
with graphical user interfaces. with graphical user interfaces.
The full source code is available in the 'c-ares' release archives, and in a The full source code is available in the ['c-ares' release archives](https://c-ares.haxx.se/download/),
git repository: http://github.com/c-ares/c-ares 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 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 regard to c-ares (or by all means the original ares too), get in touch with us
......
c-ares version 1.12.0 c-ares version 1.13.0
Changes: 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: Bug fixes:
o CVE-2016-5180: ares_create_query single byte out of buffer write [4] o CVE-2017-1000381: c-ares NAPTR parser out of bounds access [1]
o configure: acknowledge --disable-tests [1] o macos: do not set HAVE_CLOCK_GETTIME_MONOTONIC
o man pages: fix typos detected by Lintian o test: check ares_create_query with too-long name
o test: add missing #includes for dns-proto.cc o dist: add ares_library_initialized.* to the tarball
o test: avoid in6addr_* constants o fix build on OpenBSD
o test: Build with MinGW on AppVeyor o dist: ship msvc_ver.inc too [2]
o Makefile.m32: add support for extra flags o test: Add gTest/gMock files to SOURCES
o Makefile.m32: add support for CROSSPREFIX o test: add fuzz entrypoint for ares_create_query()
o configure: check if tests can get built before enabled o configure: clock_gettime workaround [3]
o ares_library_cleanup: reset ares_realloc too o docs: convert INSTALL to MarkDown & tweak [4]
o ahost.c: add cast to fix C++ compile o ares_process: fix return type of socket_create function (win32 warning)
o test: Only pass unused args to GoogleTest o docs: fixed references to ares_set_local_ip4 and ares_set_local_ip6
o build: commonize MSVC version detection o Windows DNS server sorting [6]
o msvc_ver.inc: support Visual Studio 2015 Update 1, 2, 3 o Use ares_socklen_t instead of socket_t [7]
o test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record o ares_create_query: use ares_free not naked free
o ares_getnameinfo: explicitly clear struct servent before use o msvc_ver.inc support most recent Visual Studio 2017 [8]
o test: Update fuzzing function prototype o acountry: Convert char from ISO-8859-1 to UTF-8 [9]
o init: fix nsort initialization o ares_expand_name: limit number of indirections
o test: add fuzzing check script to tests o configure: do not check for ar if specified manually [10]
o web: http => https o Added support for Windows DNS Suffix Search List [11]
o read_tcp_data: remove superfluous NULL check o ares.h: support compiling with QNX [12]
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: Thanks go to these friendly people for their efforts and contributions:
Alexander Drachevskiy, Brad House, Chris Araman, Daniel Stenberg, Aaron Bieber, Andrew Sullivan, Brad House, Bruce Stephens, Calle Wilund,
David Drysdale, Gregor Jasny, Svante Karlsson, Viktor Szakats 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: References to bug reports and discussions on issues:
[1] = https://github.com/c-ares/c-ares/issues/44 [1] = https://c-ares.haxx.se/adv_20170620.html
[2] = https://github.com/c-ares/c-ares/issues/60 [2] = https://github.com/c-ares/c-ares/issues/69
[3] = https://github.com/google/googletest/issues/705#issuecomment-235067917 [3] = https://github.com/c-ares/c-ares/issues/71
[4] = https://c-ares.haxx.se/adv_20160929.html [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
...@@ -273,7 +273,7 @@ static const struct search_list *list_lookup(int number, const struct search_lis ...@@ -273,7 +273,7 @@ static const struct search_list *list_lookup(int number, const struct search_lis
*/ */
static const struct search_list country_list[] = { static const struct search_list country_list[] = {
{ 4, "af", "Afghanistan" }, { 4, "af", "Afghanistan" },
{ 248, "ax", "land Island" }, { 248, "ax", "Åland Island" },
{ 8, "al", "Albania" }, { 8, "al", "Albania" },
{ 12, "dz", "Algeria" }, { 12, "dz", "Algeria" },
{ 16, "as", "American Samoa" }, { 16, "as", "American Samoa" },
......
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
require it! */ require it! */
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \ #if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \ defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY) || \
defined(ANDROID) || defined(__ANDROID__) defined(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
defined(__QNXNTO__)
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__)) #if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
...@@ -356,6 +357,27 @@ CARES_EXTERN void ares_set_socket_configure_callback(ares_channel channel, ...@@ -356,6 +357,27 @@ CARES_EXTERN void ares_set_socket_configure_callback(ares_channel channel,
CARES_EXTERN int ares_set_sortlist(ares_channel channel, CARES_EXTERN int ares_set_sortlist(ares_channel channel,
const char *sortstr); 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, CARES_EXTERN void ares_send(ares_channel channel,
const unsigned char *qbuf, const unsigned char *qbuf,
int qlen, int qlen,
......
...@@ -48,14 +48,14 @@ void ares__close_sockets(ares_channel channel, struct server_state *server) ...@@ -48,14 +48,14 @@ void ares__close_sockets(ares_channel channel, struct server_state *server)
if (server->tcp_socket != ARES_SOCKET_BAD) if (server->tcp_socket != ARES_SOCKET_BAD)
{ {
SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); 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_socket = ARES_SOCKET_BAD;
server->tcp_connection_generation = ++channel->tcp_connection_generation; server->tcp_connection_generation = ++channel->tcp_connection_generation;
} }
if (server->udp_socket != ARES_SOCKET_BAD) if (server->udp_socket != ARES_SOCKET_BAD)
{ {
SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); 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; server->udp_socket = ARES_SOCKET_BAD;
} }
} }
...@@ -191,4 +191,17 @@ ...@@ -191,4 +191,17 @@
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
#endif #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 */ #endif /* __CARES_BUILD_H */
...@@ -91,4 +91,10 @@ ...@@ -91,4 +91,10 @@
/* Data type definition of ares_socklen_t. */ /* Data type definition of ares_socklen_t. */
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
/* Integral data type used for ares_ssize_t. */
#undef CARES_TYPEOF_ARES_SSIZE_T
/* Data type definition of ares_ssize_t. */
typedef CARES_TYPEOF_ARES_SSIZE_T ares_ssize_t;
#endif /* __CARES_BUILD_H */ #endif /* __CARES_BUILD_H */
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
ares_cancel \- Cancel a resolve ares_cancel \- Cancel a resolve
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B void ares_cancel(ares_channel \fIchannel\fP) void ares_cancel(ares_channel \fIchannel\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The \fBares_cancel(3)\fP function cancels all lookups/requests made on the the The \fBares_cancel(3)\fP function cancels all lookups/requests made on the the
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
/* Definition to make a library symbol externally visible. */ /* Definition to make a library symbol externally visible. */
#undef CARES_SYMBOL_SCOPE_EXTERN #undef CARES_SYMBOL_SCOPE_EXTERN
/* the signed version of size_t */
#undef CARES_TYPEOF_ARES_SSIZE_T
/* Use resolver library to configure cares */ /* Use resolver library to configure cares */
#undef CARES_USE_LIBRESOLV #undef CARES_USE_LIBRESOLV
...@@ -496,6 +499,3 @@ ...@@ -496,6 +499,3 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t #undef size_t
/* the signed version of size_t */
#undef ssize_t
...@@ -134,7 +134,7 @@ int ares_create_query(const char *name, int dnsclass, int type, ...@@ -134,7 +134,7 @@ int ares_create_query(const char *name, int dnsclass, int type,
while (*name) while (*name)
{ {
if (*name == '.') { if (*name == '.') {
free (buf); ares_free (buf);
return ARES_EBADNAME; return ARES_EBADNAME;
} }
...@@ -147,7 +147,7 @@ int ares_create_query(const char *name, int dnsclass, int type, ...@@ -147,7 +147,7 @@ int ares_create_query(const char *name, int dnsclass, int type,
len++; len++;
} }
if (len > MAXLABEL) { if (len > MAXLABEL) {
free (buf); ares_free (buf);
return ARES_EBADNAME; return ARES_EBADNAME;
} }
...@@ -190,7 +190,7 @@ int ares_create_query(const char *name, int dnsclass, int type, ...@@ -190,7 +190,7 @@ int ares_create_query(const char *name, int dnsclass, int type,
* to 255 octets or less."). */ * to 255 octets or less."). */
if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ + if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ +
(max_udp_size ? EDNSFIXEDSZ : 0))) { (max_udp_size ? EDNSFIXEDSZ : 0))) {
free (buf); ares_free (buf);
return ARES_EBADNAME; return ARES_EBADNAME;
} }
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
ares_destroy \- Destroy a resolver channel ares_destroy \- Destroy a resolver channel
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B void ares_destroy(ares_channel \fIchannel\fP) void ares_destroy(ares_channel \fIchannel\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The \fBares_destroy(3)\fP function destroys the name service channel The \fBares_destroy(3)\fP function destroys the name service channel
...@@ -28,7 +28,7 @@ identified by \fIchannel\fP, freeing all memory and closing all sockets used ...@@ -28,7 +28,7 @@ identified by \fIchannel\fP, freeing all memory and closing all sockets used
by the channel. by the channel.
\fBares_destroy(3)\fP invokes the callbacks for each pending query on the \fBares_destroy(3)\fP invokes the callbacks for each pending query on the
channel, passing a status of \IARES_EDESTRUCTION\fP. These calls give the channel, passing a status of \fIARES_EDESTRUCTION\fP. These calls give the
callbacks a chance to clean up any state which might have been stored in their callbacks a chance to clean up any state which might have been stored in their
arguments. A callback must not add new requests to a channel being destroyed. arguments. A callback must not add new requests to a channel being destroyed.
.SH SEE ALSO .SH SEE ALSO
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
#include "ares_nowarn.h" #include "ares_nowarn.h"
#include "ares_private.h" /* for the memdebug */ #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, static int name_length(const unsigned char *encoded, const unsigned char *abuf,
int alen); int alen);
...@@ -66,7 +69,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, ...@@ -66,7 +69,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
char *q; char *q;
const unsigned char *p; const unsigned char *p;
union { union {
ssize_t sig; ares_ssize_t sig;
size_t uns; size_t uns;
} nlen; } nlen;
...@@ -162,7 +165,8 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf, ...@@ -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, /* If we've seen more indirects than the message length,
* then there's a loop. * then there's a loop.
*/ */
if (++indir > alen) ++indir;
if (indir > alen || indir > MAX_INDIRS)
return -1; return -1;
} }
else if (top == 0x00) else if (top == 0x00)
......
...@@ -41,7 +41,7 @@ int ares_expand_string(const unsigned char *encoded, ...@@ -41,7 +41,7 @@ int ares_expand_string(const unsigned char *encoded,
{ {
unsigned char *q; unsigned char *q;
union { union {
ssize_t sig; ares_ssize_t sig;
size_t uns; size_t uns;
} elen; } elen;
......
...@@ -15,43 +15,30 @@ ...@@ -15,43 +15,30 @@
.\" .\"
.TH ARES_FDS 3 "23 July 1998" .TH ARES_FDS 3 "23 July 1998"
.SH NAME .SH NAME
ares_fds \- Get file descriptors to select on for name service ares_fds \- return file descriptors to select on
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B int ares_fds(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP, int ares_fds(ares_channel \fIchannel\fP,
.B fd_set *\fIwrite_fds\fP) fd_set *\fIread_fds\fP,
fd_set *\fIwrite_fds\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The \fBares_fds(3)\fP function retrieves the set of file descriptors which the
.B ares_fds calling application should select on for reading and writing for the
function retrieves the set of file descriptors which the calling
application should select on for reading and writing for the
processing of name service queries pending on the name service channel processing of name service queries pending on the name service channel
identified by identified by \fIchannel\fP.
.IR channel .
File descriptors will be set in the file descriptor sets pointed to by File descriptors will be set in the file descriptor sets pointed to by
.I read_fds \fIread_fds\fP and \fIwrite_fds\fP as appropriate. File descriptors already
and set in \fIread_fds\fP and \fIwrite_fds\fP will remain set; initialization of
.I write_fds the file descriptor sets (using \fBFD_ZERO\fP) is the responsibility of the
as appropriate. File descriptors already set in caller.
.I read_fds
and
.I write_fds
will remain set; initialization of the file descriptor sets
(using
.BR FD_ZERO )
is the responsibility of the caller.
.SH RETURN VALUES .SH RETURN VALUES
.B ares_fds \fBares_fds(3)\fP returns a value that is one greater than the number of the
returns one greater than the number of the highest socket set in either highest socket set in either \fIread_fds\fP or \fIwrite_fds\fP. If no queries
.I read_fds are active, \fBares_fds(3)\fP returns 0.
or
.IR write_fds .
If no queries are active,
.B ares_fds
will return 0.
.SH SEE ALSO .SH SEE ALSO
.BR ares_timeout (3), .BR ares_timeout (3),
.BR ares_process (3) .BR ares_process (3)
......
...@@ -356,12 +356,9 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, ...@@ -356,12 +356,9 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags,
#ifdef HAVE_IF_INDEXTONAME #ifdef HAVE_IF_INDEXTONAME
int is_ll, is_mcll; int is_ll, is_mcll;
#endif #endif
static const char fmt_u[] = "%u";
static const char fmt_lu[] = "%lu";
char tmpbuf[IF_NAMESIZE + 2]; char tmpbuf[IF_NAMESIZE + 2];
size_t bufl; size_t bufl;
const char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))? int is_scope_long = sizeof(addr6->sin6_scope_id) > sizeof(unsigned int);
fmt_lu:fmt_u;
tmpbuf[0] = '%'; tmpbuf[0] = '%';
...@@ -371,15 +368,38 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, ...@@ -371,15 +368,38 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags,
if ((flags & ARES_NI_NUMERICSCOPE) || if ((flags & ARES_NI_NUMERICSCOPE) ||
(!is_ll && !is_mcll)) (!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 else
{ {
if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL) 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 #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; (void) flags;
#endif #endif
tmpbuf[IF_NAMESIZE + 1] = '\0'; tmpbuf[IF_NAMESIZE + 1] = '\0';
......
This diff is collapsed.
...@@ -21,6 +21,27 @@ ares_init_options \- Initialize a resolver channel ...@@ -21,6 +21,27 @@ ares_init_options \- Initialize a resolver channel
.nf .nf
#include <ares.h> #include <ares.h>
struct ares_options {
int flags;
int timeout; /* in seconds or milliseconds, depending on options */
int tries;
int ndots;
unsigned short udp_port;
unsigned short tcp_port;
int socket_send_buffer_size;
int socket_receive_buffer_size;
struct in_addr *servers;
int nservers;
char **domains;
int ndomains;
char *lookups;
ares_sock_state_cb sock_state_cb;
void *sock_state_cb_data;
struct apattern *sortlist;
int nsort;
int ednspsz;
};
int ares_init_options(ares_channel *\fIchannelptr\fP, int ares_init_options(ares_channel *\fIchannelptr\fP,
struct ares_options *\fIoptions\fP, struct ares_options *\fIoptions\fP,
int \fIoptmask\fP) int \fIoptmask\fP)
......
...@@ -19,11 +19,9 @@ ...@@ -19,11 +19,9 @@
ares_library_cleanup \- c-ares library deinitialization ares_library_cleanup \- c-ares library deinitialization
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B void ares_library_cleanup(void) void ares_library_cleanup(void)
.PP
.B cc file.c -lcares
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
.PP .PP
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL; fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL;
fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL; fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL;
fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses = ZERO_NULL; fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses = ZERO_NULL;
fpGetBestRoute2_t ares_fpGetBestRoute2 = ZERO_NULL;
#endif #endif
/* library-private global vars with source visibility restricted to this file */ /* library-private global vars with source visibility restricted to this file */
...@@ -71,6 +72,15 @@ static int ares_win32_init(void) ...@@ -71,6 +72,15 @@ static int ares_win32_init(void)
support Windows 2000 anymore */ 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, * When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036,
* also known as RtlGenRandom, which is the case for Windows versions prior * also known as RtlGenRandom, which is the case for Windows versions prior
......
...@@ -28,13 +28,14 @@ ...@@ -28,13 +28,14 @@
typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*); typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*);
typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG); typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG);
typedef ULONG (WINAPI *fpGetAdaptersAddresses_t) ( ULONG, ULONG, void*, IP_ADAPTER_ADDRESSES*, 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 */ /* Forward-declaration of variables defined in ares_library_init.c */
/* that are global and unique instances for whole c-ares library. */ /* that are global and unique instances for whole c-ares library. */
extern fpGetNetworkParams_t ares_fpGetNetworkParams; extern fpGetNetworkParams_t ares_fpGetNetworkParams;
extern fpSystemFunction036_t ares_fpSystemFunction036; extern fpSystemFunction036_t ares_fpSystemFunction036;
extern fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses; extern fpGetAdaptersAddresses_t ares_fpGetAdaptersAddresses;
extern fpGetBestRoute2_t ares_fpGetBestRoute2;
#endif /* USE_WINSOCK */ #endif /* USE_WINSOCK */
......
.\"
.\" Copyright (C) 2016 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.
.\"
.TH ARES_LIBRARY_INITIALIZED 3 "29 Sep 2016"
.SH NAME
ares_library_initialized \- get the initialization state
.SH SYNOPSIS
.nf
#include <ares.h>
int ares_library_initialized(void)
.fi
.SH DESCRIPTION
Returns information if c-ares needs to get initialized.
.SH RETURN VALUE
\fIARES_ENOTINITIALIZED\fP if not initialized and \fIARES_SUCCESS\fP if no
initialization is needed.
.SH AVAILABILITY
This function was first introduced in c-ares version 1.11.0
.SH SEE ALSO
.BR ares_library_init(3),
.BR ares_library_cleanup(3)
...@@ -151,10 +151,10 @@ int aresx_sltosi(long slnum) ...@@ -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 #ifdef __INTEL_COMPILER
# pragma warning(push) # pragma warning(push)
...@@ -162,7 +162,7 @@ int aresx_sztosi(ssize_t sznum) ...@@ -162,7 +162,7 @@ int aresx_sztosi(ssize_t sznum)
#endif #endif
DEBUGASSERT(sznum >= 0); DEBUGASSERT(sznum >= 0);
return (int)(sznum & (ssize_t) CARES_MASK_SINT); return (int)(sznum & (ares_ssize_t) CARES_MASK_SINT);
#ifdef __INTEL_COMPILER #ifdef __INTEL_COMPILER
# pragma warning(pop) # pragma warning(pop)
...@@ -170,10 +170,10 @@ int aresx_sztosi(ssize_t sznum) ...@@ -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 #ifdef __INTEL_COMPILER
# pragma warning(push) # pragma warning(push)
...@@ -181,7 +181,7 @@ unsigned int aresx_sztoui(ssize_t sznum) ...@@ -181,7 +181,7 @@ unsigned int aresx_sztoui(ssize_t sznum)
#endif #endif
DEBUGASSERT(sznum >= 0); 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 #ifdef __INTEL_COMPILER
# pragma warning(pop) # pragma warning(pop)
......
...@@ -25,9 +25,9 @@ short aresx_sitoss(int sinum); ...@@ -25,9 +25,9 @@ short aresx_sitoss(int sinum);
int aresx_sltosi(long slnum); 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); unsigned short aresx_sitous(int sinum);
......
...@@ -110,6 +110,12 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen, ...@@ -110,6 +110,12 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen,
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; 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 */ /* Check if we are really looking at a NAPTR record */
if (rr_class == C_IN && rr_type == T_NAPTR) if (rr_class == C_IN && rr_type == T_NAPTR)
...@@ -185,4 +191,3 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen, ...@@ -185,4 +191,3 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen,
return ARES_SUCCESS; return ARES_SUCCESS;
} }
...@@ -54,10 +54,16 @@ ...@@ -54,10 +54,16 @@
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" #define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" #define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
#define WIN_DNSCLIENT "Software\\Policies\\Microsoft\\System\\DNSClient"
#define NAMESERVER "NameServer" #define NAMESERVER "NameServer"
#define DHCPNAMESERVER "DhcpNameServer" #define DHCPNAMESERVER "DhcpNameServer"
#define DATABASEPATH "DatabasePath" #define DATABASEPATH "DatabasePath"
#define WIN_PATH_HOSTS "\\hosts" #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) #elif defined(WATT32)
...@@ -314,6 +320,9 @@ struct ares_channeldata { ...@@ -314,6 +320,9 @@ struct ares_channeldata {
ares_sock_config_callback sock_config_cb; ares_sock_config_callback sock_config_cb;
void *sock_config_cb_data; void *sock_config_cb_data;
const struct ares_socket_functions * sock_funcs;
void *sock_func_cb_data;
}; };
/* Memory management functions */ /* Memory management functions */
...@@ -342,6 +351,8 @@ void ares__destroy_servers_state(ares_channel channel); ...@@ -342,6 +351,8 @@ void ares__destroy_servers_state(ares_channel channel);
long ares__tvdiff(struct timeval t1, struct timeval t2); long ares__tvdiff(struct timeval t1, struct timeval t2);
#endif #endif
void ares__socket_close(ares_channel, ares_socket_t);
#define ARES_SWAP_BYTE(a,b) \ #define ARES_SWAP_BYTE(a,b) \
{ unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; } { unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; }
......
...@@ -18,15 +18,15 @@ ...@@ -18,15 +18,15 @@
ares_process \- Process events for name resolution ares_process \- Process events for name resolution
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B void ares_process(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP, void ares_process(ares_channel \fIchannel\fP,
.B fd_set *\fIwrite_fds\fP) fd_set *\fIread_fds\fP,
.fi fd_set *\fIwrite_fds\fP)
.PP
.B void ares_process_fd(ares_channel \fIchannel\fP, void ares_process_fd(ares_channel \fIchannel\fP,
.B ares_socket_t \fIread_fd\fP, ares_socket_t \fIread_fd\fP,
.B ares_socket_t \fIwrite_fd\fP) ares_socket_t \fIwrite_fd\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The \fBares_process(3)\fP function handles input/output events and timeouts The \fBares_process(3)\fP function handles input/output events and timeouts
...@@ -35,42 +35,36 @@ associated with queries pending on the name service channel identified by ...@@ -35,42 +35,36 @@ associated with queries pending on the name service channel identified by
The file descriptor sets pointed to by \fIread_fds\fP and \fIwrite_fds\fP The file descriptor sets pointed to by \fIread_fds\fP and \fIwrite_fds\fP
should have file descriptors set in them according to whether the file should have file descriptors set in them according to whether the file
descriptors specified by \fIares_fds(3)\fP are ready for reading and writing. descriptors specified by \fIares_fds(3)\fP are ready for reading and writing.
(The easiest way to determine this information is to invoke (The easiest way to determine this information is to invoke \fBselect(3)\fP
.B select with a timeout no greater than the timeout given by \fIares_timeout(3)\fP).
with a timeout no greater than the timeout given by \fIares_timeout(3)\fP ).
.PP The \fBares_process(3)\fP function will invoke callbacks for pending queries
The if they complete successfully or fail.
.B ares_process
function will invoke callbacks for pending queries if they complete
successfully or fail.
\fBares_process_fd(3)\fP works the same way but acts and operates only on the \fBares_process_fd(3)\fP works the same way but acts and operates only on the
specific file descriptors (sockets) you pass in to the function. Use specific file descriptors (sockets) you pass in to the function. Use
ARES_SOCKET_BAD for "no action". This function is of course provided to allow ARES_SOCKET_BAD for "no action". This function is provided to allow users of
users of c-ares to void select() in their applications and within c-ares. c-ares to void \fIselect(3)\fP in their applications and within c-ares.
.SS EXAMPLE .SH EXAMPLE
The following code fragment waits for all pending queries on a channel The following code fragment waits for all pending queries on a channel
to complete: to complete:
.PP
.RS
.nf .nf
int nfds, count; int nfds, count;
fd_set readers, writers; fd_set readers, writers;
struct timeval tv, *tvp; struct timeval tv, *tvp;
while (1) while (1) {
{ FD_ZERO(&readers);
FD_ZERO(&readers); FD_ZERO(&writers);
FD_ZERO(&writers); nfds = ares_fds(channel, &readers, &writers);
nfds = ares_fds(channel, &readers, &writers); if (nfds == 0)
if (nfds == 0) break;
break; tvp = ares_timeout(channel, NULL, &tv);
tvp = ares_timeout(channel, NULL, &tv); count = select(nfds, &readers, &writers, NULL, tvp);
count = select(nfds, &readers, &writers, NULL, tvp); ares_process(channel, &readers, &writers);
ares_process(channel, &readers, &writers); }
}
.fi .fi
.RE
.SH SEE ALSO .SH SEE ALSO
.BR ares_fds (3), .BR ares_fds (3),
.BR ares_timeout (3) .BR ares_timeout (3)
......
This diff is collapsed.
...@@ -31,8 +31,8 @@ for the option to work. If SO_BINDTODEVICE is not supported or the ...@@ -31,8 +31,8 @@ for the option to work. If SO_BINDTODEVICE is not supported or the
setsocktop call fails (probably because of permissions), the error is setsocktop call fails (probably because of permissions), the error is
silently ignored. silently ignored.
.SH SEE ALSO .SH SEE ALSO
.BR ares_set_local_ipv4 (3) .BR ares_set_local_ip4 (3)
.BR ares_set_local_ipv6 (3) .BR ares_set_local_ip6 (3)
.SH NOTES .SH NOTES
This function was added in c-ares 1.7.4 This function was added in c-ares 1.7.4
.SH AUTHOR .SH AUTHOR
......
...@@ -18,43 +18,28 @@ ...@@ -18,43 +18,28 @@
ares_timeout \- return maximum time to wait ares_timeout \- return maximum time to wait
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B struct timeval *ares_timeout(ares_channel \fIchannel\fP, struct timeval *ares_timeout(ares_channel \fIchannel\fP,
.B struct timeval *\fImaxtv\fP, struct timeval *\fItv\fP) struct timeval *\fImaxtv\fP,
struct timeval *\fItv\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The \fBares_timeout(3)\fP function determines the maximum time for which the
.B ares_timeout caller should wait before invoking \fIares_process(3)\fP to process timeouts.
function determines the maximum time for which the caller should wait before The parameter \fImaxtv\fP specifies a existing maximum timeout, or \fBNULL\fP
invoking \fIares_process(3)\fP to process timeouts. The parameter
.I maxtv
specifies a existing maximum timeout, or
.B NULL
if the caller does not wish to apply a maximum timeout. The parameter if the caller does not wish to apply a maximum timeout. The parameter
.I tv \fItv\fP must point to a writable buffer of type \fBstruct timeval\fP It is
must point to a writable buffer of type valid for \fImaxtv\fP and \fItv\fP to have the same value.
.BR "struct timeval" .
It is valid for If no queries have timeouts pending sooner than the given maximum timeout,
.I maxtv \fBares_timeout(3)\fP returns the value of \fImaxtv\fP; otherwise
and \fBares_timeout(3)\fP stores the appropriate timeout value into the buffer
.I tv pointed to by \fItv\fP and returns the value of \fItv\fP.
to have the same value.
.PP
If no queries have timeouts pending sooner than the given maximum
timeout,
.B ares_timeout
returns the value of
.IR maxtv;
otherwise
.B ares_timeout
stores the appropriate timeout value into the buffer pointed to by
.I tv
and returns the value of
.IR tv .
.SH SEE ALSO .SH SEE ALSO
.BR ares_fds (3), .BR ares_fds (3),
.BR ares_process (3) .BR ares_process (3),
.BR ares_process_fd (3)
.SH AUTHOR .SH AUTHOR
Greg Hudson, MIT Information Systems Greg Hudson, MIT Information Systems
.br .br
......
...@@ -18,23 +18,18 @@ ...@@ -18,23 +18,18 @@
ares_version \- Get the version number of the library ares_version \- Get the version number of the library
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> #include <ares.h>
.PP
.B const char *ares_version(int *\fIversion\fP) const char *ares_version(int *\fIversion\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The \fBares_version(3)\fP function gets the library version as a string and
.B ares_version optionally as an integer stored in the \fIversion\fP argument. If you pass a
function gets the library version as a string and optionally as an integer NULL, no integer is attempted to be returned.
stored in the
.IR version ,
argument. If you pass a NULL, no integer is attempted to be returned.
The integer is built up as 24bit number, with 8 separate bits used for major The integer is built up as 24bit number, with 8 separate bits used for major
number, minor number and patch number. This makes a version string such as number, minor number and patch number. This makes a version string such as
1.2.3 will be returned as the hexadecimal number 0x010203 (decimal 66051). 1.2.3 will be returned as the hexadecimal number 0x010203 (decimal 66051).
.SH NOTES .SH "SEE ALSO"
This function is not compatible with ares. .BR ares_init (3),
.SH AUTHOR .BR ares_library_init (3)
Daniel Stenberg
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
#define ARES_COPYRIGHT "2004 - 2016 Daniel Stenberg, <daniel@haxx.se>." #define ARES_COPYRIGHT "2004 - 2016 Daniel Stenberg, <daniel@haxx.se>."
#define ARES_VERSION_MAJOR 1 #define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 12 #define ARES_VERSION_MINOR 13
#define ARES_VERSION_PATCH 0 #define ARES_VERSION_PATCH 0
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH)) (ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.12.0" #define ARES_VERSION_STR "1.13.0"
#if (ARES_VERSION >= 0x010700) #if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1 # define CARES_HAVE_ARES_LIBRARY_INIT 1
......
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
#include "ares_private.h" #include "ares_private.h"
#ifndef HAVE_WRITEV #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; char *buffer, *bp;
int i; int i;
size_t bytes = 0; size_t bytes = 0;
ssize_t result; ares_ssize_t result;
/* Validate iovcnt */ /* Validate iovcnt */
if (iovcnt <= 0) if (iovcnt <= 0)
......
...@@ -29,7 +29,7 @@ struct iovec ...@@ -29,7 +29,7 @@ struct iovec
size_t iov_len; /* Length of data. */ 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 #endif
......
...@@ -60,11 +60,6 @@ ...@@ -60,11 +60,6 @@
#define BSD #define BSD
#if defined(__HIGHC__) || \
(defined(__GNUC__) && (__GNUC__ < 4))
#define ssize_t int
#endif
/* Target HAVE_x section */ /* Target HAVE_x section */
#if defined(DJGPP) #if defined(DJGPP)
......
...@@ -216,20 +216,6 @@ ...@@ -216,20 +216,6 @@
#define HAVE_BOOL_T #define HAVE_BOOL_T
#endif #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 */ /* TYPE SIZES */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
...@@ -259,31 +245,19 @@ ...@@ -259,31 +245,19 @@
# define _CRT_NONSTDC_NO_DEPRECATE 1 # define _CRT_NONSTDC_NO_DEPRECATE 1
#endif #endif
/* Officially, Microsoft's Windows SDK versions 6.X do not support Windows /* Set the Target to Vista. However, any symbols required above Win2000
2000 as a supported build target. VS2008 default installations provide * should be loaded via LoadLibrary() */
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. */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) #if defined(_MSC_VER) && (_MSC_VER >= 1500)
# define VS2008_DEF_TARGET 0x0501 # define VS2008_MIN_TARGET 0x0600
#endif #endif
/* VS2008 default target settings and minimum build target check. */ /* VS2008 default target settings and minimum build target check. */
#if defined(_MSC_VER) && (_MSC_VER >= 1500) #if defined(_MSC_VER) && (_MSC_VER >= 1500)
# ifndef _WIN32_WINNT # ifndef _WIN32_WINNT
# define _WIN32_WINNT VS2008_DEF_TARGET # define _WIN32_WINNT VS2008_MIN_TARGET
# endif # endif
# ifndef WINVER # ifndef WINVER
# define WINVER VS2008_DEF_TARGET # define WINVER VS2008_MIN_TARGET
# endif # endif
# if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET) # if (_WIN32_WINNT < VS2008_MIN_TARGET) || (WINVER < VS2008_MIN_TARGET)
# error VS2008 does not support Windows build targets prior to Windows 2000 # error VS2008 does not support Windows build targets prior to Windows 2000
...@@ -291,13 +265,13 @@ ...@@ -291,13 +265,13 @@
#endif #endif
/* When no build target is specified Pelles C 5.00 and later default build /* 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) #if defined(__POCC__) && (__POCC__ >= 500)
# ifndef _WIN32_WINNT # ifndef _WIN32_WINNT
# define _WIN32_WINNT 0x0500 # define _WIN32_WINNT 0x0600
# endif # endif
# ifndef WINVER # ifndef WINVER
# define WINVER 0x0500 # define WINVER 0x0600
# endif # endif
#endif #endif
......
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for c-ares 1.12.0. # Generated by GNU Autoconf 2.69 for c-ares 1.13.0.
# #
# Report bugs to <c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares>. # Report bugs to <c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares>.
# #
...@@ -824,8 +824,8 @@ MAKEFLAGS= ...@@ -824,8 +824,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='c-ares' PACKAGE_NAME='c-ares'
PACKAGE_TARNAME='c-ares' PACKAGE_TARNAME='c-ares'
PACKAGE_VERSION='1.12.0' PACKAGE_VERSION='1.13.0'
PACKAGE_STRING='c-ares 1.12.0' PACKAGE_STRING='c-ares 1.13.0'
PACKAGE_BUGREPORT='c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares' PACKAGE_BUGREPORT='c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares'
PACKAGE_URL='' PACKAGE_URL=''
...@@ -1619,7 +1619,7 @@ if test "$ac_init_help" = "long"; then ...@@ -1619,7 +1619,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures c-ares 1.12.0 to adapt to many kinds of systems. \`configure' configures c-ares 1.13.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
...@@ -1690,7 +1690,7 @@ fi ...@@ -1690,7 +1690,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of c-ares 1.12.0:";; short | recursive ) echo "Configuration of c-ares 1.13.0:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
...@@ -1831,7 +1831,7 @@ fi ...@@ -1831,7 +1831,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
c-ares configure 1.12.0 c-ares configure 1.13.0
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
...@@ -2412,7 +2412,7 @@ cat >config.log <<_ACEOF ...@@ -2412,7 +2412,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by c-ares $as_me 1.12.0, which was It was created by c-ares $as_me 1.13.0, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
...@@ -3202,7 +3202,8 @@ if test -z "$EGREP" || test "$EGREP" = "not_found"; then ...@@ -3202,7 +3202,8 @@ if test -z "$EGREP" || test "$EGREP" = "not_found"; then
fi fi
if test -n "$ac_tool_prefix"; then if test -z "$AR"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2 set dummy ${ac_tool_prefix}ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
...@@ -3302,8 +3303,9 @@ else ...@@ -3302,8 +3303,9 @@ else
AR="$ac_cv_path_AR" AR="$ac_cv_path_AR"
fi fi
if test -z "$AR" || test "$AR" = "not_found"; then if test -z "$AR" || test "$AR" = "not_found"; then
as_fn_error $? "ar not found in PATH. Cannot continue without ar." "$LINENO" 5 as_fn_error $? "ar not found in PATH. Cannot continue without ar." "$LINENO" 5
fi
fi fi
...@@ -5944,7 +5946,7 @@ fi ...@@ -5944,7 +5946,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='c-ares' PACKAGE='c-ares'
VERSION='1.12.0' VERSION='1.13.0'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
...@@ -22107,6 +22109,7 @@ _ACEOF ...@@ -22107,6 +22109,7 @@ _ACEOF
;; ;;
esac esac
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
;; ;;
*) *)
ac_cv_header_winsock_h="no" ac_cv_header_winsock_h="no"
...@@ -22904,7 +22907,91 @@ $as_echo "$tst_connect_need_LIBS" >&6; } ...@@ -22904,7 +22907,91 @@ $as_echo "$tst_connect_need_LIBS" >&6; }
esac esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 if test "x$host_vendor" = "xapple"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for iOS minimum version 10 or later" >&5
$as_echo_n "checking for iOS minimum version 10 or later... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#include <TargetConditionals.h>
int main (void)
{
#if TARGET_OS_IPHONE == 0 || __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
#error Not iOS 10 or later
#endif
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ac_cv_ios_10="yes"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x$host_vendor" = "xapple"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for macOS minimum version 10.12 or later" >&5
$as_echo_n "checking for macOS minimum version 10.12 or later... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#include <TargetConditionals.h>
int main (void)
{
#ifndef MAC_OS_X_VERSION_10_12
# define MAC_OS_X_VERSION_10_12 101200
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
#error Not macOS 10.12 or later
#endif
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ac_cv_macos_10_12="yes"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test "x$host_vendor" != "xapple" || test "x$ac_cv_ios_10" = "xyes" || test "x$ac_cv_macos_10_12" = "xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
if ${ac_cv_header_time+:} false; then : if ${ac_cv_header_time+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
...@@ -23160,6 +23247,7 @@ _ACEOF ...@@ -23160,6 +23247,7 @@ _ACEOF
fi fi
# #
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libgcc" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libgcc" >&5
$as_echo_n "checking whether to use libgcc... " >&6; } $as_echo_n "checking whether to use libgcc... " >&6; }
...@@ -23794,12 +23882,17 @@ fi ...@@ -23794,12 +23882,17 @@ fi
# check for ssize_t # check for ssize_t
ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
if test "x$ac_cv_type_ssize_t" = xyes; then : if test "x$ac_cv_type_ssize_t" = xyes; then :
CARES_TYPEOF_ARES_SSIZE_T=ssize_t
else else
CARES_TYPEOF_ARES_SSIZE_T=int
fi
$as_echo "#define ssize_t int" >>confdefs.h
fi
cat >>confdefs.h <<_ACEOF
#define CARES_TYPEOF_ARES_SSIZE_T ${CARES_TYPEOF_ARES_SSIZE_T}
_ACEOF
# check for bool type # check for bool type
...@@ -32470,7 +32563,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ...@@ -32470,7 +32563,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by c-ares $as_me 1.12.0, which was This file was extended by c-ares $as_me 1.13.0, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -32536,7 +32629,7 @@ _ACEOF ...@@ -32536,7 +32629,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
c-ares config.status 1.12.0 c-ares config.status 1.13.0
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"
......
AC_PREREQ(2.57) AC_PREREQ(2.57)
dnl Version not hardcoded here. Fetched later from ares_version.h dnl Version not hardcoded here. Fetched later from ares_version.h
AC_INIT([c-ares], [1.12.0], AC_INIT([c-ares], [1.13.0],
[c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares]) [c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares])
XC_OVR_ZZ50 XC_OVR_ZZ50
...@@ -59,10 +59,13 @@ AC_SUBST([EGREP]) ...@@ -59,10 +59,13 @@ AC_SUBST([EGREP])
dnl AR is mandatory for configure process and libtool. dnl AR is mandatory for configure process and libtool.
dnl This is target dependent, so check it as a tool. dnl This is target dependent, so check it as a tool.
AC_PATH_TOOL([AR], [ar], [not_found], if test -z "$AR"; then
[$PATH:/usr/bin:/usr/local/bin]) dnl allow it to be overridden
if test -z "$AR" || test "$AR" = "not_found"; then AC_PATH_TOOL([AR], [ar], [not_found],
AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.]) [$PATH:/usr/bin:/usr/local/bin])
if test -z "$AR" || test "$AR" = "not_found"; then
AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
fi
fi fi
AC_SUBST([AR]) AC_SUBST([AR])
...@@ -194,6 +197,7 @@ case X-"$ac_cv_native_windows" in ...@@ -194,6 +197,7 @@ case X-"$ac_cv_native_windows" in
CURL_CHECK_HEADER_WINSOCK CURL_CHECK_HEADER_WINSOCK
CURL_CHECK_HEADER_WINSOCK2 CURL_CHECK_HEADER_WINSOCK2
CURL_CHECK_HEADER_WS2TCPIP CURL_CHECK_HEADER_WS2TCPIP
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
;; ;;
*) *)
ac_cv_header_winsock_h="no" ac_cv_header_winsock_h="no"
...@@ -388,11 +392,62 @@ ac_cv_func_strcasecmp="no" ...@@ -388,11 +392,62 @@ ac_cv_func_strcasecmp="no"
CARES_CHECK_LIBS_CONNECT CARES_CHECK_LIBS_CONNECT
dnl iOS 10?
AS_IF([test "x$host_vendor" = "xapple"], [
AC_MSG_CHECKING([for iOS minimum version 10 or later])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <stdio.h>
#include <TargetConditionals.h>
]], [[
#if TARGET_OS_IPHONE == 0 || __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
#error Not iOS 10 or later
#endif
return 0;
]])
],[
AC_MSG_RESULT([yes])
ac_cv_ios_10="yes"
],[
AC_MSG_RESULT([no])
])
])
dnl macOS 10.12?
AS_IF([test "x$host_vendor" = "xapple"], [
AC_MSG_CHECKING([for macOS minimum version 10.12 or later])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <stdio.h>
#include <TargetConditionals.h>
]], [[
#ifndef MAC_OS_X_VERSION_10_12
# define MAC_OS_X_VERSION_10_12 101200
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
#error Not macOS 10.12 or later
#endif
return 0;
]])
],[
AC_MSG_RESULT([yes])
ac_cv_macos_10_12="yes"
],[
AC_MSG_RESULT([no])
])
])
dnl ********************************************************************** dnl **********************************************************************
dnl In case that function clock_gettime with monotonic timer is available, dnl In case that function clock_gettime with monotonic timer is available,
dnl check for additional required libraries. dnl check for additional required libraries.
dnl ********************************************************************** dnl **********************************************************************
CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC dnl Xcode 8 bug: iOS when targeting less than 10, or macOS when targeting less than 10.12 will
dnl say clock_gettime exists, it is a weak symbol that only exists in iOS 10 or macOS 10.12 and will
dnl cause a crash at runtime when running on older versions. Skip finding CLOCK_MONOTONIC on older
dnl Apple OS's.
if test "x$host_vendor" != "xapple" || test "x$ac_cv_ios_10" = "xyes" || test "x$ac_cv_macos_10_12" = "xyes"; then
CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
fi
AC_MSG_CHECKING([whether to use libgcc]) AC_MSG_CHECKING([whether to use libgcc])
AC_ARG_ENABLE(libgcc, AC_ARG_ENABLE(libgcc,
...@@ -505,8 +560,12 @@ fi ...@@ -505,8 +560,12 @@ fi
# check for ssize_t # check for ssize_t
AC_CHECK_TYPE(ssize_t, , AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_t ],
AC_DEFINE(ssize_t, int, [the signed version of size_t])) [ CARES_TYPEOF_ARES_SSIZE_T=int ])
AC_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SSIZE_T], ${CARES_TYPEOF_ARES_SSIZE_T},
[the signed version of size_t])
# check for bool type # check for bool type
AC_CHECK_TYPE([bool],[ AC_CHECK_TYPE([bool],[
......
...@@ -357,8 +357,8 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size) ...@@ -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 * Since some memmove()'s erroneously fail to handle
* overlapping regions, we'll do the shift by hand. * overlapping regions, we'll do the shift by hand.
*/ */
const ssize_t n = tp - colonp; const ares_ssize_t n = tp - colonp;
ssize_t i; ares_ssize_t i;
if (tp == endp) if (tp == endp)
goto enoent; goto enoent;
......
...@@ -131,7 +131,7 @@ struct timeval { ...@@ -131,7 +131,7 @@ struct timeval {
#if defined(__minix) #if defined(__minix)
/* Minix doesn't support recv on TCP sockets */ /* 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_ARG2)(y), \
(RECV_TYPE_ARG3)(z)) (RECV_TYPE_ARG3)(z))
...@@ -167,7 +167,7 @@ struct timeval { ...@@ -167,7 +167,7 @@ struct timeval {
Error Missing_definition_of_return_and_arguments_types_of_recv Error Missing_definition_of_return_and_arguments_types_of_recv
/* */ /* */
#else #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_ARG2)(y), \
(RECV_TYPE_ARG3)(z), \ (RECV_TYPE_ARG3)(z), \
(RECV_TYPE_ARG4)(0)) (RECV_TYPE_ARG4)(0))
...@@ -183,7 +183,7 @@ struct timeval { ...@@ -183,7 +183,7 @@ struct timeval {
#if defined(__minix) #if defined(__minix)
/* Minix doesn't support send on TCP sockets */ /* 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_ARG2)(y), \
(SEND_TYPE_ARG3)(z)) (SEND_TYPE_ARG3)(z))
...@@ -198,7 +198,7 @@ struct timeval { ...@@ -198,7 +198,7 @@ struct timeval {
Error Missing_definition_of_return_and_arguments_types_of_send Error Missing_definition_of_return_and_arguments_types_of_send
/* */ /* */
#else #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_ARG2)(y), \
(SEND_TYPE_ARG3)(z), \ (SEND_TYPE_ARG3)(z), \
(SEND_TYPE_ARG4)(SEND_4TH_ARG)) (SEND_TYPE_ARG4)(SEND_4TH_ARG))
...@@ -228,7 +228,7 @@ struct timeval { ...@@ -228,7 +228,7 @@ struct timeval {
Error Missing_definition_of_return_and_arguments_types_of_recvfrom Error Missing_definition_of_return_and_arguments_types_of_recvfrom
/* */ /* */
#else #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_ARG2 *)(b), \
(RECVFROM_TYPE_ARG3) (bl), \ (RECVFROM_TYPE_ARG3) (bl), \
(RECVFROM_TYPE_ARG4) (0), \ (RECVFROM_TYPE_ARG4) (0), \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment