Académique Documents
Professionnel Documents
Culture Documents
pl
Closes: #104
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Support for suffix search lists was already built in for Linux. The search list
could be set via set_search. With this change the suffix search list from Windows
is read from the registry and then set into the ares configuration via set_search.
There are two sources for the search list:
Closes #62
Oops.
Fixes #97
My modifications include:
* Dynamically find GetBestRoute2 since it is a Windows Vista+ symbol, and will
fall back to prior behavior when not available.
* Prefer get_DNS_AdaptersAddresses as the modifications should alleviate the
concerns which caused us to prefer get_DNS_NetworkParams
* Update AppVeyor to use MinGW-w64 instead of the legacy MinGW
* Fix compile error in test suite for Windows.
On Windows, the c-ares DNS resolver tries first to get a full list of
DNS server addresses by enumerating the system's IPv4/v6 interfaces and
then getting the per-interface DNS server lists from those interfaces
and joining them together. The OS, at least in the way the c-ares
prefers to query them (which also may be the only or best way in some
environments), does not provide a unified list of DNS servers ordered
according to "current network conditions". Currently, c-ares will then
try to use them in whatever order the nested enumeration produces, which
may result in DNS requests being sent to servers on one interface
(hosting the current default route, for example) that are only intended
to be used via another interface (intended to be used when the first
interface is not available, for example). This, in turn, can lead to
spurious failures and timeouts simply because of the server address
order that resulted because of the enumeration process.
This patch makes the (safe?) assumption that there is no other better
rule to chose which interface's DNS server list should be prioritized.
After all, a DNS lookup isn't something "per network"; applications
don't look up "these DNS names on this interface and those DNS names on
that interface". There is a single resource pool of DNS servers and the
application should presume that any server will give it the "right"
answer. However, even if all DNS servers are assumed to give equally
useful responses, it is reasonable to expect that some DNS servers will
not accept requests on all interfaces. This patch avoids the problem by
sorting the DNS server addresses using the Windows IPv4/v6 routing tables.
By using the metric of the route to the DNS server itself as a proxy for
priority of the DNS server in the list, this patch is able to adapt
dynamically to changes in the interface list, the DNS server lists per
interface, which interfaces are active, the routing table, and so on,
while always picking a good "best" DNS server first.
In cases where any DNS server on any interface will do, this patch still
seems useful because it will prioritize a lower-metric route's (and thus
interface's) servers.
ares test: fix win32 build errors with virtual socket function tests
The added api requires both some typedefs not previously imported
into the test build + the test code did not fully deal with
socket differences on windows.
Closes #72
* Added test case macro to automatically run tests twice, once "normal",
once with virtual IO.
* Changed most "live" query tests to run in dual mode to verify
at least simple socket IO via virtual functions
* Added test case for settings/duping socket functions & callback data
Changed the way usage requirements (include dirs, compile defs, dependent
libraries) are specified, to match the recommended standard practice for modern
CMake. This involves using target-specific functions (target_include_directories,
target_compile_definitions, etc.), along with the PUBLIC, PRIVATE or INTERFACE
modifiers.
Commits 7518c26, c41726b, and bc14ee7 brought this workaround to the CMake build
system. This expands it to the autoconf build system.
Fixes #71
Fixes #69
- Expand XCode clock_gettime fix to include MacOS 10.12, not just iOS10
David Drysdale (4 Oct 2016)
- Revert "travis: work around bug in PyCParser"
See https://github.com/pyca/cryptography/issues/3187
- cleanups as per @gjasny ... Use naked IF statements and use NOT DEFINED
CVE-2016-5180
Bug: https://c-ares.haxx.se/adv_20160929.html
The patch does not modify any source files, it only adds 3 new files
(CMakelists.txt, ares_build.h.cmake, ares_config.h.cmake) which form the
build system. I've tried to go through as much of the autotools tests and
extracted what I thought was appropriate, though many of the tests aren't
as in-depth in CMake as they are for autotools ... it is unclear why some
of them exist at all, I'm guessing for legacy systems that CMake probably
doesn't support anyhow.
Building the library, and examples (adig, ahost, acountry) plus installation
should work across a large number of tested platforms. The tests have not
yet been integrated.
Fixes #63
- ares_init.3: split the init docs into two separate man pages
Taken from:
https://github.com/google/googletest/issues/705#issuecomment-235067917
... they're not really used and by avoiding them in the ares_build.h
output we make the public header less dependent on data sizes.
Therefore:
- add an ARES_OPT_NOROTATE optmask value to allow explicit
configuration of no-rotate behaviour
- in ares_save_options(), report the value of channel->rotate
as exactly one of (optmask & ARES_OPT_ROTATE) or
(optmask & ARES_OPT_NOROTATE).
In terms of back-compatibility:
- existing apps that set ARES_OPT_ROTATE will continue to rotate,
and to have ARES_OPT_ROTATE reported back from ares_save_options()
- existing apps that don't set ARES_OPT_ROTATE will continue to
use local config/defaults to decide whether to rotate, and will
now get ARES_OPT_ROTATE or ARES_OPT_NOROTATE reported back from
ares_save_options() rather than 0.
Just the MIT license used in the top the source files moved out to a
stand-alone file for easier reference and discovery.
Run scan-build over the library source code, but skip the
tests. Needs a later Clang install in Travis
The test binary built in the MinGW build is failing for some
reason. It works for me when I build locally, so I'm guessing
it's down to some sort of AppVeyor environment issue.
Disable for now.
Update msvc_ver.inc
Where there are multiple fuzz input files that only differ in
the first two bytes (the query ID), just keep the first such
file.
Add a test script that runs the fuzzing command over the
corpus of DNS packets. This doesn't actually do any fuzzing
(it just runs them as inputs without generating any variations)
but it does ensure that the fuzzing entrypoint is still working.
- test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record
Also shuffle expected responses rsp6/rsp4 into the order they will occur.
The current approach for disabling tests is not a good solution because
it forces you to pass --disable-tests, rather than auto-detect if your
system can support the tests in the first place. Many (most?) systems
do not have C++11. This also causes issues when chain-building c-ares,
the hosting system needs to be updated to support passing this
additional flag if necessary, it doesn't seem reasonable to add this
requirement which breaks compatibility.
This change auto-detects if the system can build the tests and
automatically disable them if it cannot. If you pass --enable-tests to
configure and the system cannot build them either due to lack of system
support, or because cross-compilation is being used, it will throw an
appropriate error since the user indicated they really did want the
tests.
Fixes #44
Having the test dir completely stand-alone causes too many issues for
users and devs. It still needs to be built specifically.
Closes #42
Closes #17
David Drysdale (11 Feb 2016)
- Use "resolve" as synonym of "dns" in nsswitch.conf
Fixes #33
Add ares_set_socket_configure_callback()
- Add ares_set_socket_configure_callback()
On Linux we can potentially use user and UTS namespaces to run a test
in a pseudo-container with:
- arbitrary filesystem (e.g. /etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts)
- arbitrary hostname/domainname.
Include a first pass at the framework code to allow this, along with a
first test case that uses the container.
Ports are significant in the _ports_ variant functions, so update test to cope.
With the exception of a few tests that make use of the timed
retry aspect of UDP.
- ares_inet_net_pton() variants
- ares_getsock() variants
Including:
- Split each parse function test set out into separate files.
- Add an allocation failure test for each parsing function.
- Add error check test for each parsing function.
Currently get error from Travis on this install step, and downgrading one
version appears to fix the problem.
"Could not find any downloads that satisfy the requirement pyOpenSSL>=0.13
(from requests[security])"
The tests are written in C++11, using the GoogleTest and GoogleMock
frameworks. They have their own independent autoconf setup, so that
users of the library need not have a C++ compiler just to get c-ares
working (however, the test/configure.ac file does assume the use of
a shared top-level m4/ directory). However, this autoconf setup has
only been tested on Linux and OSX so far.
The tests are nowhere near complete yet (currently hitting around
60% coverage as reported by gcov), but they do include examples
of a few different styles of testing:
Note that these URLs will need to be updated if/when the test branch
gets pulled into the master repo/branch.
Note that these macros are not used by the main library autoconf,
just by the tests (which share the same m4/ directory).
Configure with:
./configure --enable-code-coverage
Show coverage output with:
make code-coverage-capture
Change all calls to malloc, realloc and free to use the function pointer
instead. Also ensure that ares_strdup() is always available
(even if the local environment includes strdup(3)), and change the
library code to always use it.
This looks to have been broken since it was first introduced in 2005 in
commit aba0b775ea30 ("Added ares_getnameinfo which mimics the
getnameinfo API")
If the attempt to transfer IPv6 servers from the old to the new channel
fails, the previous code would still return a channel to the user even though
an error return code was generated. This makes it likely that users would
leak the channel, so explicitly clear the channel in this case.
(Both these fixes were actually included in a patchset sent on the mailing
list in Oct 2012, but were included with other functional changes that
didn't get merged:
http://c-ares.haxx.se/mail/c-ares-archive-2012-10/0004.shtml)
The top two bits of the label length indicate whether this is a
label length (00) or an index to a name elsewhere in the message
(11). RFC1035 4.1.4 says that the other possible values for the
top two bits (01, 10) are reserved for future use.
- README.cares: s/I/Daniel
... and add a pointer to an existing version of the original area 1.1.1
package.a
CID 56884, pointed out by Coverity. We really should make this function
return an error code so that a malloc() failure can return back a major
failure.
CID 56889 in Coverity pointed out the return code from setsocknonblock()
is ignored, and this added typecast to (void) makes it explicit.
The original patch from Gregor Jasny did not have the break
statement; I incorrectly added it to prevent continuing the loop.
However, the later entries in the array would then be left
uninitialized, causing problems for later cleanup.
This patch is fixing the dns lookup issue due to dummy dns information
of a disconnected adapter(in my case is a bluetooth adapter). I changed
the dns lookup policy to try GetNetworkParams first because the
GetNetworkParams provides the most reliable dns information (lots of
checks were done by system). I also filter out inoperable adapter in
DNS_AdaptersAddresses in case GetNetworkParams fail.
Fix integer shift overflow if both tcp_socket and udp_socket are set
The problem occurs if at the start of the loop the sockindex is at the
last valid ARES_GETSOCK_MAXNUM position. If then both udp_socket and
tcp_socket are valid, sockindex gets incremented for UDP first and
points one entry behind the array for the tcp block.
So the fix is to check after every increment of sockindex if it is still
valid.
Comment in ares_ipv6.h
[1] https://github.com/bagder/c-ares/commit/ee22246507c9#commitcomment-6587616
Add the "-s domain" command line option to override the search
domains.
1. gcc actually does not use __ppc__ and __ppc64__ but __PPC__ and
__PPC64__. The tests of __ILP32__ and __LP64__ are sufficient for gcc.
2. clang defines __GNU__ and defines both __ppc64__ and __ppc__ when
targeting ppc64. This makes CARES_SIZEOF_LONG to be 4 on a ppc64 system
when building with clang.
My patch is two change the order of the checks so that we check the
64-bit case first.
This makes the header file much more multi-arch friendly and can be used
as-is with both 32 bit and 64 bit builds.
ares__timeoffset() was only used once within this single source file
ares__timeadd() was only ever used from within the same source
Fixed bug that caused the last part of an IPv6 address to be parsed as
the port number when the last part is all numeric.
Previously, the function would wrongly return all substrings merged into
one.
Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-04/0016.shtml
This commit adds a line to .gitignore to the effect that patch files
generated by 'git format-patch' are excluded from the repository.
- check __LP64__ for gcc 3.3 and newer, while keeping 64bit processor
architecture checks for older versions which don't define __LP64__
- ares_inet_ntop.3: s/socklen_t/ares_socklen_t
- inet_ntop.c: s/socklen_t/ares_socklen_t
- ares_inet_pton/ntop: cleanup
Make sure that the symbols are always exported and present in c-ares.
... since there's only one user, make it static within ares_process.c
URL: http://curl.haxx.se/mail/lib-2013-01/0355.html
Reported by: Tor Arntsen
- Take into account that 'wc' may return leading spaces and/or tabs.
URL: http://curl.haxx.se/mail/lib-2013-01/0351.html
URL: http://curl.haxx.se/mail/lib-2013-01/0306.html
- Update comments
- Execute commands in subshells
- Faster path separator check
- Fix missing 'test' command
- Rename private macros
- Minimize AC_REQUIRE usage
Tested with:
Take in account that POSIX standard Issue 7 drops h_errno support. Now, we also
consider getaddrinfo() to be thread-safe when (_POSIX_C_SOURCE >= 200809L) or
(_XOPEN_SOURCE >= 700) independently of whether h_errno exists or not.
Issue: When building a 32bit target with large file support HP-UX
<sys/socket.h> header file may simultaneously provide two different
sets of declarations for sendfile and sendpath functions, one with
static and another with external linkage. Given that we do not use
mentioned functions we really don't care which linkage is the
appropriate one, but on the other hand, the double declaration emmits
warnings when using the HP-UX compiler and errors when using modern
gcc versions resulting in fatal compilation errors.
Use of the wrong define made the function not parse IPv6 addresses
properly.
Bug: http://c-ares.haxx.se/mail/c-ares-archive-2012-06/0028.shtml
Reported by: Sal Ibarra Corretg
The UDP and TCP port are stored in network byte order in the
ares_channeldata, but are passed in to ares_init_options() in host byte
order. Thus we must return them from ares_save_options() in host byte
order too, or a duplicated channel will convert them again, leading to a
nonfunctional channel and a mysterious connection refused error from
ares_gethostbyname(). This breaks ares_dup(), thus the curl easy API
when c-ares is used by curl, and thus all the curl easy API's users.
Before, c-ares always used the first DNS server on Android, causing
network problems if this DNS server was not available.
When building a Windows target with gcc 4.5 or newer and strict compiler
warnings enabled use -Wno-pedantic-ms-format in addition to other flags.
Bug: http://c-ares.haxx.se/mail/c-ares-archive-2012-02/0004.shtml
- Removed funny spaces after open paren and before closing paren
When using Sun C compiler the preprocessor somehow inserts an extra space
in front of replaced symbol, breaking CURL_CHECK_DEF macro. To workaround
this, macro CURL_CHECK_DEF now ignores all leading whitespace in front of
symbol substitution result.
- warnings: fix another 'conversion may lose significant bits' compiler warning
The former human edited CHANGES file was renamed to CHANGES.0 in git.
- warnings: fix some 'conversion may lose significant bits' compiler warnings
Makefile.Watcom:
* The 'NTDDI_VERSION' needs to be raised to 0x05010000
in order for SOCKADDR_STORAGE etc. to be typedefed.
* Replaced '-dUSE_WATT32' with '-dWATT32'.
* Added $(DEMOS) to the 'all' target and removed the 'demos'
target to be consistent with e.g. Makefile.msvc etc.
* 'ENABLE_IPV6' is no longer used. Hence removed the '%use_ipv6' construct.
* object-file order seems to be important (Watcom v.19). Hence
'ares_getopt.obj' must be put after the .obj that references getopt().
This is a Red Hat specific patch that does not belong into upstream
- Only fall back to AF_INET searches when looking for AF_UNSPEC addresses
The code received the return codes in the 'status' variable without
using it. Instead we just ignore those particular errors.
Avoid the risk of reading 16bit data from an unaligned address by using
a macro that is adapted for this.
- Remove rcsid.
- Adjust header file inclusions.
- ares_inet_ntop used only on systems without a proper inet_ntop function.
File resolv.conf may either use a hash '#' or a semicolon ';' character as an
indication that the rest of the line is a comment. This fixes not recognizing
the semicolon as a valid comment indicator in resolv.conf.
- fix compiler warning: rounding, sign extension, or loss of accuracy may result
Bug: http://groups.google.com/group/nodejs/browse_thread/thread/a1268c9ea5e9ad9b
Temporarily, When cross-compiling with gcc 3.0 or later, enable strict aliasing
rules and warnings. Given that cross-compiled targets autobuilds do not run the
test-suite, there is no risk of running code that violates strict aliasing rules
Upon socket address family and length validation failure return ARES_ENOTIMP
in callback again, this is the error code documented in man page and used
mostly all over the library.
Validate socket address family and that the socket address length is appropriate
for the specified family. Failure is reported with ARES_EBADFAMILY in callback.
- Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-
aliasing rules'.
The purpose of the whole patch was to silence a compiler warning triggered
with GCC 4 on file ares_process.c The specific compiler warning was
'dereferencing type-punned pointer might break strict-aliasing rules'.
It is simply the last part of the NAPTR record, the replacement element,
which is not a string, as currently handled in adig, but a domain name.
If there aren't any sort items to copy, don't bother. Without this
little precaution it would do a malloc(0) which causes undefined
behaviors and is frowned upon by curl's memdebug-system.
- Block created ares_build.h for NetWare to avoid usage from other platforms.
The IS*() set of macros are preferred to the regular is*() functions as
they help us avoid the most common pitfalls.
To use:
./configure --enable-warnings --enable-werror
Add 3 new functions to set the local binding for the out-going
socket connection, and add ares_set_servers_csv() to set a
list of servers at once as a comma-separated string.
added ares_parse_mx_reply
- spell fix
- s/CVS/git
- Added ares_nowarn.c.
- - Where run-time error checks enabling compiler option /GZ was used it is now
replaced with equivalent /RTCsu for Visual Studio 2003 and newer versions.
- Compiler option /GX is now replaced with equivalent /EHsc for all versions.
- When using icc, compile with -fpic and link with intel dynamic libraries.
- Fix language
- Added README.msvc
- Allow using different extra import libraries for debug and release builds.
- Remove typecast
- Fix comment
- Initial support for the generic ares_free_data() function that will allow
applications to free memory allocated and returned by some c-ares funtions.
- Fix icc 9.0 compiler warning: external definition with no prior declaration
The h_errno macro test now only done on systems for which there
is no hard coded knowledge about getaddrinfo's thread safeness.
Add some comments to better understand what the regex's pretend to achieve.
- Add kernel32.lib
- Make some strings different in resource file for debug or release builds
- Fix comment
- Adjusted a comment.
- ignore files
- Empty subdir
- Updated MSVC 6.0 workspace and project files that allows building
dynamic and static c-ares libraries in debug and release flavours.
- Fix comment
- Fix spelling
- Fix compiler warning: addition result could be truncated before cast to bigger
sized type
- Overhauled ares__get_hostent()
- Fixing out of bounds memory overwrite triggered with malformed /etc/hosts file.
- Improving parsing of /etc/hosts file.
- Validating requested address family.
- Ensuring that failures always return a NULL pointer.
- Adjusting header inclusions.
- changed u_int16_t to unsigned short because it is the only place within ares and
curl where such a type would be used;
also it broke many autobuilds. We should probably introduce an ares_port_t if we
want to use a type here.
- - Joshua Kwan fixed the init routine to fill in the defaults for stuff that
fails to get inited by other means. This fixes a case of when the c-ares
init fails when internet access is fone.
- Remove DEBUGBUILD symbol definition, is not required for programs using the
library.
- fix comment
- Try to make more clear that --enable-curldebug has nothing to do with --enable-
debug for this library.
With the curl memory tracking feature decoupled from the debug build feature,
CURLDEBUG and DEBUGBUILD preprocessor symbol definitions are used as follows:
CURLDEBUG used for curl debug memory tracking specific code (--enable-curldebug)
- Ensure that buildconf.bat does nothing unless it is used with a CVS checkout.
- CVS-INFO file only present in CVS tree, never in release nor daily snapshot
archives. Used as a sentinel file in buildconf.bat to differentiate CVS builds.
- John E. Malmberg noticed that the configure script was failing to detect the
timeval struct on VMS when building with _XOPEN_SOURCE_EXTENDED undefined due
to definition taking place in socket.h instead of time.h
- Temporarily introduce a memory leak to verify curl debug memory tracking works.
- Prevent copying 'sourced' manpages for build targets that don't use them.
- Force revision update, to force CVS to update the $Id date string format
- Add same copyright notice as other c-ares files
- Fix case
- Proper naming for the experimental compiler test and moved to *-compilers.m4
- fix EOL
- fix EOL
- ares_socklen_t follow-up
- ignore stamp-h*
- Added CARES_INCLUDES_SYS_TYPES
- ignore
- Set HP-UX compiler warning level back to the one that exposes
the socklen_t issue on this platform.
- fix compiler warning: implicit conversion shortens 64-bit value into a 32-bit
value
- s/u_long/unsigned long/
- Do not halt compilation when using VS2008 to build a Windows 2000 target
- ignore
- Introduce ares_dup(3) and new thoughts about API/ABI and how to move forwards.
Also discussed on the ml.
- Convert the public config struct to the same binary size/construct as in the
latest releases to remain ABI compatible.
- please the picky compilers by staying with short as the data we get is short
only
- Make configure script check if ioctl with the SIOCGIFADDR command can be
used, and define HAVE_IOCTL_SIOCGIFADDR if appropriate.
- #include <string.h> in the getaddrinfo() runtime check for the memset() prototype
- - Carlo Contavalli added support for the glibc "rotate" option, as documented
in man resolv.conf:
causes round robin selection of nameservers from among those listed. This
has the effect of spreading the query load among all listed servers, rather
than having all clients try the first listed server first every time.
- fix comment
- make CHECK_FUNC_GETADDRINFO_UNFREEABLE_AI_ADDR
and CHECK_FUNC_GETADDRINFO_UNFREEABLE_AI_CANONNAME
internal to CHECK_FUNC_GETADDRINFO
- fix leftover
- icc adjustments:
Select precise floating-point model, otherwise doubles are less than 64-bit
wide
- icc adjustments:
- remove from configure.ac temporary magic for the icc seg-fault issue
- messages initially intended only for debug purposes, now become permanent
since these are extremely useful when compiler rejects a set of options.
- With this change Solaris target builds will now be done with _REENTRANT defined.
-Wmissing-declarations
-Wmissing-prototypes
-Wunused
-Wshadow
-Wmissing-prototypes
-Wunused
-Wshadow
- split SGI compiler check. One for MIPS C and another for MIPSpro C
- HP C adjustments:
Due to the HP-UX socklen_t issue it is insane to use the +w1 warning level.
It generates more than 1100 warnings on socklen_t related statements.
Until the issue is somehow fixed we will just use the +w2 warning level.
- oops
- HP C adjustments:
- refactoring of COMPILER_BASIC_OPTS
- fix VAR_STRIP
- fix comment
- now compiler warnings are activated for all gcc builds, not only debug ones.