Commit 0933fdf8 authored by Jason Madden's avatar Jason Madden Committed by GitHub

Merge pull request #1036 from gevent/cares1130

Upgrade c-ares to 1.13.0. Fixes #990
parents bee87cfd 936b1174
......@@ -38,6 +38,7 @@ deps/c-ares/stamp-h1
deps/c-ares/stamp-h2
deps/c-ares/ares_build.h.orig
deps/c-ares/ares_config.h
deps/c-ares/ares_build.h
deps/c-ares/.libs
deps/c-ares/*.o
deps/c-ares/*.lo
......
......@@ -80,6 +80,8 @@
- ``socket.send()`` now catches ``EPROTYPE`` on macOS to handle a race
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)
==================
......
......@@ -77,6 +77,7 @@ test_prelim:
${PYTHON} --version
${PYTHON} -c 'import greenlet; print(greenlet, greenlet.__version__)'
${PYTHON} -c 'import gevent.core; print(gevent.core.loop)'
${PYTHON} -c 'import gevent.ares; print(gevent.ares)'
make bench
toxtest: test_prelim
......
......@@ -23,6 +23,7 @@ from _setuputils import LIBRARIES
from _setuputils import DEFINE_MACROS
from _setuputils import glob_many
from _setuputils import dep_abspath
from _setuputils import RUNNING_ON_CI
CARES_EMBED = should_embed('c-ares')
......@@ -42,7 +43,8 @@ ares_configure_command = ' '.join([
" && if [ -r ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi ",
" && sh ./configure --disable-dependency-tracking " + _m32 + "CONFIG_COMMANDS= ",
" && cp ares_config.h ares_build.h \"$OLDPWD\" ",
" && mv ares_build.h.orig ares_build.h)",
" && cat ares_build.h ",
" && if [ -r ares_build.h.orig ]; then mv ares_build.h.orig ares_build.h; fi)",
"> configure-output.txt"])
......@@ -83,7 +85,8 @@ ARES = Extension(name='gevent.ares',
define_macros=list(DEFINE_MACROS),
depends=glob_many('src/gevent/dnshelper.c',
'src/gevent/cares_*.[ch]'))
ARES.optional = True
ARES.optional = not RUNNING_ON_CI
if CARES_EMBED:
......@@ -91,10 +94,7 @@ if CARES_EMBED:
# Strip the standalone binaries that would otherwise
# cause linking issues
for bin_c in ('acountry', 'adig', 'ahost'):
try:
ARES.sources.remove('deps/c-ares/' + bin_c + '.c')
except ValueError:
pass
ARES.sources.remove('deps/c-ares' + os.sep + bin_c + '.c')
ARES.configure = configure_ares
if WIN:
ARES.libraries += ['advapi32']
......
......@@ -22,6 +22,9 @@ from setuptools.command.sdist import sdist
PYPY = hasattr(sys, 'pypy_version_info')
WIN = sys.platform.startswith('win')
CFFI_WIN_BUILD_ANYWAY = os.environ.get("PYPY_WIN_BUILD_ANYWAY")
RUNNING_ON_TRAVIS = os.environ.get('TRAVIS')
RUNNING_ON_APPVEYOR = os.environ.get('APPVEYOR')
RUNNING_ON_CI = RUNNING_ON_TRAVIS or RUNNING_ON_APPVEYOR
LIBRARIES = []
DEFINE_MACROS = []
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -52,7 +52,7 @@ LFLAGS += debug all
CFLAGS += -d0
!endif
CFLAGS += -d_WIN32_WINNT=0x0501
CFLAGS += -d_WIN32_WINNT=0x0600
#
# Change to suite.
......
......@@ -39,7 +39,8 @@ lib_LTLIBRARIES = libcares.la
man_MANS = $(MANPAGES)
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
PROGS =
......@@ -55,7 +56,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
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
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
......
......@@ -321,7 +321,7 @@ CTAGS = ctags
CSCOPE = cscope
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \
$(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 \
mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
......@@ -536,7 +536,8 @@ ACLOCAL_AMFLAGS = -I m4
lib_LTLIBRARIES = libcares.la
man_MANS = $(MANPAGES)
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_TRUE@PROGS =
......@@ -547,7 +548,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS) \
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
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
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
......@@ -685,6 +686,7 @@ MANPAGES = ares_cancel.3 \
ares_init_options.3 \
ares_library_cleanup.3 \
ares_library_init.3 \
ares_library_initialized.3 \
ares_mkquery.3 \
ares_create_query.3 \
ares_parse_a_reply.3 \
......@@ -738,6 +740,7 @@ HTMLPAGES = ares_cancel.html \
ares_init_options.html \
ares_library_cleanup.html \
ares_library_init.html \
ares_library_initialized.html \
ares_mkquery.html \
ares_create_query.html \
ares_parse_a_reply.html \
......@@ -790,6 +793,7 @@ PDFPAGES = ares_cancel.pdf \
ares_init_options.pdf \
ares_library_cleanup.pdf \
ares_library_init.pdf \
ares_library_initialized.pdf \
ares_mkquery.pdf \
ares_create_query.pdf \
ares_parse_a_reply.pdf \
......
......@@ -92,6 +92,7 @@ MANPAGES = ares_cancel.3 \
ares_init_options.3 \
ares_library_cleanup.3 \
ares_library_init.3 \
ares_library_initialized.3 \
ares_mkquery.3 \
ares_create_query.3 \
ares_parse_a_reply.3 \
......@@ -145,6 +146,7 @@ HTMLPAGES = ares_cancel.html \
ares_init_options.html \
ares_library_cleanup.html \
ares_library_init.html \
ares_library_initialized.html \
ares_mkquery.html \
ares_create_query.html \
ares_parse_a_reply.html \
......@@ -197,6 +199,7 @@ PDFPAGES = ares_cancel.pdf \
ares_init_options.pdf \
ares_library_cleanup.pdf \
ares_library_init.pdf \
ares_library_initialized.pdf \
ares_mkquery.pdf \
ares_create_query.pdf \
ares_parse_a_reply.pdf \
......
......@@ -17,7 +17,7 @@ RANLIB = $(CROSSPREFIX)ranlib
#RM = rm -f
CP = cp -afv
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I.
CFLAGS = $(CARES_CFLAG_EXTRAS) -O2 -Wall -I. -D_WIN32_WINNT=0x0600
CFLAGS += -DCARES_STATICLIB
LDFLAGS = $(CARES_LDFLAG_EXTRAS) -s
LIBS = -lwsock32
......
......@@ -184,7 +184,7 @@ CFLAGS = /UWIN32 /DWATT32 /I$(WATT_ROOT)\inc
EX_LIBS_REL = $(WATT_ROOT)\lib\wattcpvc_imp.lib
EX_LIBS_DBG = $(WATT_ROOT)\lib\wattcpvc_imp_d.lib
!ELSE
CFLAGS = /DWIN32
CFLAGS = /DWIN32 /D_WIN32_WINNT=0x0600
EX_LIBS_REL = ws2_32.lib advapi32.lib kernel32.lib
EX_LIBS_DBG = ws2_32.lib advapi32.lib kernel32.lib
!ENDIF
......
......@@ -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
with graphical user interfaces.
The full source code is available in the 'c-ares' release archives, and in a
git repository: http://github.com/c-ares/c-ares
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
......
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
......@@ -273,7 +273,7 @@ static const struct search_list *list_lookup(int number, const struct search_lis
*/
static const struct search_list country_list[] = {
{ 4, "af", "Afghanistan" },
{ 248, "ax", "land Island" },
{ 248, "ax", "Åland Island" },
{ 8, "al", "Albania" },
{ 12, "dz", "Algeria" },
{ 16, "as", "American Samoa" },
......
......@@ -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(ANDROID) || defined(__ANDROID__) || defined(__OpenBSD__) || \
defined(__QNXNTO__)
#include <sys/select.h>
#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,
......
......@@ -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;
}
}
#ifndef __CARES_BUILD_H
#define __CARES_BUILD_H
/* Copyright (C) 2009 - 2013 by Daniel Stenberg et al
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* ================================================================ */
/* NOTES FOR CONFIGURE CAPABLE SYSTEMS */
/* ================================================================ */
/*
* NOTE 1:
* -------
*
* See file ares_build.h.in, run configure, and forget that this file
* exists it is only used for non-configure systems.
* But you can keep reading if you want ;-)
*
*/
/* ================================================================ */
/* NOTES FOR NON-CONFIGURE SYSTEMS */
/* ================================================================ */
/*
* NOTE 1:
* -------
*
* Nothing in this file is intended to be modified or adjusted by the
* c-ares library user nor by the c-ares library builder.
*
* If you think that something actually needs to be changed, adjusted
* or fixed in this file, then, report it on the c-ares development
* mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/
*
* Try to keep one section per platform, compiler and architecture,
* otherwise, if an existing section is reused for a different one and
* later on the original is adjusted, probably the piggybacking one can
* be adversely changed.
*
* In order to differentiate between platforms/compilers/architectures
* use only compiler built in predefined preprocessor symbols.
*
* This header file shall only export symbols which are 'cares' or 'CARES'
* prefixed, otherwise public name space would be polluted.
*
* NOTE 2:
* -------
*
* Right now you might be staring at file ares_build.h.dist or ares_build.h,
* this is due to the following reason: file ares_build.h.dist is renamed
* to ares_build.h when the c-ares source code distribution archive file is
* created.
*
* File ares_build.h.dist is not included in the distribution archive.
* File ares_build.h is not present in the git tree.
*
* The distributed ares_build.h file is only intended to be used on systems
* which can not run the also distributed configure script.
*
* On systems capable of running the configure script, the configure process
* will overwrite the distributed ares_build.h file with one that is suitable
* and specific to the library being configured and built, which is generated
* from the ares_build.h.in template file.
*
* If you check out from git on a non-configure platform, you must run the
* appropriate buildconf* script to set up ares_build.h and other local files.
*
*/
/* ================================================================ */
/* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */
/* ================================================================ */
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
# error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h"
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
#endif
/* ================================================================ */
/* EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY */
/* ================================================================ */
#if defined(__DJGPP__) || defined(__GO32__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__SALFORDC__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__BORLANDC__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__TURBOC__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__WATCOMC__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__POCC__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__LCC__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__SYMBIAN32__)
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
#elif defined(__MWERKS__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(_WIN32_WCE)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__MINGW32__)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
#elif defined(__VMS)
# define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int
#elif defined(__OS400__)
# if defined(__ILEC400__)
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1
# endif
#elif defined(__MVS__)
# if defined(__IBMC__) || defined(__IBMCPP__)
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1
# endif
#elif defined(__370__)
# if defined(__IBMC__) || defined(__IBMCPP__)
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1
# endif
#elif defined(TPF)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
/* ===================================== */
/* KEEP MSVC THE PENULTIMATE ENTRY */
/* ===================================== */
#elif defined(_MSC_VER)
# define CARES_TYPEOF_ARES_SOCKLEN_T int
/* ===================================== */
/* KEEP GENERIC GCC THE LAST ENTRY */
/* ===================================== */
#elif defined(__GNUC__)
# define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t
# define CARES_PULL_SYS_TYPES_H 1
# define CARES_PULL_SYS_SOCKET_H 1
#else
# error "Unknown non-configure build target!"
Error Compilation_aborted_Unknown_non_configure_build_target
#endif
/* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file */
/* sys/types.h is required here to properly make type definitions below. */
#ifdef CARES_PULL_SYS_TYPES_H
# include <sys/types.h>
#endif
/* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file */
/* sys/socket.h is required here to properly make type definitions below. */
#ifdef CARES_PULL_SYS_SOCKET_H
# include <sys/socket.h>
#endif
/* Data type definition of ares_socklen_t. */
#ifdef CARES_TYPEOF_ARES_SOCKLEN_T
typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;
#endif
#endif /* __CARES_BUILD_H */
......@@ -251,4 +251,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 */
......@@ -91,4 +91,10 @@
/* Data type definition of 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 */
......@@ -18,9 +18,9 @@
ares_cancel \- Cancel a resolve
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_cancel(ares_channel \fIchannel\fP)
#include <ares.h>
void ares_cancel(ares_channel \fIchannel\fP)
.fi
.SH DESCRIPTION
The \fBares_cancel(3)\fP function cancels all lookups/requests made on the the
......
......@@ -18,6 +18,9 @@
/* Definition to make a library symbol externally visible. */
#undef CARES_SYMBOL_SCOPE_EXTERN
/* the signed version of size_t */
#undef CARES_TYPEOF_ARES_SSIZE_T
/* Use resolver library to configure cares */
#undef CARES_USE_LIBRESOLV
......@@ -496,6 +499,3 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
#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,
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;
}
......
......@@ -18,9 +18,9 @@
ares_destroy \- Destroy a resolver channel
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_destroy(ares_channel \fIchannel\fP)
#include <ares.h>
void ares_destroy(ares_channel \fIchannel\fP)
.fi
.SH DESCRIPTION
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
by the channel.
\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
arguments. A callback must not add new requests to a channel being destroyed.
.SH SEE ALSO
......
......@@ -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)
......
......@@ -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;
......
......@@ -15,43 +15,30 @@
.\"
.TH ARES_FDS 3 "23 July 1998"
.SH NAME
ares_fds \- Get file descriptors to select on for name service
ares_fds \- return file descriptors to select on
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_fds(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP,
.B fd_set *\fIwrite_fds\fP)
#include <ares.h>
int ares_fds(ares_channel \fIchannel\fP,
fd_set *\fIread_fds\fP,
fd_set *\fIwrite_fds\fP)
.fi
.SH DESCRIPTION
The
.B ares_fds
function retrieves the set of file descriptors which the calling
application should select on for reading and writing for the
The \fBares_fds(3)\fP 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
identified by
.IR channel .
identified by \fIchannel\fP.
File descriptors will be set in the file descriptor sets pointed to by
.I read_fds
and
.I write_fds
as appropriate. File descriptors already set in
.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.
\fIread_fds\fP and \fIwrite_fds\fP as appropriate. File descriptors already
set in \fIread_fds\fP and \fIwrite_fds\fP will remain set; initialization of
the file descriptor sets (using \fBFD_ZERO\fP) is the responsibility of the
caller.
.SH RETURN VALUES
.B ares_fds
returns one greater than the number of the highest socket set in either
.I read_fds
or
.IR write_fds .
If no queries are active,
.B ares_fds
will return 0.
\fBares_fds(3)\fP returns a value that is one greater than the number of the
highest socket set in either \fIread_fds\fP or \fIwrite_fds\fP. If no queries
are active, \fBares_fds(3)\fP returns 0.
.SH SEE ALSO
.BR ares_timeout (3),
.BR ares_process (3)
......
......@@ -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';
......
This diff is collapsed.
......@@ -21,6 +21,27 @@ ares_init_options \- Initialize a resolver channel
.nf
#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,
struct ares_options *\fIoptions\fP,
int \fIoptmask\fP)
......
......@@ -19,11 +19,9 @@
ares_library_cleanup \- c-ares library deinitialization
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_library_cleanup(void)
.PP
.B cc file.c -lcares
#include <ares.h>
void ares_library_cleanup(void)
.fi
.SH DESCRIPTION
.PP
......
......@@ -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
......
......@@ -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 */
......
.\"
.\" 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)
}
/*
** 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)
......
......@@ -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);
......
......@@ -110,6 +110,12 @@ 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)
......@@ -185,4 +191,3 @@ ares_parse_naptr_reply (const unsigned char *abuf, int alen,
return ARES_SUCCESS;
}
......@@ -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; }
......
......@@ -18,15 +18,15 @@
ares_process \- Process events for name resolution
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B void ares_process(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP,
.B fd_set *\fIwrite_fds\fP)
.fi
.PP
.B void ares_process_fd(ares_channel \fIchannel\fP,
.B ares_socket_t \fIread_fd\fP,
.B ares_socket_t \fIwrite_fd\fP)
#include <ares.h>
void ares_process(ares_channel \fIchannel\fP,
fd_set *\fIread_fds\fP,
fd_set *\fIwrite_fds\fP)
void ares_process_fd(ares_channel \fIchannel\fP,
ares_socket_t \fIread_fd\fP,
ares_socket_t \fIwrite_fd\fP)
.fi
.SH DESCRIPTION
The \fBares_process(3)\fP function handles input/output events and timeouts
......@@ -35,31 +35,26 @@ 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
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.
(The easiest way to determine this information is to invoke
.B select
with a timeout no greater than the timeout given by \fIares_timeout(3)\fP ).
.PP
The
.B ares_process
function will invoke callbacks for pending queries if they complete
successfully or fail.
(The easiest way to determine this information is to invoke \fBselect(3)\fP
with a timeout no greater than the timeout given by \fIares_timeout(3)\fP).
The \fBares_process(3)\fP 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
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
users of c-ares to void select() in their applications and within c-ares.
.SS EXAMPLE
ARES_SOCKET_BAD for "no action". This function is provided to allow users of
c-ares to void \fIselect(3)\fP in their applications and within c-ares.
.SH EXAMPLE
The following code fragment waits for all pending queries on a channel
to complete:
.PP
.RS
.nf
int nfds, count;
fd_set readers, writers;
struct timeval tv, *tvp;
while (1)
{
while (1) {
FD_ZERO(&readers);
FD_ZERO(&writers);
nfds = ares_fds(channel, &readers, &writers);
......@@ -68,9 +63,8 @@ while (1)
tvp = ares_timeout(channel, NULL, &tv);
count = select(nfds, &readers, &writers, NULL, tvp);
ares_process(channel, &readers, &writers);
}
}
.fi
.RE
.SH SEE ALSO
.BR ares_fds (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
setsocktop call fails (probably because of permissions), the error is
silently ignored.
.SH SEE ALSO
.BR ares_set_local_ipv4 (3)
.BR ares_set_local_ipv6 (3)
.BR ares_set_local_ip4 (3)
.BR ares_set_local_ip6 (3)
.SH NOTES
This function was added in c-ares 1.7.4
.SH AUTHOR
......
......@@ -18,43 +18,28 @@
ares_timeout \- return maximum time to wait
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B struct timeval *ares_timeout(ares_channel \fIchannel\fP,
.B struct timeval *\fImaxtv\fP, struct timeval *\fItv\fP)
#include <ares.h>
struct timeval *ares_timeout(ares_channel \fIchannel\fP,
struct timeval *\fImaxtv\fP,
struct timeval *\fItv\fP)
.fi
.SH DESCRIPTION
The
.B ares_timeout
function determines the maximum time for which the caller should wait before
invoking \fIares_process(3)\fP to process timeouts. The parameter
.I maxtv
specifies a existing maximum timeout, or
.B NULL
The \fBares_timeout(3)\fP function determines the maximum time for which the
caller should wait before invoking \fIares_process(3)\fP to process timeouts.
The parameter \fImaxtv\fP specifies a existing maximum timeout, or \fBNULL\fP
if the caller does not wish to apply a maximum timeout. The parameter
.I tv
must point to a writable buffer of type
.BR "struct timeval" .
It is valid for
.I maxtv
and
.I tv
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 .
\fItv\fP must point to a writable buffer of type \fBstruct timeval\fP It is
valid for \fImaxtv\fP and \fItv\fP to have the same value.
If no queries have timeouts pending sooner than the given maximum timeout,
\fBares_timeout(3)\fP returns the value of \fImaxtv\fP; otherwise
\fBares_timeout(3)\fP stores the appropriate timeout value into the buffer
pointed to by \fItv\fP and returns the value of \fItv\fP.
.SH SEE ALSO
.BR ares_fds (3),
.BR ares_process (3)
.BR ares_process (3),
.BR ares_process_fd (3)
.SH AUTHOR
Greg Hudson, MIT Information Systems
.br
......
......@@ -18,23 +18,18 @@
ares_version \- Get the version number of the library
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B const char *ares_version(int *\fIversion\fP)
#include <ares.h>
const char *ares_version(int *\fIversion\fP)
.fi
.SH DESCRIPTION
The
.B ares_version
function gets the library version as a string and optionally as an integer
stored in the
.IR version ,
argument. If you pass a NULL, no integer is attempted to be returned.
The \fBares_version(3)\fP function gets the library version as a string and
optionally as an integer stored in the \fIversion\fP 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
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).
.SH NOTES
This function is not compatible with ares.
.SH AUTHOR
Daniel Stenberg
.SH "SEE ALSO"
.BR ares_init (3),
.BR ares_library_init (3)
......@@ -6,12 +6,12 @@
#define ARES_COPYRIGHT "2004 - 2016 Daniel Stenberg, <daniel@haxx.se>."
#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
......
......@@ -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)
......
......@@ -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
......
......@@ -60,11 +60,6 @@
#define BSD
#if defined(__HIGHC__) || \
(defined(__GNUC__) && (__GNUC__ < 4))
#define ssize_t int
#endif
/* Target HAVE_x section */
#if defined(DJGPP)
......
......@@ -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
......
#! /bin/sh
# 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>.
#
......@@ -824,8 +824,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='c-ares'
PACKAGE_TARNAME='c-ares'
PACKAGE_VERSION='1.12.0'
PACKAGE_STRING='c-ares 1.12.0'
PACKAGE_VERSION='1.13.0'
PACKAGE_STRING='c-ares 1.13.0'
PACKAGE_BUGREPORT='c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares'
PACKAGE_URL=''
......@@ -1619,7 +1619,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures c-ares 1.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]...
......@@ -1690,7 +1690,7 @@ fi
if test -n "$ac_init_help"; then
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
cat <<\_ACEOF
......@@ -1831,7 +1831,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
c-ares configure 1.12.0
c-ares configure 1.13.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2412,7 +2412,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by c-ares $as_me 1.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
$ $0 $@
......@@ -3202,7 +3202,8 @@ if test -z "$EGREP" || test "$EGREP" = "not_found"; then
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.
set dummy ${ac_tool_prefix}ar; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
......@@ -3302,8 +3303,9 @@ else
AR="$ac_cv_path_AR"
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
fi
fi
......@@ -5944,7 +5946,7 @@ fi
# Define the identity of the package.
PACKAGE='c-ares'
VERSION='1.12.0'
VERSION='1.13.0'
cat >>confdefs.h <<_ACEOF
......@@ -22107,6 +22109,7 @@ _ACEOF
;;
esac
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
;;
*)
ac_cv_header_winsock_h="no"
......@@ -22904,7 +22907,91 @@ $as_echo "$tst_connect_need_LIBS" >&6; }
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; }
if ${ac_cv_header_time+:} false; then :
$as_echo_n "(cached) " >&6
......@@ -23160,6 +23247,7 @@ _ACEOF
fi
#
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libgcc" >&5
$as_echo_n "checking whether to use libgcc... " >&6; }
......@@ -23794,12 +23882,17 @@ fi
# check for ssize_t
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 :
CARES_TYPEOF_ARES_SSIZE_T=ssize_t
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
......@@ -32470,7 +32563,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by c-ares $as_me 1.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
CONFIG_FILES = $CONFIG_FILES
......@@ -32536,7 +32629,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
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,
with options \\"\$ac_cs_config\\"
......
AC_PREREQ(2.57)
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])
XC_OVR_ZZ50
......@@ -59,10 +59,13 @@ AC_SUBST([EGREP])
dnl AR is mandatory for configure process and libtool.
dnl This is target dependent, so check it as a tool.
AC_PATH_TOOL([AR], [ar], [not_found],
if test -z "$AR"; then
dnl allow it to be overridden
AC_PATH_TOOL([AR], [ar], [not_found],
[$PATH:/usr/bin:/usr/local/bin])
if test -z "$AR" || test "$AR" = "not_found"; then
if test -z "$AR" || test "$AR" = "not_found"; then
AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
fi
fi
AC_SUBST([AR])
......@@ -194,6 +197,7 @@ case X-"$ac_cv_native_windows" in
CURL_CHECK_HEADER_WINSOCK
CURL_CHECK_HEADER_WINSOCK2
CURL_CHECK_HEADER_WS2TCPIP
CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600"
;;
*)
ac_cv_header_winsock_h="no"
......@@ -388,11 +392,62 @@ ac_cv_func_strcasecmp="no"
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 In case that function clock_gettime with monotonic timer is available,
dnl check for additional required libraries.
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_ARG_ENABLE(libgcc,
......@@ -505,8 +560,12 @@ fi
# check for ssize_t
AC_CHECK_TYPE(ssize_t, ,
AC_DEFINE(ssize_t, int, [the signed version of size_t]))
AC_CHECK_TYPE(ssize_t, [ CARES_TYPEOF_ARES_SSIZE_T=ssize_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
AC_CHECK_TYPE([bool],[
......
......@@ -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;
......
......@@ -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), \
......
......@@ -187,7 +187,7 @@ if os.getenv('READTHEDOCS'):
try:
run_setup(EXT_MODULES, run_make=_BUILDING)
except BuildFailed:
if ARES not in EXT_MODULES:
if ARES not in EXT_MODULES or not ARES.optional:
raise
EXT_MODULES.remove(ARES)
run_setup(EXT_MODULES, run_make=_BUILDING)
......
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