From 2811e30d4919d4b00d2e8d648896987574a50370 Mon Sep 17 00:00:00 2001 From: Carsten Larsen Date: Wed, 12 Apr 2017 01:21:06 +0200 Subject: [PATCH] Release 1.12.0 --- AUTHORS | 14 + CHANGES | 3971 +++++++++++++++++++++++++++++++++- INSTALL | 2 +- LICENSE.md | 15 + Makefile.am | 4 +- Makefile.dj | 2 +- Makefile.m68k | 57 +- Makefile.msvc | 78 +- Makefile.netware | 9 - README.cares | 2 +- README.md | 7 +- RELEASE-NOTES | 39 +- acountry.1 | 6 +- acountry.c | 17 +- adig.1 | 6 +- adig.c | 23 +- ahost.1 | 6 +- ahost.c | 20 +- amiga_port.c | 18 +- ares.h | 1 + ares_build.h | 95 + ares_build.h.in | 16 - ares_cancel.3 | 15 +- ares_config.h | 502 +++++ ares_create_query.3 | 69 +- ares_create_query.c | 84 +- ares_destroy.3 | 20 +- ares_destroy_options.3 | 9 +- ares_dns.h | 4 - ares_dup.3 | 2 +- ares_free_string.3 | 5 +- ares_getnameinfo.c | 1 + ares_init.3 | 168 +- ares_init.c | 53 +- ares_init_options.3 | 263 ++- ares_ipv6.h | 6 +- ares_library_init.3 | 20 +- ares_library_init.c | 21 +- ares_nowarn.c | 46 +- ares_process.c | 3 +- ares_rules.h | 7 +- ares_setup.h | 14 +- ares_version.h | 6 +- buildconf | 0 c-ares-src.readme | 30 + cares.rc | 6 +- config-amiga.h | 14 + config-dos.h | 3 - config-win32.h | 13 - configure.ac | 106 +- include/clib/amitcp_protos.h | 26 - include/inline/amitcp.h | 2 - install-sh | 0 maketgz | 0 mkinstalldirs | 0 setup_once.h | 49 + test/Makefile.am | 7 +- test/Makefile.inc | 7 +- test/ares-fuzz.c | 58 + test/ares-test-fuzz.c | 46 + test/ares-test-init.cc | 59 +- test/ares-test-live.cc | 2 +- test/ares-test-main.cc | 7 +- test/ares-test-misc.cc | 13 + test/ares-test-mock.cc | 43 +- test/dns-dump.cc | 35 + workman1 | 7 +- workman2 | 7 +- 68 files changed, 5548 insertions(+), 718 deletions(-) create mode 100644 LICENSE.md create mode 100644 ares_build.h create mode 100644 ares_config.h mode change 100755 => 100644 buildconf create mode 100644 c-ares-src.readme create mode 100644 config-amiga.h mode change 100755 => 100644 install-sh mode change 100755 => 100644 maketgz mode change 100755 => 100644 mkinstalldirs create mode 100644 test/ares-fuzz.c create mode 100644 test/ares-test-fuzz.c create mode 100644 test/dns-dump.cc mode change 100755 => 100644 workman1 mode change 100755 => 100644 workman2 diff --git a/AUTHORS b/AUTHORS index d3e2c24..af29ec8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,6 +2,8 @@ c-ares is based on ares, and these are the people that have worked on it since the fork was made: Albert Chin +Alex Loukissas +Alexander Klauer Alexander Lazic Alexey Simak Andreas Rieke @@ -15,6 +17,7 @@ BogDan Vatra Brad House Brad Spencer Bram Matthys +Chris Araman Dan Fandrich Daniel Johnson Daniel Stenberg @@ -31,6 +34,7 @@ Eino Tuominen Erik Kline Fedor Indutny Frederic Germain +Geert Uytterhoeven George Neill Gisle Vanem Gregor Jasny @@ -41,6 +45,7 @@ Henrik Stoerner Jakub Hrozek James Bursa Jérémy Lal +Keith Shaw Lei Shi Marko Kreen Michael Wallner @@ -48,12 +53,17 @@ Mike Crowe Nick Alcock Nick Mathewson Nicolas "Pixel" Noble +Ning Dong +Oleg Pudeyev +Patrick Valsecchi Patrik Thunstrom +Paul Saab Peter Pentchev Phil Blundell Poul Thomas Lomholt Ravi Pratap Robin Cornelius +Saúl Ibarra Corretgé Sebastian at basti79.de Shmulik Regev Stefan Bühler @@ -62,7 +72,11 @@ Svante Karlsson Tofu Linden Tom Hughes Tor Arntsen +Viktor Szakats Vlad Dinulescu William Ahern Yang Tse +hpopescu at ixiacom.com liren at vivisimo.com +nordsturm +saghul diff --git a/CHANGES b/CHANGES index f1426fd..93e6a43 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,3968 @@ -This file no longer holds the changelog. Now you can generate it yourself -like this: + Changelog for the c-ares project. Generated with git2changes.pl - $ git log --pretty=fuller --no-color --date=short --decorate=full -1000 | - ./git2changes.pl +Version 1.12.0 (29 Sep 2016) -The older, manually edited, changelog is found in git named CHANGES.0 +Daniel Stenberg (29 Sep 2016) +- RELEASE-NOTES: 1.12.0 + +- [David Drysdale brought this change] + + ares-test-misc: test ares_create_query with escaped trailing dot + +- ares_create_query: avoid single-byte buffer overwrite + + ... when the name ends with an escaped dot. + + CVE-2016-5180 + + Bug: https://c-ares.haxx.se/adv_20160929.html + +- ares_library_initialized.3: added + +- make: bump CARES_VERSION_INFO for release + +David Drysdale (29 Sep 2016) +- man: update ares_init_options.3 + +Daniel Stenberg (29 Sep 2016) +- ares_library_init.3: corrected the ares_library_init_mem proto + +- README.md: remove space from link + +- README: link to the correct c-ares badge! + + Reported-by: David Hotham + + Fixes #63 + +- docs: minor formatting edits + +- ares_destroy.3: formatting polish + +- ares_init.3: split the init docs into two separate man pages + +- SECURITY: point to the vulnerabilities page now + +- RELEASE-NOTES: synced with daa7235b1a5 + +- ares_create_query.3: edit language + + Tried to make the man page more readable. + +David Drysdale (26 Sep 2016) +- test: fix gMock to work with gcc >= 6.x + + Taken from: + https://github.com/google/googletest/issues/705#issuecomment-235067917 + +Daniel Stenberg (26 Sep 2016) +- [Brad House brought this change] + + headers: remove checks for and defines of variable sizes + + ... 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. + +David Drysdale (24 Sep 2016) +- api: add ARES_OPT_NOROTATE optmask value + + Fix up a couple of problems with configuring whether c-ares rotates + between different name servers between requests. + + Firstly, ares_save_options() returns (in *optmask) the value of + (channel->optmask & ARES_OPT_ROTATE), which doesn't necessarily + indicate whether the channel is or is not actually doing rotation. + This can be confusing/incorrect if: + - the channel was originally configured without ARES_OPT_ROTATE + (so it appears that the channel is not rotating) + - the /etc/resolv.conf file includes the 'rotate' option + (so the channel is actually performing rotation). + + Secondly, it is not possible to reliably configure a channel + to not-rotate; leaving off ARES_OPT_ROTATE is not enough, since + a 'rotate' option in /etc/resolv.conf will turn it on again. + + 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. + +- ares_init_options: only propagate init failures from options + + Commit 46bb820be3a8 ("ares_init_options: don't lose init failure") + changed init behaviour so that earlier errors in initialization + weren't lost. In particular, if the user passes in specific + options but they are not applied (e.g. because of an allocation + failure), that failure needs to be reported back to the user; this + also applies when duplicating a channel with ares_dup(). + + However, other initialization failures can be ignored and + overridden -- in particular, if init_by_resolv_conf() or + init_by_environment() fail, then falling back to default values + is OK. + + So only preserve failures from the init_by_options() stage, not + from all initialization stages. + + Fixes issue 60. + +- test: Force reinstall of libtool on OSX + + Travis build environment appears to have changed. + +- test: Add valgrind build variant + +- test: Add null pointer to gtest args + + GoogleTest assumes that there is a null pointer in argv[argc], + so make it look like that. Without this change, tests run with + command-line arguments get memory errors under valgrind/ASAN. + +Daniel Stenberg (21 Aug 2016) +- AUTHOR: maybe gitgub isn't really an author =) + +- AUTHORS: added contributors from the git log + +- LICENSE.md: add a stand-alone license file + + Just the MIT license used in the top the source files moved out to a + stand-alone file for easier reference and discovery. + +- README: added "CII best practices" badge + +- SECURITY.md: suggested "security process" for the project + +David Drysdale (17 Aug 2016) +- test: Add Clang static analysis build to Travis + + Run scan-build over the library source code, but skip the + tests. Needs a later Clang install in Travis + +- test: more info on how to run fuzz testing + +- test: make fuzzer driver code C not C++ + +- test: fuzzer mode for AFL's persistent mode + + When fuzzing with AFL, if the LLVM-based instrumentation is + used (via the afl-clang-fast wrapper), then it is possible to + have a single execution of the fuzzer program iterate multiple + times over the fuzzing entrypoint (similar to libFuzzer's normal + mode of execution) with different data. This is much (e.g. 10x) + faster. + + Add code to support this, by checking whether __AFL_LOOP is + defined at compile-time. + + Also, shift the code to effectively be C rather than C++. + +- test: simplify deps for fuzzer entrypoint + + No need to depend on the rest of the test code (ares-test.h) for + the fuzzer entrypoint; this makes the entrypoint slightly simpler + to build with LLVM's libFuzzer. + + Also shift the code to effectively be C rather than C++ + +- test: disable MinGW tests + + 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. + +Daniel Stenberg (16 Aug 2016) +- read_tcp_data: remove superfluous NULL check + + CID 56884 by Coverity. The pointer is already derefenced before this + point so it can't be NULL here anyway. + +- web: http => https + +GitHub (20 Jul 2016) +- [David Drysdale brought this change] + + Merge pull request #59 from fuze/master + + Update msvc_ver.inc for VS2015 Update 3 + +- [Chris Araman brought this change] + + Update msvc_ver.inc + + support Visual Studio 2015 Update 3 + +David Drysdale (2 May 2016) +- Fix trailing comment for #endif + +Daniel Stenberg (30 Apr 2016) +- email: use Gisle's "new" address + +David Drysdale (18 Apr 2016) +- test: drop superfluous fuzz inputs + + Where there are multiple fuzz input files that only differ in + the first two bytes (the query ID), just keep the first such + file. + +svante karlsson (15 Apr 2016) +- Update msvc_ver.inc + + support Visual Studio 2015 Update 2 + +David Drysdale (31 Mar 2016) +- test: Run fuzzcheck.sh in Travis build + +- test: add fuzzing check script to tests + + 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: allow multiple files in aresfuzz command line + + If no arguments are specified, use stdin as input. + Otherwise treat each argument as a filename and feed + its contents to the fuzz entrypoint. + +- test: Add corpus of DNS packets + + For fuzz testing it is useful to start from a corpus of valid + packets, so fill out the test/fuzzinput/ directory with a bunch + of inputs. + + These packets were generated by temporarily modifying the c-ares + process_answer() function to save off any incoming response messages. + +- test: Add utility to show DNS packet from file + +- [nordsturm brought this change] + + Fix nsort initialization + + Author: Alexander Drachevskiy + http://c-ares.haxx.se/mail/c-ares-archive-2014-07/0004.shtml + http://c-ares.haxx.se/mail/c-ares-archive-2014-07/0014.shtml + +- test: Check setting nsort=0 option is respected + +- test: Update fuzzing function prototype + + libFuzzer changed expected return type from void to int + in LLVM 3.8. + +- Explicitly clear struct servent before use + + On a build where MSAN has been manually set up (which involves + using an MSAN-instrumented version of the standard C++ library, see + https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo) + there's a warning about use of uninitialized memory here. It + might be a false positive, but the fix is trivial so include it. + +- 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. + +- [Chris Araman brought this change] + + msvc_ver.inc: support Visual Studio 2015 Update 1 + +- build: commonize MSVC version detection + + Remove the need to copy/paste version number mapping between + Makefile.msvc and test/Makefile.msvc. + +- test: Use different name in live test + +- test: Only pass unused args to GoogleTest + +- ahost.c: add cast to fix C++ compile + + If ahost.c is force-compiled as C++ the missing cast from + (void *) to (char **) is problematic. + +- ares_library_cleanup: reset ares_realloc too + + Otherwise a subsequent use of the library might use a previous + incarnation's realloc() implementation. + +Daniel Stenberg (9 Mar 2016) +- [Brad House brought this change] + + configure: check if tests can get built before enabled + + 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. + +David Drysdale (3 Mar 2016) +- [Viktor Szakats brought this change] + + Makefile.m32: add support for CROSSPREFIX + +- [Viktor Szakats brought this change] + + Makefile.m32: add support for extra flags + + Allow specification of CARES_{LD,C}FLAG_EXTRAS envvars + for mingw + +- test: Build with MinGW on AppVeyor + +- test: avoid in6addr_* constants + + These aren't available on MinGW, so use explicit addresses instead. + +- test: add missing #includes for dns-proto.cc + +- [Gregor Jasny brought this change] + + Fix man page typos detected by Lintian + +Daniel Stenberg (19 Feb 2016) +- configure: acknowledge --disable-tests + + Fixes #44 + +- AUTHORS: added contributors from the 1.11.0 release + +- bump: start working on the next version + +Version 1.11.0 (19 Feb 2016) + +Daniel Stenberg (19 Feb 2016) +- RELEASE-NOTES: final edits for 1.11.0 + +David Drysdale (15 Feb 2016) +- ares_dup.3: remove mention of nonexistent function + + ares_dup_options() doesn't exist, so don't document it. + +- test: skip repeated build steps + + Top-level buildconf/configure now triggers for the + test/ subdir too, so don't need to do explicitly. + +- test: namespaces unavailable when cross-compiling + +Daniel Stenberg (13 Feb 2016) +- configure: only run configure in test when NOT cross-compiling + + ... as the tests won't run cross-compiled anyway + +David Drysdale (13 Feb 2016) +- test: prefer ON_CALL to EXPECT_CALL to reduce flakes + + For UDP tests, there's a chance of a retry. EXPECT_CALL only + expects a single request to arrive at the server; ON_CALL allows + for a UDP retry and repeats the same answer. + + Note that ON_CALL and EXPECT_CALL can't be mixed in the same + test, and that tests that have a varied sequence of responses + for the same repeated request still have to use EXPECT_CALL. + +Daniel Stenberg (13 Feb 2016) +- configure: run configure in 'test' too + + Having the test dir completely stand-alone causes too many issues for + users and devs. It still needs to be built specifically. + +- configure: build silently by default + +- buildconf: run test/buildconf too if present + +- test/configure: build silently by default + +- [Gregor Jasny brought this change] + + dist: Distribute README.md + + Closes #42 + +Version 1.11.0 (11 Feb 2016) + +Daniel Stenberg (11 Feb 2016) +- Makefile.am: distribute the test dir too + +- RELEASE-NOTES: synced with 385582bd14b68a + +- [Nicolas \"Pixel\" Noble brought this change] + + ares_win32_init: make LoadLibrary work when using UNICODE too + + Closes #17 + +David Drysdale (11 Feb 2016) +- Use "resolve" as synonym of "dns" in nsswitch.conf + + Modern Linux systems may have libnss_resolve from systemd as the + resolver, which is then configured in /etc/nsswitch.conf with + the "resolve" keyword rather than "dns". + + Fixes #33 + +- ares_set_socket_callback: make manpage match code + + The code in ares_process.c that invokes the socket creation/connection + callback only checks for rc < 0, not for standard ares error codes. + +- Merge pull request #36 from AGWA-forks/master + + Add ares_set_socket_configure_callback() + +- test: Update init tests to match behaviour + + Unreadable config files are now treated the same way + as absent config files. + +- [Fedor Indutny brought this change] + + Ignore `fopen` errors to use default values + + After 46bb820be3a83520e70e6c5f0c5133253fcd69cd `init_by_resolv_conf` + errors are no longer swallowed in `ares_init_options`. This has exposed + a previously unknown bug in `lookups` initialization code. + + If there is no lookup configuration in `resolv.conf`, + `init_by_resolv_conf` will attempt to read it from other files available + on the system. However, some of these files may have restricted + permissions (like `600`), which will lead to `EACCESS` errno, which in + turn is handled like a fatal error by `init_by_resolv_conf`. + + However, it sounds illogical that this error should be handled as a + fatal. There is a `init_by_defaults` call that overrides `lookups` with + default value, and certainly possible absence of lookup information is + the reason why this function exists in a first place! + + I suggest handling any `fopen` errors as non-fatal ones, allowing to + pick up the `lookups` value from different config files, or to pick up + default value. + +Andrew Ayer (9 Feb 2016) +- Document callback type in man page for ares_set_socket_callback + +- Add ares_set_socket_configure_callback() + + This function sets a callback that is invoked after the socket is + created, but before the connection is established. This is an ideal + time to customize various socket options. + +David Drysdale (9 Feb 2016) +- test: ares_set_socket_callback failure behaviour + +- test: Check ares_parse_txt_reply_ext() entrypoint + +- [Fedor Indutny brought this change] + + txt: introduce `ares_parse_txt_reply_ext` + + Introduce `ares_txt_ext` structure with an extra `record_start` + field, which indicates a start of a new TXT record, thus allowing to + differentiate the chunks in the same record, from a chunks in a + different record. + + Introduce a new API method: `ares_parse_txt_reply_ext` that works with + this kind of struct. + +- doc: Update missed repo references + +- doc: Update docs on contributing + +- test: Run command line tools in Travis + + Do a quick execution of each of the command line tools + in the continuous integration build, so that any (say) + sanitizer failures show up. + +- acountry: drop inert test + + If ver_1 is true, then z0 and z1 must both be 'z', and so + (z0 != 'z' && z1 != 'z') can never be true. + + CID 56879, pointed out by Coverity. + +- doc: update badge locations to master repo + +- test: Enable maintainer mode + debug in Travis + +- test: Add an iOS build target + +- test: Ignore SIGPIPE in tests + +- test: More initialization tests + +- test: Improve containerized test mechanism + + Aim is to ensure that code coverage information can escape the + container. To do this: + - Enter a new mount namespace too, so that we can... + - Bind mount the expected source directory into the container + - Share memory with the sub-process so coverage information is + shared too. + +- test: Make contained tests easier to write + +- test: Add framework for containerized testing + + 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. + +- test: Use a longer timeout for less flakiness + + Having occasional test failures from timeout before multiple + queries can complete, so up the default timeout for the test + from 100ms to 1500ms. + +- test: Make failure tests more robust + + Different platforms will do different numbers of allocations + in the processing of a given API call; just check that the + return code is either success or ENOMEM, and free off any + returned state in the former case. + + Also cope with ECONNREFUSED as well as ENOTFOUND. + +- test: Get test code building under Windows + + - Initial nmake file based off library nmake file + - Cast socket call arguments to (char *) + - Use wrapper sclose() that maps to closesocket() or close() + - Build a config.h indicating presence of headers + - Conditionally include netdb.h + - Remove unnecessary include of sys/socket.h + - Force longer bitmask for allocation failure tracking + - Call WSAStartup() / WSACleanup() in main() + - Set TCP_NODELAY for mock server + - Turn on tests in AppVeyor build + +- test: Disable tests that manipulate env on Windows + +- test: Move file lists into Makefile.inc + + In preparation for a Win32 build of the test suite. + +- test: Add a simple multi-server test + + Check rotate option does something + +- test: Allow for multiple mock servers + + - Update the MockServer to allow separate specification of + UDP and TCP ports + - Have an array of mock servers listening on consecutive + sets of ports. + - Rename Process(fd) to ProcessFD(fd) to avoid confusion. + - Initialize channel by using the new ares_set_servers_ports() + entrypoint, so multiple ports on the same loopback address + can be used. + +- test: Update test for set/get_servers variants + + Ports are significant in the _ports_ variant functions, so update test to cope. + +- test: Make GetNameServers() utility function port-aware + + Also make it generally available. + +- test: more testing, including of internal static functions + +- test: more tests, especially fallback processing + + - Make mock server listen on UDP + TCP in parallel. + - Test UDP->TCP fallback on truncation + - Test EDNS->no-EDNS fallback + - Test some environment init options + - Test nonsense reply + + test: short response + +- test: more tests, particularly of initialization + +- test: Run mock tests over both TCP and UDP + + With the exception of a few tests that make use of the timed + retry aspect of UDP. + +- test: Run mock tests over both IPv4 and IPv6 + +- test: Add more tests for edge cases + +- test: more nooks and crannies of pton functions + +- test: More tests for PTR parsing + +- test: Use of HOSTALIAS environment variable + +- test: Add RAII utility classes for testing + + - TempFile holds specific contents + - EnvValue sets an environment variable + +- test: More search domain scenarios + +- test: Remove duplicate flags from Makefile.am + +- test: Make test code leak-free + +- test: More tests + + - test use of sortlist + - test gethostbyname(AF_UNSPEC) + +- test: Test ares_gethostbyname_file() + +- test: Add more tests of ares_getnameinfo() + +- test: Tweak tests, add alloc failure test + +- test: Test init with options + +- test: More tests + + - ares_inet_net_pton() variants + - ares_getsock() variants + +- test: Expose ProcessWork() function + +- test: More parsing tests + + 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. + +- test: Add various additional tests + +- test: More tests + + Include tests of internal functions, based on the value of the + CARES_SYMBOL_HIDING macro; need to configure the library with + --disable-symbol-hiding to enable these tests. + +- test: Allow command line override of mock server port + +- test: Add README.md documentation + +- test: Temporarily avoid latest Python requests package + + 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])" + +- test: Add AppVeyor config file for Windows build + +- test: Add configuration for a Travis build + + Cover Linux & OSX on the container infrastructure, but install + a later G++ to satisfy the tests' need for C++11. + + Use a build matrix to include a variety of build variants: + - ASAN + - UBSAN + - LSAN + - Coverage via coveralls.io + + test: invoke ASAN and coverage in Travis build + + Also shift to use explicit build matrix + + test: Use coveralls.io for coverage tracking + + test: Add a build with UBSAN + + Also expand and re-order the setting of environment variables + for easier modification. + + test: Add LSAN build to Travis config + +- test: Add initial unit tests for c-ares library + + 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. + + Run with "./arestest", or "./arestest -v" to see extra debug info. + The GoogleTest options for running specific tests are also + available (e.g. "./arestest --gtest_filter=*Live*"). + + 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: + + - There are live tests (ares-test-live.cc), which assume that the + current machine has a valid DNS setup and connection to the + internet; these tests issue queries for real domains but don't + particularly check what gets returned. The tests will fail on + an offline machine. + + - There a few mock tests (ares-test-mock.cc) that set up a fake DNS + server and inject its port into the c-ares library configuration. + These tests allow specific response messages to be crafted and + injected, and so are likely to be used for many more tests in + future. + + - To make this generation/injection easier, the dns-proto.h file + includes C++ helper classes for building DNS packets. + + - Other library entrypoints that don't require network activity + (e.g. ares_parse_*_reply) are tested directly. + + - There are few tests of library-internal functions that are not + normally visible to API users (in ares-test-internal.cc). + + - A couple of the tests use a helper method of the test fixture to + inject memory allocation failures, using the earlier change to the + library to allow override of malloc/realloc/free. + + - There is also an entrypoint to allow Clang's libfuzzer to drive + the packet parsing code in ares_parse_*_reply, together with a + standalone wrapper for it (./aresfuzz) to allow use of afl-fuzz + for further fuzz testing. + +- test: Add local copy of GoogleMock/GoogleTest 1.7.0 + + Don't check in gtest/m4 files, as they are unused and interfere + with the top-level configure process. + +- doc: Show build badges in README.md + + Note that these URLs will need to be updated if/when the test branch + gets pulled into the master repo/branch. + +- doc: Convert README to README.md + + Gives better display on GitHub + +- doc: Update in preparation for next release + + Assume 1.11.0 is next (as there are various API additions). + Also add myself to AUTHORS. + +- build: Allow header compilation by Windows C++ compiler + +- build: Expose whether symbol hiding is on + + Adding the CARES_SYMBOL_HIDING definition allows the test suite to + detect whether internal symbols are available or not. + +- build: Add autoconf macros for C++11 code using pthreads + + Pull in testing macros from the GNU autoconf archive to allow + configure scripts to test for and setup use of a C++11 compiler + (AX_CXX_COMPILE_STDCXX_11) and the pthreads library (AX_PTHREAD). + + Note that these macros are not used by the main library autoconf, + just by the tests (which share the same m4/ directory). + +- build: Add a code coverage option + + Configure with: + ./configure --enable-code-coverage + Show coverage output with: + make code-coverage-capture + + Built on m4/ax_code_coverage.m4 from the GNU autoconf archive + to provide the macros to check for presence of gcov + lcov; + upstream macro modified to: + - Remove use of $(AM_DEFAULT_VERBOSITY) , as earlier versions of + autoconf (such as the one used by default on Travis) do not have this. + - Rather than automatically defining CODE_COVERAGE_RULES to be a set + of makefile rules that use ifeq/endif (which is GNU make-specific), + instead only define CODE_COVERAGE_RULES if coverages is turned on, + and in that case don't use conditionals in the makefile. + +- api: Add entrypoints to allow use of per-server ports + + Add user-visible entrypoints ares_{get,set}_servers_ports(3), which + take struct ares_addr_port_node rather than struct ares_addr_node. + This structure includes a UDP and TCP port number; if this is set + to zero, the channel-wide port values are used as before. + + Similarly, add a new ares_set_servers_ports_csv(3) entrypoint, which + is analogous to ares_set_servers(3) except it doesn't ignore any + specified port information; instead, any per-server specified port + is used as both the UDP and TCP port for that server. + + The internal struct ares_addr is extended to hold the UDP/TCP ports, + stored in network order, with the convention that a value of zero + indicates that the channel-wide UDP/TCP port should be used. + + For the internal implementation of ares_dup(3), shift to use the + _ports() version of the get/set functions, so port information is + transferred correctly to the new channel. + + Update manpages, and add missing ares_set_servers_csv to the lists + while we're at it + +- api: Add ares_set_sortlist(3) entrypoint + + Allow explicit configuration of the channel's sortlist, by + specifying a string in the same format as the equivalent + /etc/resolv.conf option. + + This allows library users to perform the same configuration + that is available via /etc/resolv.conf, but without needing + to change that file. + +- api: Allow injection of user-specified malloc/free functions + + Add a new ares_library_init_mem() initialization function for the + library which allows the library user to specify their own malloc, + realloc & free equivalents for use library-wide. + + Store these function pointers in library-wide global variables, + defaulting to libc's malloc(), realloc() and free(). + + 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. + + Convert calls to calloc() to use ares_malloc() + memset + +- api: Add option to expose some internal functions + + Purely for testing, add --enable-expose-statics option to configure + which converts some static internal functions to be externally visible. + +- api: Expose the ares_library_initialized() function + +- ahost: Allow repeated -s options + + This also removes a potential leak where later -s options would + replace earlier ones without freeing the relevant string. + +- Mark unhittable lines + + Add comments for the benefit of the lcov tool, marking + lines that cannot be hit. Typically these are fall-back + protection arms that are already covered by earlier checks, + and so it's not worth taking out the unhittable code (in case + someone changes the code between the two places in future). + +- ares_set_servers_csv.3: make return type match code + +- bitncmp: update comment to match code behaviour + +- ares_striendstr: fix so non-NULL return can happen + + This looks to have been broken since it was first introduced in 2005 in + commit aba0b775ea30 ("Added ares_getnameinfo which mimics the + getnameinfo API") + +- config_sortlist: free any existing sortlist on (re)alloc failure + + If we get an allocation failure on 2nd or later entry in the sortlist, the + code would return ENOMEM but still leave the initial entries allocated. + Ensure that *sortlist is set to NULL whenever ENOMEM is returned. + +- ares_dup: clear new channel on failure + + 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. + +- ares_init_options: don't lose init failure + + If (say) init_by_options() fails, the subsequent call to + init_by_defaults() was overwriting the return code with + success. Still call init_by_defaults() regardless, but track + its return value separately + +- ares_gethostbyname: don't leak valid-but-empty hostent + + If an AF_UNSPEC query gets a valid response to its AAAA query, + but which has no IPv6 addresses in it, then the code chains on to + a A record query. However, the hostent from the AAAA response + was being leaked along the way (because it gets replaced before + the follow-on end_hquery() invocation). + +- ares_parse_txt_reply: propagate errors from per-substring loop + + If we get an allocation failure when processing a particular substring in a + TXT record, that failure is silently lost; fix that by propagating errors from + the inner loop to the outer loop. + +- process_answer: fix things up correctly when removing EDNS option + + When a server rejects an EDNS-equipped request, we retry without + the EDNS option. However, in TCP mode, the 2-byte length prefix was + being calculated wrong -- it was built from the answer length rather than + the length of the original request. + + Also, it is theoretically possible that the call to realloc() might change + the data pointed to; to allow for this, qbuf also needs updating. + + (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) + +- ares__read_line: clear buf pointer on realloc failure + +- ares_expand_name: check for valid bits in label length + + 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. + +Daniel Stenberg (23 Jan 2016) +- [Gregor Jasny brought this change] + + Fix typos detected by lintian + + Closes #32 + +- [Gregor Jasny brought this change] + + Distribute all man pages + +- README.cares: s/I/Daniel + + ... and add a pointer to an existing version of the original area 1.1.1 + package.a + +- read_tcp_data: don't try to use NULL pointer after malloc failure + + 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. + +- configure_socket: explicitly ignore return code + + CID 56889 in Coverity pointed out the return code from setsocknonblock() + is ignored, and this added typecast to (void) makes it explicit. + +- ahost: check the select() return code + + Fixes CID 137189, pointed out by Coverity + +David Drysdale (18 Jan 2016) +- Fix buildconf on platforms using glibtoolize + + Commit c49a87eea538 changed buildconf to only check for + libtoolize, but missed a line + +- Don't exit loop early leaving uninitialized entries + + Update for commit affc63cba875d. + + 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. + + So fix to match Gregor's original patch, with apologies. + +Daniel Stenberg (18 Jan 2016) +- buildconf: remove check for libtool, it only requires libtoolize + +David Drysdale (17 Jan 2016) +- [Gregor Jasny brought this change] + + Use libresolv to initialize cares on iPhone targets + + On iPhone targets like iOS, watchOS or tvOS the file + /etc/resolv.conf cannot be used to configure cares. + + Instead the resolver library is queried for configuration + values. + + CC: Yury Kirpichev + +Daniel Stenberg (17 Jan 2016) +- README: updated to new repo URL + +David Drysdale (14 Jan 2016) +- [Lei Shi brought this change] + + Fixing slow DNS lookup issue + + 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. + +- Merge pull request #30 from p-push/vs-2015 + + Support Visual Studio 2015 + +Oleg Pudeyev (3 Jan 2016) +- [Gisle Vanem brought this change] + + Support Visual Studio 2015 + +David Drysdale (11 Nov 2015) +- [Andrew Andkjar brought this change] + + added another version case to Makefile.msvc + + nmake version 11.00.61030.0 resolves to CC_VERS_NUM = 110 + +- Merge pull request #26 from bitbouncer/vs-2013 + + added define for visual studio 2013 + +svante karlsson (25 Jun 2015) +- added define for visual studio 2013 + +Jakub Hrozek (6 Nov 2014) +- ares__read_line: free buf on realloc failure + +- Destroy options if ares_save_options fails + + It's possible that, if ares_save_options failed, the opts structure + would contain some allocated memory. Calling ares_destroy_options in + this case is safe, because ares_save_options zeroes out the memory + initially. + +- [David Drysdale brought this change] + + Continue loop if space for hostname not large enough + + When attempting to build a search domain from the local hostname + (used as a fallback when no other methods have given a search + domain), the code doubles the buffer size on each loop iteration. + + However, the loop previously had a WHILE_FALSE terminator so the continue + statement exited the loop rather than going round again. + +Daniel Stenberg (30 Oct 2014) +- ares_getnameinfo.3: there is no ares_getaddrinfo + +David Drysdale (30 Sep 2014) +- [Gregor Jasny brought this change] + + Prevent tmpbuf from overrunning + + Fix Coverity error CID 56886. + + Signed-off-by: Gregor Jasny + +- [Gregor Jasny brought this change] + + Re-start loop if select fails + + Fix Coverity error CID 56882 + + Signed-off-by: Gregor Jasny + +- [Gregor Jasny brought this change] + + Free temporary variable in error path + + Fix Coverity CID 56890 + + Signed-off-by: Gregor Jasny + +- [Gregor Jasny brought this change] + + 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. + + Fix Coverity error CID 56878 + + Signed-off-by: Gregor Jasny + +- [Gregor Jasny brought this change] + + Null check before dereference + + Fix Coverity error CID 56880 + + Signed-off-by: Gregor Jasny + +Jakub Hrozek (28 Jul 2014) +- [Gisle Vanem brought this change] + + Comment in ares_ipv6.h + +David Drysdale (25 Jul 2014) +- CONTRIBUTING: add file to indicate mailing list is preferred + +- Add -t u option to ahost + + Add an option to allow specification of the AF_UNSPEC + address family. + +Jakub Hrozek (24 Jul 2014) +- host_callback: Fall back to AF_INET on searching with AF_UNSPEC + + Previously, when an ares_gethostbyname() searched with AF_UNSPEC and the + first AF_INET6 call only returned CNAMEs, the host_callback never + retried AF_INET. + + This patch makes sure than on ARES_SUCCESS, the result of AF_INET6 is + taken as authoritative only if the result contains some addresses. + +- [David Drysdale brought this change] + + Move memset call below platform-specific declarations + + A GitHub commenter [1] says that my recent change to ahost.c has + problems compiling on Windows + C89 platforms. + + [1] https://github.com/bagder/c-ares/commit/ee22246507c9#commitcomment-6587616 + +- [David Drysdale brought this change] + + Update ahost man page to describe -s option. + + Commit ee22246507c9 added the -s option to the + ahost command, but neglected to update the man page to + describe it. + + Also fix typo in description of -t option. + +- ares_parse_soa_reply: Do not leak rr_name on allocation failure + + If ares_malloc_data failed, already allocated rr_name would go out of + scope. + +- [David Drysdale brought this change] + + Don't override explicitly specified search domains + + Only set search domains from /etc/resolv.conf if there isn't a value + already present in the channel. + +- [David Drysdale brought this change] + + Allow specification of search domain in ahost + + Add the "-s domain" command line option to override the search + domains. + +Daniel Stenberg (12 May 2014) +- Revert "ares_parse_aaaa_reply: fix leak when reply contains 1 alias and no address" + + This reverts commit 440110b303fdbfadb3ad53d30eeb98cc45d70451. + +- [Frederic Germain brought this change] + + ares_parse_aaaa_reply: fix leak when reply contains 1 alias and no address + +- [Doug Kwan brought this change] + + ares_build.h: fix building on 64-bit powerpc + + There are two issues. + + 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. + +- refresh: updated now with automake 1.14 + +- [David Drysdale brought this change] + + single_domain: Invalid memory access for empty string input + + We noticed a small buglet in ares_search() when it gets an empty string + as input -- the single_domain() utility function in ares_search.c + accesses invalid memory (before the start of the string). + +Guenter Knauf (31 Aug 2013) +- Fixed warning 'type specifier missing'. + +Daniel Stenberg (30 Aug 2013) +- [Tor Arntsen brought this change] + + ares_rules.h: CARES_SIZEOF_LONG doesn't exist anymore, don't test for it + + It was removed in f19387dd72432 + +- nowarn: use instead of configure for size of long + + This makes the header file much more multi-arch friendly and can be used + as-is with both 32 bit and 64 bit builds. + +- timeoffset: made static and private + + ares__timeoffset() was only used once within this single source file + +- timeadd: make static + + ares__timeadd() was only ever used from within the same source + +Yang Tse (18 Jul 2013) +- xc-am-iface.m4: comments refinement + +- configure: fix 'subdir-objects' distclean related issue + + See XC_AMEND_DISTCLEAN comments for details. + +- configure: automake 1.14 compatibility tweak (use XC_AUTOMAKE) + +- xc-am-iface.m4: provide XC_AUTOMAKE macro + +Daniel Stenberg (12 May 2013) +- gitignore: ignore all ares_*pdf but also CHANGES.dist + +- bump: start working towards 1.10.1 + +Version 1.10.0 (12 May 2013) + +Daniel Stenberg (12 May 2013) +- RELEASE-NOTES: two more bug fixes + +- [Keith Shaw brought this change] + + ares_set_servers_csv: fixed IPv6 address parsing + + 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. + +- nroff: fix two syntax mistakes + + ares_parse_a_reply and ares_parse_aaaa_reply both had two \fB instead of + \fP + + Reported-by: Alexander Klauer + Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-03/0010.shtml + +- [Alex Loukissas brought this change] + + build: fix build on msvc11 + +- Makefile.am: increment -version-info for 1.10.0 release + +- README: remove unnecessary comment + +- ares_version.h: copyright end range year is now 2013 + +- RELEASE-NOTES: synced with fb0737f3a0a1c37 + +- [Paul Saab brought this change] + + ares_parse_aaaa_reply: Plug memory leak + + This change is similar to ares_parse_a_reply.c in commit + bffd67f16a8f42fe6dbf79ab2e39d92eea05c8a6 + +- [Patrick Valsecchi brought this change] + + ares_parse_txt_reply: return a ares_txt_reply node for each sub-string + + Previously, the function would wrongly return all substrings merged into + one. + +- [Alexander Klauer brought this change] + + library init: documentation update + + This commit updates the documentation of ares_library_init() and + ares_library_cleanup() with regard to the newly introduced reference + counting of initializations and deinitializations. + +- [Alexander Klauer brought this change] + + library init: be recursive + + Previously, a single call to ares_library_cleanup() would deinitialise + the c-ares library, regardless of how many times ares_library_init() was + called. This behaviour may cause problems in programs linking two or + more libraries which, in turn, use c-ares. The present commit fixes this + problem, deinitializing the library only after a number of calls to + ares_library_cleanup() matching the number of calls to + ares_library_init(). + +- [Patrick Valsecchi brought this change] + + protocol parsing: check input data stricter + + ... so that bad length fields aren't blindly accepted + + Bug: http://c-ares.haxx.se/mail/c-ares-archive-2013-04/0016.shtml + +Guenter Knauf (11 Apr 2013) +- Create ares_build.h when buidling from Git. + +- Added -DCARES_STATICLIB to CFLAGS. + + Currently this static makefile does only support building the + static library libcares.a. + +Daniel Stenberg (8 Apr 2013) +- [Alexander Klauer brought this change] + + .gitignore: ignore patch files + + This commit adds a line to .gitignore to the effect that patch files + generated by 'git format-patch' are excluded from the repository. + +- [Alexander Klauer brought this change] + + ares_destroy() documentation: no new requests + + Clarify that no new requests may be added to a resolver channel that is + currently being destroyed. + +- [Alexander Klauer brought this change] + + Documentation: properly document ARES_ECANCELLED + + This commit clarifies the behaviour of ares_cancel() with respect to + callbacks and adds missing documentation of ARES_ECANCELLED to the man + pages of the affected functions. + +- [Alexander Klauer brought this change] + + ares_cancel(): cancel requests safely + + An invocation of ares_cancel() walks through the request list, calling + the callbacks of all pending requests on a channel. Previously, if such + a callback added a new request to the channel, the request list might + not end up empty, causing an abort by assertion failure. The present + commit ensures that precisely all requests present upon entry of + ares_cancel() are cancelled, and that adding new requests through + callbacks is safe. + +Yang Tse (10 Mar 2013) +- ares.h: stricter CARES_EXTERN linkage decorations logic + + No API change involved. + +- ares_build.h.dist: enhance non-configure GCC ABI detection logic + + GCC specific adjustments: + + - check __ILP32__ before 32 and 64bit processor architectures in + order to detect ILP32 programming model on 64 bit processors + which, of course, also support LP64 programming model, when using + gcc 4.7 or newer. + + - keep 32bit processor architecture checks in order to support gcc + versions older than 4.7 which don't define __ILP32__ + + - check __LP64__ for gcc 3.3 and newer, while keeping 64bit processor + architecture checks for older versions which don't define __LP64__ + +Daniel Stenberg (9 Mar 2013) +- ares.h: there is no ares_free_soa function + +Yang Tse (9 Mar 2013) +- Makefile.am: empty AM_LDFLAGS definition for automake 1.7 compatibility + +- ares_inet_ntop.3: s/socklen_t/ares_socklen_t + +- configure: use XC_LIBTOOL for portability across libtool versions + +- xc-lt-iface.m4: provide XC_LIBTOOL macro + +- Makefile.am: use AM_CPPFLAGS instead of INCLUDES + +- inet_ntop.c: s/socklen_t/ares_socklen_t + +- inet_ntop.c: s/socklen_t/ares_socklen_t for portability + +Daniel Stenberg (19 Feb 2013) +- ares.h: s/socklen_t/ares_socklen_t for portability + +- ares_inet_ntop.3: 4th argument is socklen_t! + +- spell inet correctly! + +- ares_inet_pton/ntop: cleanup + + Make sure that the symbols are always exported and present in c-ares. + + Make the headers prefixed with 'ares'. + + Removed the inet_ntop.h version as it no longer features any content. + +- ares_inet_ntop/ares_inet_pton: added man pages + +Yang Tse (15 Feb 2013) +- [Gisle Vanem brought this change] + + curl_setup_once.h: definition of HAVE_CLOSE_S defines sclose() to close_s() + +- [Gisle Vanem brought this change] + + config-dos.h: define HAVE_CLOSE_S for MSDOS/Watt-32 + +- [Gisle Vanem brought this change] + + config-dos.h: define strerror() to strerror_s_() for High-C + +Daniel Stenberg (13 Feb 2013) +- ares_get_datatype: removed unused function + + it was also wrongly named as internal functions require two underscores + +- ares__bitncmp: use two underscores for private functions + + It used a single one previously making it look like a public one + +- ares__generate_new_id: moved to ares_query.c + + ... and ares__rc4 is turned into a local static function. + +- ares__swap_lists: make private and static + + ... since there's only one user, make it static within ares_process.c + +Yang Tse (13 Feb 2013) +- Makefile.msvc: add four VS version strings + +Daniel Stenberg (13 Feb 2013) +- ares_expand_name.3: clarify how to free the data + +Yang Tse (30 Jan 2013) +- zz40-xc-ovr.m4: fix 'wc' detection - follow-up 2 + + - Fix a pair of single quotes to double quotes. + + URL: http://curl.haxx.se/mail/lib-2013-01/0355.html + Reported by: Tor Arntsen + +- zz40-xc-ovr.m4: fix 'wc' detection - follow-up + + - Take into account that 'wc' may return leading spaces and/or tabs. + + - Set initial IFS to space, tab and newline. + +- zz40-xc-ovr.m4: fix 'wc' detection + + - Take into account that 'wc' may return leading spaces. + + - Set internationalization behavior variables. + + Tor Arntsen analyzed and reported the issue. + + URL: http://curl.haxx.se/mail/lib-2013-01/0351.html + +- zz40-xc-ovr.m4: check another three basic utilities + +- zz40-xc-ovr.m4: 1.0 interface stabilization + + - Stabilization results in 4 public interface m4 macros: + XC_CONFIGURE_PREAMBLE + XC_CONFIGURE_PREAMBLE_VER_MAJOR + XC_CONFIGURE_PREAMBLE_VER_MINOR + XC_CHECK_PATH_SEPARATOR + - Avoid one level of internal indirection + - Update comments + - Drop XC_OVR_ZZ40 macro + +- zz40-xc-ovr.m4: emit witness message in configure BODY + + This avoids witness message in output when running configure --help, + while sending the message to config.log for other configure runs. + +- zz40-xc-ovr.m4: truly do version conditional overriding + + - version conditional overriding + - catch unexpanded XC macros + - fix double words in comments + +- zz40-xc-ovr.m4: fix variable assignment of subshell output bashism + + Tor Arntsen analyzed and reported the issue. + + URL: http://curl.haxx.se/mail/lib-2013-01/0306.html + +- zz40-xc-ovr.m4: reinstate strict AC_REQUIRE macro dependencies + +- zz40-xc-ovr.m4: avoid double single-quote usage + +- zz40-xc-ovr.m4: parentheses balancing of 'case' statements + + m4 quadrigraph shell comment technique allows proper autoconf + parentheses balancing in shell 'case' statements. The presence + of unbalanced parentheses may otherwise trigger expansion bugs. + +- zz40-xc-ovr.m4: internals overhauling + + - Update comments + - Execute commands in subshells + - Faster path separator check + - Fix missing 'test' command + - Rename private macros + - Minimize AC_REQUIRE usage + +- zz40-xc-ovr.m4: redirect errors and warnings to stderr + +- configure: use XC_CONFIGURE_PREAMBLE early checks + + Some basic checks we make were placed early enough in generated + configure script when using autoconf 2.5X versions. Newer autoconf + versions expand these checks much further into the configure script, + rendering them useless. Using XC_CONFIGURE_PREAMBLE fixes placement + of early intended checks across all our autoconf supported versions. + +- zz40-xc-ovr.m4: provide XC_CONFIGURE_PREAMBLE macro + +- configure: autotools compatibility fixes - step I + + Fix proper macro expansion order across autotools versions for + C compiler and preprocessor program checks. + +- configure: fix automake 1.13 compatibility + + Tested with: + + buildconf: autoconf version 2.69 + buildconf: autom4te version 2.69 + buildconf: autoheader version 2.69 + buildconf: automake version 1.13.1 + buildconf: aclocal version 1.13.1 + buildconf: libtool version 2.4 + buildconf: GNU m4 version 1.4.16 + +- ares_private.h: use again memdebug.h instead of curl_memdebug.h + +- configure.ac: replace AM_CONFIG_HEADER with AC_CONFIG_HEADERS + + automake 1.13 errors if AM_CONFIG_HEADER is used in configure script. + +- cares-override.m4: provide AC_CONFIG_MACRO_DIR definition conditionally + + Provide a 'traceable' AC_CONFIG_MACRO_DIR definition only when using + an autoconf version that does not provide it, instead of what we were + doing up to now of providing and overriding AC_CONFIG_MACRO_DIR for + all autoconf versions. + +- ares_private.h: use curl_memdebug.h instead of memdebug.h + +- vc6cares.dsp: add ares_create_query.c and ares_parse_soa_reply.c + +- cares-functions.m4: improve gethostname arg 2 data type check + +- setup_once.h: HP-UX specific 'bool', 'false' and 'true' definitions. + + Also reverts commit bceb40095a + +- configure: check if compiler halts on function prototype mismatch + +- cares-functions.m4: add gethostname arg 2 data type check and definition + +- cares-functions.m4: update thread-safeness detection of getaddrinfo() + + 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. + + Take in account that h_errno might be a modifiable lvalue not defined as + a C preprocessor macro. + +- setup_once.h: HP-UX issue workaround + + Issue: When building a 32bit target with large file support HP-UX + 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. + + Mentioned issue is now fixed as long as we don't use sendfile nor + sendpath functions. + +- setup_once.h: refactor inclusion of and + + Inclusion of these two header files now done in setup_once.h + +- Header inclusion clean-up + + Remove header inclusions already done in setup_once.h + +- setup_once.h: HP-UX specific TRUE and FALSE definitions + + Some HP-UX system headers require TRUE defined to 1 and FALSE to 0. + +- ares_timeout.c: fix compiler warning + +- ares_create_query.c: IRIX compilation fix + +- c-ares/nameser.h: add some T_* defines for ns_t_* values + +Daniel Stenberg (7 Nov 2012) +- Revert "ares_parse_aaaa_reply: fix memory leak" + + This reverts commit 50f25d8a4b2d16f4c5e0ef620238688b7a315c7a. + +- ares_parse_aaaa_reply: fix memory leak + + an allocated buffer was not freed in the successful case. + +- [Gisle Vanem brought this change] + + adig: perror() doesn't work for socket errors on windows + + ... so print the SOCKERRNO instead + +- get_DNS_AdaptersAddresses: fix IPv6 parsing + + 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: Saúl Ibarra Corretgé + +- version: bumped to 1.10.0 + + Due to the newly added function: ares_create_query() + +- AUTHORS: synced with 83093ac450 + + Added 21 authors since this document was last updated + +- ares_create_query.3: mention when this is added + +- [hpopescu@ixiacom.com brought this change] + + Added new feature (rfc2671) + +- code police: fix indents, < 80 columns, reflowed comments + +Guenter Knauf (11 Jul 2012) +- Cleaned up version awk script. + +Daniel Stenberg (30 Jun 2012) +- [Gisle Vanem brought this change] + + read_udp_packets: bail out loop on bad sockets + + I can see that recvfrom() in ares_process.c many times is called with + 'udp_socket' == ARES_SOCKET_BAD. The code takes care not to call + recv/recvfrom with ARES_SOCKET_BAD in the outer-loop. So should the + inner-loop. + +Yang Tse (29 Jun 2012) +- cares-compilers.m4: remove -Wstrict-aliasing=3 from clang + + Currently it is unknown if there is any version of clang that + actually supports -Wstrict-aliasing. What is known is that there + are several that don't support it. + +- cares-compilers.m4: -Wstrict-aliasing=3 for warning enabled gcc and clang builds + +Daniel Stenberg (18 Jun 2012) +- version: work towards 1.9.2 (at least) + +Version 1.9.1 (18 Jun 2012) + +Daniel Stenberg (18 Jun 2012) +- RELEASE-NOTES: 1.9.1 coming up + +Version 1.9.0 (16 Jun 2012) + +Daniel Stenberg (16 Jun 2012) +- ares_version.h: next version is 1.9.0 + +- [Marko Kreen brought this change] + + ares_data.h: ARES_DATATYPE_SOA_REPLY is added in 1.9.0 + +- RELEASE-NOTES: synced with 979bf951d + + Next release deemed to become 1.9.0 due to the new function + +- [Marko Kreen brought this change] + + SOA parser added + + I need to do SOA queries, so here is a parser for them. + + - ares_soa_reply: new struct + - ares_malloc_data/ares_free_soa: ARES_DATATYPE_SOA_REPLY + - ares_parse_soa_reply: actual function + +Yang Tse (14 Jun 2012) +- Kill compiler warning + +- Fix libcares.pc generation for static MingW* cross builds + +Daniel Stenberg (21 May 2012) +- [Nick Alcock brought this change] + + Fix UDP and TCP port byte order in saved options. + + 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. + +Yang Tse (28 Apr 2012) +- version: start working on 1.8.1-DEV + +Version 1.8.0 (27 Apr 2012) + +Daniel Stenberg (27 Apr 2012) +- RELEASE-NOTES: call next 1.8 instead + + Since we added a function, let's use a stricter bumping scheme + +Yang Tse (25 Apr 2012) +- INSTALL: some adjustments + +Daniel Stenberg (25 Apr 2012) +- GIT-INFO: mention buildconf + +Yang Tse (25 Apr 2012) +- INSTALL: remove more sections that don't apply to c-ares + +- ares_timeout.c: fix compiler warning + +Daniel Stenberg (25 Apr 2012) +- [Ben Noordhuis brought this change] + + Makefile.m32: fix mingw32 build + + * add . to include path so ares_build.h is picked up + * make ar configurable to ease cross-compiling + +- RELEASE-NOTES: added what's happened since 1.7.5 + +Guenter Knauf (22 Apr 2012) +- Updated copyright year. + +Yang Tse (21 Apr 2012) +- ares_init.c: Further refactoring of Windows system's DNS fetching code + +Guenter Knauf (20 Apr 2012) +- Android: small changes to dns property part. + + Prefix prop vars; kill var; use DNS_PROP_NAME_PREFIX macro. + +- Handle CNAME-only in ares_parse_aaaa_reply(). + + posted to the c-ares list by Peter Griess . + +- Add support for multiple DNS servers on Android. + + Before, c-ares always used the first DNS server on Android, causing + network problems if this DNS server was not available. + + Signed-off-by: Geert Uytterhoeven + +- Added INSTALL so it gets into tarballs. + +- Added some more ifdefs to silent compiler warnings. + +Yang Tse (17 Apr 2012) +- INSTALL: remove a non c-ares section + +- cares-compilers.m4: -Wno-pedantic-ms-format for Windows gcc 4.5 builds + + 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. + +- setup_once.h: tighten requirements for stdbool.h header inclusion + + Include stdbool.h only when it is available and configure is capable of + detecting a proper 'bool' data type when the header is included. + +- configure: NATIVE_WINDOWS no longer defined in config file + +- cares-compilers.m4: double underscore decoration for visibility attribute + +- build adjustments: CARES_SYMBOL_HIDING no longer defined in config files + + configure script now provides conditional definitions for Makefile.am + that result in CARES_SYMBOL_HIDING being defined by resulting makefiles + when appropriate. + +- configure: Windows cross-compilation fixes + + CARES_BUILDING_LIBRARY and CARES_STATICLIB no longer defined in ares_config.h, + configure will generate appropriate conditionals so that mentioned symbols + get defined and used in Makefile derived from Makefile.am at compilation time. + +Guenter Knauf (17 Apr 2012) +- Added INSTALL file adapted from libcurl. + + Not yet ready, and needs further edits. + +Yang Tse (16 Apr 2012) +- ares_init.c: get_iphlpapi_dns_info() refactoring + +Guenter Knauf (16 Apr 2012) +- Kill some more compiler warnings. + +- Kill compiler warning about unused var. + +- Fixed my last commit: wrong preprocessor directive. + +- Check for __ANDROID__ in addition to ANDROID macro. + +- Check for __ANDROID__ in addition to ANDROID macro. + + Posted to c-ares list by Wayne. + +- Fix for Android to disable useless arpa/nameser.h. + +- Fix for Android to include sys/select.h for fd_set. + +Yang Tse (17 Mar 2012) +- ares_data.c: some NAPTR related fixes + +Daniel Stenberg (16 Mar 2012) +- port numbers: convert them to network order! + + When the config options ARES_OPT_UDP_PORT or ARES_OPT_TCP_PORT are used, + make sure to convert them to network byte order! + + Bug: http://c-ares.haxx.se/mail/c-ares-archive-2012-02/0004.shtml + +- white space cleanup + + - Keep code within 80 columns + + - Removed funny spaces after open paren and before closing paren + +- [Poul Thomas Lomholt brought this change] + + get_iphlpapi_dns_info: fix buffer overrun + + I experienced a buffer overrun exception in c-ares on Windows and + tracked it down to be an error in the calculation of the 'left' variable + in get_iphlpapi_dns_info(). + + I changed the variable type of 'left' to a _signed_ type because of the + subtraction arithmetic; not sure if a long is the best choice + +- Merge pull request #7 from saghul/naptr + + Added support for parsing NAPTR records + +saghul (23 Feb 2012) +- Added support for parsing NAPTR records + +Yang Tse (19 Jan 2012) +- ares_init.c: fix compiler warning on winsock builds + +- configure: libtool 1.5 tweaks + +Daniel Stenberg (19 Dec 2011) +- ares_timeout.3: fix the NAME section + + It was clearly a copy n' paste error + +Yang Tse (27 Sep 2011) +- [Albert Chin brought this change] + + configure - m4: make CURL_CHECK_DEF ignore leading whitespace on symbol def + + 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. + +- ares_init.c: fix segfault triggered in ares_init_options() upon previous + failure of init_by_defaults() and incomplete cleanup there. + +- ares_process.c: fix compiler warning + +- fix MSVC compiler warning 'conditional expression is constant' + +- setup_once.h cleanup and sync + +- [Denis Bilenko brought this change] + + ares_getnameinfo: fix random results with c-ares 1.7.5 + + In ares_getnameinfo memcpy did not copy enough bytes, causing + it to return arbitrary memory contents as a result. + +- warnings: fix another 'conversion may lose significant bits' compiler warning + +- ares_dns.h: adjust DNS__16BIT and DNS__32BIT macro definitions + + Fixing compiler warnings existing definitions triggered on these. + +- ares_destroy.c: fix segfault in ares_destroy_options() + +Daniel Stenberg (21 Aug 2011) +- ares_parse_srv_reply: silence compiler warnings + + ... by adding ugly typecasts. + +- CHANGES: generate from script + + The CHANGES file is now generated automatically with 'git2changes.pl', + invoked by the maketgz script which is used to build release archives. + + The former human edited CHANGES file was renamed to CHANGES.0 in git. + +Yang Tse (21 Aug 2011) +- Makefile.netware: SIZEOF_SHORT definition + +- warnings: fix some 'conversion may lose significant bits' compiler warnings + +- configure: fix symbol hiding usability check + + A more thorough test is done now in order to determine visibility attribute + usability, given that some compilers don't support visibility attribute on + all configurations. + +Daniel Stenberg (16 Aug 2011) +- 1.7.6: start working... + +Version 1.7.5 (16 Aug 2011) + +Daniel Stenberg (16 Aug 2011) +- CHANGES: synced for 1.7.5 release + +- RELEASE-NOTES: synced with bb4096effef7f000 + +Jakub Hrozek (15 Aug 2011) +- Only fall back to AF_INET searches when looking for AF_UNSPEC addresses + +Yang Tse (10 Aug 2011) +- [Gisle Vanem brought this change] + + ares_iphlpapi.h: Watcom C fix + + Added "!defined(_WS2DEF_)" since Watcom doesn't have + a per type guard for the typedefs 'CSADDR_INFO' (that MingW has) or + 'SOCKET_ADDRESS' (that MSVC has). But we can use the header-guard for + instead. + +- [Gisle Vanem brought this change] + + 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(). + +- cares-compilers.m4: CARES_CONVERT_INCLUDE_TO_ISYSTEM adjustments + + Add CARES_CHECK_COMPILER as a requirement. + + Ensure macro does nothing unless GNU_C or CLANG compiler is used. + + This should allow usage of this macro in unforeseen placements. + +- config-win32.h: comments adjustments - followup + +- config-win32.h: comments adjustments + +Daniel Stenberg (5 Aug 2011) +- [Tom Hughes brought this change] + + ares_parse_a_reply: fix memleak + +Yang Tse (29 Jul 2011) +- cares-functions.m4 serial # bump + +- Revert "configure: additional flag checks for fcntl() and socket()" + + This reverts commit 5f2a3b0e48f26d24cb1fefea0dccb92d417dcbf7. + +- configure: additional flag checks for fcntl() and socket() + +- xc-translit.m4 fix quoting + +- configure: avoid direct usage of AS_TR_* macros + +- xc-translit.m4 provides transliteration macros with well defined behavior. + +Jakub Hrozek (15 Jun 2011) +- Revert "Only fall back to AF_INET searches when looking for AF_UNSPEC addresses" + + This reverts commit b5823d65706af687c0e5110af8f0cfdcd068997d. + + This patch was not reviewed properly before pushing + +- Revert "Do not use sized constants in public headers" + + This reverts commit 22c01e96f7b2ae9923e1baa50bfe3c0d22297a7d. + + This is a Red Hat specific patch that does not belong into upstream + +- Use correct sizeof in ares_getnameinfo() + +- Do not leak rr_name on failures inside ares_parse_ptr_reply + +- Do not leak rr_name on failures inside ares_parse_a_reply + +- Do not leak rr_name on failures inside ares_parse_aaaa_reply + +- Do not leak rr_name on failures inside ares_parse_ns_reply + +- Fix incorrect sizeof() in ares_save_options + +- Fix incorrect allocation in ares_parse_ptr_reply() + +- Only fall back to AF_INET searches when looking for AF_UNSPEC addresses + +- Do not use sized constants in public headers + +Daniel Stenberg (13 Jun 2011) +- [Jakub Hrozek brought this change] + + ares_free_hostent(NULL) should be a noop + +Yang Tse (8 Jun 2011) +- configure: fix recvfrom 5th arg type qualifier detection (followup) + +- configure: fix recvfrom 5th arg type qualifier detection + + Additionally remove whitespace from EOL + +Daniel Stenberg (4 Jun 2011) +- strlen: use size_t to receive the return + +Yang Tse (4 Jun 2011) +- xlc: avoid preprocessor definition usage when linking + +- ares_nowarn: icc 9.1 workaround + +- ares_nowarn: header inclusion fix + +- ares_init: make ares_private.h last included header again + +- compiler warning: fix + + Fix compiler warning: conversion may lose significant bits + +- compiler warning: fix + + Fix compiler warning: variable was set but never used + + Fix compiler warning: clobber ignored + +- ares_iphlpapi: fix compiler warnings + +- winsock: compilation fixes + + Provide winsock iphlpapi alternative definitions to prevent compilation + failures when using a variety of winsock header implementations. + +Daniel Stenberg (17 May 2011) +- [David Stuart brought this change] + + IPv6-on-windows: find DNS servers correctly + +- man pages: docs for the c-ares utility programs + +- ares_parse_ns_reply.c: remove CVSism + +Yang Tse (27 Mar 2011) +- build: fix header inclusion + +- getservbyport replacement for Win CE + +- renamed getplatform() to ares__getplatform() to avoid namespace pollution + +- configure: fix libtool warning + + Recent versions of libtool are now tracing usage of AC_CONFIG_MACRO_DIR + macro and warn heavily when not used in configure script along with + ACLOCAL_AMFLAGS in Makefile.am. So in order to make libtool happy + while keeping backwards compatibility this is added. + +- adig: RFC4034 resource record type detection + + Can be tested with: adig -s 8.8.8.8 -t ANY example.com + +- nameser.h: RFC4034 resource record type definitions + +- build: move platform stuff to ares_platform.c and ares_platform.h + +- build: find out windows platform using GetVersionEx() + +- build: use getenv() replacement function for systems which lack it + +- setup_once: system error codes for Windows CE + +- ares_search: use ERRNO macro for portability sake + +- System's errno.h inclusion cleanup follow-up. + + System's errno.h is conditionally included from setup_once.h + +- Windows CE specific adjustment + + All versions of Windows CE support Winsock 1.1 + +- System's errno.h inclusion cleanup. + + System's errno.h is conditionally included from setup_once.h + +- ares_init: fix gethostname error detection on winsock platforms + +- configure: r-enable temporarily disabled detection of system's inet_ntop() + + Detection was temporarily disabled in commit 674e044ccb21f2f63537da53565fce868f + +Daniel Stenberg (15 Mar 2011) +- configure: stop using the deprecated AM_INIT_AUTOMAKE syntax + +- [Gisle Vanem brought this change] + + Watt-32: use errno + + Make sure Watt-32 programs use 'errno' even on Win32 targets + +Guenter Knauf (18 Feb 2011) +- Removed commented CLFAGS no longer needed. + +- Fixed CFLAGS for NetWare. + + Added -m32 to enable compilation with x86_64 compilers; + added conditional to set -fpcc-struct-return only for gcc compiler. + +Daniel Stenberg (18 Feb 2011) +- [Gisle Vanem brought this change] + + Watt32: fix server init + + Somewhere in the process, programs using the Watt-32 tcp/ip stack + stopped working. + +- [Dima Tisnek brought this change] + + config_sortlist: (win32) missing else + + Without an else there, contents of "pat" that could have been + successfully set just above, may be clobbered by successive unsuccessful + calls to "xxx_pton" or "ip_addr". + +Yang Tse (17 Jan 2011) +- Makefile.msvc: add a couple of VS version strings + +- Makefile.msvc: add a couple of VS version strings + +- build: add install target to Makefile.msvc + +Daniel Stenberg (27 Dec 2010) +- ares_set_servers_csv: remove unused variables + +- init_by_resolv_conf: fix compiler warnings + + The code received the return codes in the 'status' variable without + using it. Instead we just ignore those particular errors. + +- getv4: Value stored to 'dst' is never read + +- advance_tcp_send_queue: avoid NULL ptr dereference + + If given a too large 'num_bytes' value, it would cause a NULL ptr + dereference. Instead the code will now break out of the loop at the end + of the list. + +- [Peter Pentchev brought this change] + + configure: fix a bashism + +- cleanup: avoid unsafe typecasts + + Avoid the risk of reading 16bit data from an unaligned address by using + a macro that is adapted for this. + +- [Stefan Bühler brought this change] + + ares_expand_name: Fix encoded length for indirect root + +Yang Tse (18 Dec 2010) +- build: add some explicit file references to VS project files + +- config-win32: provide HAVE_ASSERT_H definition + +- build: include ares_nowarn in sample program VS project files + +- build: include ares_nowarn among SAMPLESOURCES and SAMPLEHEADERS + +- configure: temporarily disable detection of system's inet_ntop() + + This is done to allow compilation of ares_inet_ntop() by some daily + builds picky compilers that otherwise do not need this function. + +- changes: mention last fix + +- ares_inet_ntop: remove definition and usage of macro SPRINTF + + Existing definition of SPRINTF always resulted in sprintf() being used, + and sprintf() returning 'int' is already used throughout the library. + +- ares_inet_ntop: reapply changes from previous c-ares version (III) + + - Replace 'u_char' with 'unsigned char'. + - Replace 'u_int' with 'unsigned int'. + - use macros ERRNO and SET_ERRNO() for errno handling. + +- ares_inet_ntop: reapply changes from previous c-ares version (II) + + - Remove rcsid. + - Adjust header file inclusions. + - ares_inet_ntop used only on systems without a proper inet_ntop function. + +- ares_inet_ntop: reapply changes from previous c-ares version (I) + + - Replace tabs with spaces. + - Use ANSI C style for function declarations and definitions. + - Use sizeof with parentheses. + +- ares_inet_ntop: fix off by one error triggering out of bounds write + + ares_inet_ntop would trigger an out of bounds write when the representation + of the address required 15 characters, due to not taking in account null + termination character. + + Full import of inet_ntop.c from bind-9.5.3rc1 to pull additional fixes. + +- ares_nowarn: add conditional inclusion of assert.h header + +- fix compiler warning: conversion may lose significant bits + +- ares_inet_net_pton: fix non-rejection of some malformed literals + + ares_inet_net_pton would return wrong values when excessively large, + and invalid, netmasks are used. Fixes are from bind-9.5.3rc1, + issue also described in the WLB-2008080064 advisory. + +- setup_once: provide ISASCII macro + +- configure: inet_net_pton function check adjustments + + Define HAVE_INET_NET_PTON only when system's inet_net_pton function is IPv6 + capable and is not affected by the WLB-2008080064 advisory. + + HAVE_INET_NET_PTON_IPV6 is no longer defined nor used. + +- ares_init: fix detection of semicolon comments in resolv.conf + + 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. + +- version: start working on 1.7.5 + +Version 1.7.4 (8 Dec 2010) + +Daniel Stenberg (8 Dec 2010) +- release-preps: CHANGES and RELEASE-NOTES synced + +- ares_set_local_*: added in 1.7.4, not before + +Yang Tse (3 Dec 2010) +- build: provide SIZEOF_SIZE_T definition for non-configure builds + +- build: config.dos renamed to config-dos.h + +- build: provide SIZEOF_SIZE_T netware definition + +- ares_gethostbyaddr: fix compiler warning: conversion may lose significant bits + +- configure: undo using autobuilds to temporarily verify strict aliasing warnings. + +- fix compiler warning: rounding, sign extension, or loss of accuracy may result + +Daniel Stenberg (2 Dec 2010) +- [Ben Noordhuis brought this change] + + ares_parse_a_reply: fix CNAME response parsing + + Reply to a CNAME query doesn't contain addresses, causing + ares_parse_a_reply() to bail out with ARES_ENODATA + + Bug: http://groups.google.com/group/nodejs/browse_thread/thread/a1268c9ea5e9ad9b + +Yang Tse (1 Dec 2010) +- fix compiler warning: conversion may lose significant bits + +- atoi: remove atoi usage + +- ares_init: fix compiler warning: conversion may lose significant bits + +- configure: fix autoconf warning + +- inet_pton: fix compiler warning + +- configure: use autobuilds to temporarily verify strict aliasing warnings. + + 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 + +- ares_getnameinfo: Partially revert commit 85520d66e0ac7ac73411bc25e98769a88b2f + + 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. + +- ares_getnameinfo: Validate socket address family and length. + + Validate socket address family and that the socket address length is appropriate + for the specified family. Failure is reported with ARES_EBADFAMILY in callback. + +- ares_getnameinfo: fix two compiler warnings + +- Added another VS10 version string + +- Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-aliasing rules'. + +- Revert commit 494274e653936335c255a47599970de3df21e7c4 + +- configure: fix autoconf 2.68 warning: no AC_LANG_SOURCE call detected in body + +- Fix compiler warning: array subscript has type 'char' + +- Fix GCC 4 compiler warning 'dereferencing type-punned pointer might break strict-aliasing rules'. + +- Revert following commits: + 07bc7ea79509bcc9ef6e09151e81766ed00d3392 + 3392a50ea3f8573ea4b7a9d82b9833dab60cb0e9 + 9912637d32c9987719a1ea12db591aee2941891c + + 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'. + + A simpler patch will follow to equally silence the warning. + +- ares_options: reorder header inclusions to make inclusion of + ares_private.h the last included one again. + +Daniel Stenberg (12 Nov 2010) +- [Patrik Thunstrom brought this change] + + adig: fix NAPTR parsing + + I ran across a small "issue" in your adig example. + + 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. + +- ares_save_options: assignments instead of memcpy + +- init_by_options: don't copy an empty sortlist + + 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. + +Guenter Knauf (3 Oct 2010) +- Minor Watcom makefile tweaks. + +Daniel Stenberg (30 Sep 2010) +- [Mike Crowe brought this change] + + Fix lookup with HOSTALIASES set. + + ares__read_line returns ARES_EOF when it reaches the end of the + file. This will happen every time when reading to the end of the + HOSTALIASES file. Unfortunately single_domain treats this error as + being fatal. + + Signed-off-by: Mike Crowe + +Ben Greear (24 Aug 2010) +- Add missing break that caused get_ares_servers to fail. + + Reported-by: Ning Dong + Signed-off-by: Ben Greear + +Yang Tse (11 Aug 2010) +- configure: werror related adjustments + +Guenter Knauf (8 Aug 2010) +- Added copyright string to ares_version.h and make use of it in other files. + +- Block created ares_build.h for NetWare to avoid usage from other platforms. + +- Fix to overwrite default libname. + +- Some more Watcom makefile massage ... + +- Some more Watcom makefile massage ... + +Ben Greear (4 Aug 2010) +- sock-addr-storage: Detect and deal with lack of .ss_family member. + + AIX, at least, does not have sockaddr_storage.ss_family member. + Detect this in the configure logic and use proper #ifdefs in the + ares_process logic. + + Signed-off-by: Ben Greear + Tested-by: Tor Arntsen + +Guenter Knauf (3 Aug 2010) +- Added Watcom makefile based on libcurl's Makefile.Watcom. + +Ben Greear (31 Jul 2010) +- typo: Fix compile bug for platforms that don't have sockaddr_storage. + + Bug was introduced by me in previous commit. + + Signed-off-by: Ben Greear + +- Fix aliasing warning in gcc 4.4.4 (at least). + + Should be no functional change, though the code gets a bit + ugglier. + + Signed-off-by: Ben Greear + +Daniel Stenberg (31 Jul 2010) +- ares_set_servers_csv: use ISDIGIT + + The IS*() set of macros are preferred to the regular is*() functions as + they help us avoid the most common pitfalls. + +Ben Greear (30 Jul 2010) +- cast arg to isdigit to int + + Looks like it might silence a warning on Netware build. + + Signed-off-by: Ben Greear + +- remove all uses of uint32_t + + Previous fix forgot a few. + + Signed-off-by: Ben Greear + +- fix signed v/s unsigned casts warning in ares_gethostbyaddr.c + + Signed-off-by: Ben Greear + +- local-bind-fixup: Fix inet_pton warning. + + Conditionally include for inet_pton + headers. + + Signed-off-by: Ben Greear + +- build: Enable compiling with -Werror. + + This helps find compile warnings because they simply break + the build. + + To use: + ./configure --enable-warnings --enable-werror + + Signed-off-by: Ben Greear + +- ipv6: Fix some build issues related to the local-bind feature. + + Signed-off-by: Ben Greear + +Guenter Knauf (29 Jul 2010) +- Replaced uint32_t with unsigned int to fix broken builds on a couple of platforms. + +Daniel Stenberg (18 Jul 2010) +- [Ben Greear brought this change] + + local-bind: Support binding to local interface/IPs + + 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. + + Signed-off-by: Ben Greear + +- version: now start on 1.7.4 + +- [Andrew C. Morrow brought this change] + + fix memory leak in ares_getnameinfo + +Version 1.7.3 (11 Jun 2010) + +Daniel Stenberg (11 Jun 2010) +- changelogs: updated for 1.7.3 + +- [BogDan Vatra brought this change] + + init: allow c-ares to work on Android OS + +- changelog: fill in the 1.7.2 changes + +- added another pdf to ignore + +Yang Tse (11 Jun 2010) +- add ares_parse_mx_reply.c to VS dsp file + +Daniel Stenberg (10 Jun 2010) +- tarball: add $(CSOURCES) $(HHEADERS) to EXTRA_DIST + + It's not clear to me why we need this, but we apparently may + otherwise not get all files bundled in the dist tarball. + +- version: start working on 1.7.3 + +Version 1.7.2 (10 Jun 2010) + +Daniel Stenberg (10 Jun 2010) +- RELEASE-NOTES: 1.7.2 details added + +- [Jakub Hrozek brought this change] + + ares_init: Last, not first instance of domain or search should win + +- style: make code less than 80 columns wide + +Yang Tse (31 May 2010) +- [Tor Arntsen brought this change] + + improve alternative definition of bool to use enum instead of unsigned char + +- fix VS2010 compiler warnings + +Daniel Stenberg (18 Apr 2010) +- [Jérémy Lal brought this change] + + added ares_parse_mx_reply + +- repair the file mode + +- remove all $Id$ lines + +- remove all .cvsignore files + +- spell fix + + reported by Gregor Jasny on the mailing list + +- [Peter Pentchev brought this change] + + Fix a couple of typos and grammar nits. + +- ignore the GPG signature files too + +- start the journey towards 1.7.2 + +- no longer CVS tagging + +- ignore generated PDFs + +Version 1.7.1 (23 Mar 2010) + +Daniel Stenberg (23 Mar 2010) +- 1.7.1 + +- made README the primary readme file + + ... and did README.cares to contain a historic reason etc. + +- s/CVS/git + +- git now, not CVS + +- ignore lots of generated files + +- [Daniel Johnson brought this change] + + Fix warnings for clang + +Yang Tse (17 Mar 2010) +- replaced intel compiler option -no-ansi-alias with -fno-strict-aliasing + +- update outdated serial number + +- fix compiler warning + +- watt32 compilation fix + +- Added another VS10 version string + +- fix line break + +- removed usage of 's6_addr', fixing compilation issue triggered with no + longer using 'in6_addr' but only our 'ares_in6_addr' struct + +Daniel Stenberg (5 Mar 2010) +- Daniel Johnson provided fixes for building with the clang compiler + +Yang Tse (5 Mar 2010) +- Added IPv6 name servers support + +Gisle Vanem (5 Mar 2010) +- Ops!. Readded ares_nowarn.h. + +- Added ares_nowarn.c. + +Yang Tse (28 Feb 2010) +- Added SIZEOF_INT and SIZEOF_SHORT definitions for non-configure systems + +- Added ares_nowarn.* to VC6 project file + +- Added SIZEOF_INT definition + +- fix compiler warning + +- fix compiler warning + +- fix compiler warning + +Daniel Stenberg (17 Feb 2010) +- ares_reinit() + + - To allow an app to force a re-read of /etc/resolv.conf etc, pretty much + like the res_init() resolver function offers + +- - Tommie Gannert pointed out a silly bug in ares_process_fd() since it didn't + check for broken connections like ares_process() did. Based on that, I + merged the two functions into a single generic one with two front-ends. + +Yang Tse (30 Dec 2009) +- VMS specific preprocessor symbol checking adjustments + +- Mention last changes + +- - Fix configure_socket() to use ares_socket_t instead of int data type. + +- - 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. + +- - Ingmar Runge noticed that Windows config-win32.h configuration file + did not include a definition for HAVE_CLOSESOCKET which resulted in + function close() being inappropriately used to close sockets. + +Daniel Stenberg (30 Nov 2009) +- start working on 1.7.1 + +Version 1.7.0 (27 Nov 2009) + +Yang Tse (27 Nov 2009) +- Preserve empty line following last target + +- - Larry Lansing fixed ares_parse_srv_reply to properly parse replies + which might contain non-SRV answers, skipping over potential non-SRV + ones such as CNAMEs. + +- When using icc, compile with -fpic and link with intel dynamic libraries. + +- Added 'currently' in italics to insist on transient situation. + +- Fix language + +- Daniel wants upcoming release to be 1.7.0 + +- Mention last changes + +- - Removed from external interface preprocessor symbol definition for + CARES_HAVE_ARES_FREE_DATA. Current functionality of ares_free_data() + makes it unnecessary. + +- Added README.msvc + +- Changed c-ares naming conventions when using MSVC as described in README.msvc + +- - Mention other recent changes + +- - Jakub Hrozek renamed addrttl and addr6ttl structs to ares_addrttl and + ares_addr6ttl in order to prevent name space pollution, along with + necessary changes to code base and man pages.This change does not break + ABI, there is no need to recompile existing applications. But existing + applications using these structs with the old name will need source code + adjustments when recompiled using c-ares 1.6.1. + +- - Jakub Hrozek fixed more function prototypes in man pages to sync them + with the ones declared in ares.h + +- Make configure remove the ares_build.h file included in distribution tarballs. + +- Fix macro redefinition. + +- Fix name space pollution. + +- Allow using different extra import libraries for debug and release builds. + +- Add manifest stuff to msvc makefile + +- Sync man page with reality + +- Add missing external API decoration for ares_set_socket_callback() + +- Add ares_free_data() man page. + +- - Provide in external interface preprocessor symbol definitions for + CARES_HAVE_ARES_FREE_DATA as an indication of function availability. + +- Remove typecast + +- Fix comment + +- Add ares_data.c and ares_data.h + +- Jakub Hrozek modified ares_parse_srv_reply() and ares_parse_txt_reply() API + to return a linked lists of results. These were also modified to internally + use the ares_data memory struct and as such its result must be free'ed with + ares_free_data(). + +- Initial support for the generic ares_free_data() function that will allow + applications to free memory allocated and returned by some c-ares funtions. + +- Make usage of calloc()'s arguments consistent with rest of code base + +- workaround icc 9.1 optimizer issue + +- Add icc fvisibility bug test + +- Fix icc 9.0 compiler warning: external definition with no prior declaration + +- Fix three var names + +- Add check for assert.h header file + +- getaddrinfo is fully thread safe on solaris versions which + implement the function even when h_errno is not a macro. + + The h_errno macro test now only done on systems for which there + is no hard coded knowledge about getaddrinfo's thread safeness. + +- Remove files generated on previous buildconf/configure run + +- Remove enable-thread / disable-thread configure option. These were only placebo + options. The library is always built as thread safe as possible on every system. + +- Refactor how preprocessor symbol _THREAD_SAFE definition is done. + +- Assume that getaddrinfo is thread safe, unless hard coded + knowledge says the contrary or h_errno is not defined. + +- Related with the threadsafe capability of getaddrinfo: + + - Constantine Sapuntzakis reported that Darwin 6.0 a.k.a. MAC OS X 10.2 + and newer have a threadsafe getaddrinfo. + + - Fix Dragonfly BSD triplet detection. + + - In case the hard-coded knowledge says that getaddrinfo is threadsafe, + an additional check is done to verify that h_errno is also defined. + If h_errno isn't defined, we finally assume that it isn't threadsafe. + Jamie Lokier provided the inspiration for this extra check. + +- AIX 5.2 and newer have threadsafe getaddrinfo. + + Add some comments to better understand what the regex's pretend to achieve. + +- HP-UX 11.11 and later have threadsafe getaddrinfo + +- Check if getaddrinfo is threadsafe when function check allows it to be used + +- Renamed fpGetNetworkParams and fpSystemFunction036 to avoid namespace pollution with static library + +- Add kernel32.lib + +- Mention last changes + +- Reinstate copyright symbol lost in previous commit + +- Make some strings different in resource file for debug or release builds + +- Ignore more subdirs + +- Fix compiler warning: conditional expression is constant + +- Sync linker and resource compiler options with Makefile.msvc + +- Follow Makefile.msvc subdirectory naming scheme, and sync compiler options + +- Updated MSVC makefile that allows building dynamic and static + c-ares libraries in debug and release flavours. + + Additionally each of the three sample programs is built against + each of the four possible c-ares libraries, generating all this + a total number of 12 executables and 4 libraries. + +- Test for USE_WINSOCK since it is more restrictive than WIN32 + +- Make header inclusion depend on HAVE_*_H definition + +- Remove unneeded preprocessor directives + +- Adjust c-ares include paths for memory tracking enabled (--enable-curldebug) builds + +- source files used by sample programs + +- Renamed c-ares setup.h to ares_setup.h + +- Adjust include paths to take in account that currently: + + c-ares with --enable-curldebug uses memdebug.h from libcurl's lib subdirectory. + + memdebug.h needs access to libcurl's setup.h from libcurl's lib subdirectory + and also needs access to libcurl's generated curl_config.h + +- Undo old temporary change once used for testing purposes + +- Mention many changes + +- Mention --enable-symbol-hiding configure option + +- Symbol hiding configure options renamed to the hopefully less ambiguous + --enable-symbol-hiding and --disable-symbol-hiding as well as related + macro names and some internal variables used for them. + + Related configuration file preprocessor symbols named to + CARES_SYMBOL_HIDING and CARES_SYMBOL_SCOPE_EXTERN. + +- Header inclusion depending on HAVE_* symbol. + Fix two typos. + +- Comparison of the Initial revision of this file with ares_parse_a_reply.c + shows that this one is actually a modified copy of ares_parse_a_reply.c. + + In order to comply with ares_parse_a_reply.c's M.I.T. license, the old + 1998 M.I.T. copyright notice is now also preserved in this file the same + as it is done in other ares_parse_*.c files. + +- Add CVS Id tag. + Fix identation of some license lines. + +- Add CVS Id tag. + +- Fix comment + +- In no particular order, changed/fixed all of the following in + ares_parse_txt_reply() current version: + + - Fixed a couple of potential double free's. + + - Fixed memory leaks upon out of memory condition. + + - Fixed pointer arithmetic. + + - Setting ntxtreply to zero upon entry for all failure cases. + + - Changed data type to size_t for variables substr_len, str_len and + the length member of ares_txt_reply struct. + + - Avoided a couple of memcpy() calls. + + - Changed i data type to unsigned int to prevent compiler warnings. + + - Adjusted a comment. + + - Use ARES_SUCCESS literal for successfull completion. + + - Added CVS Id tag. + +- Add c-ares DLL resource file to distribution archive + +- 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. + + Additionally each of the three sample programs is built against + each of the four possible c-ares libraries, generating all this + a total number of 12 executables and 4 libraries. + +Daniel Stenberg (29 Oct 2009) +- no need to check for NULL pointers before dereferencing, as the pointers + MUST be valid and they are dereferenced further down in the function + unconditionally! + +- shorten the descriptions somewhat + +- update to the new struct name + +- Jakub Hrozek added ares_parse_txt_reply() for TXT parsing + +- use 'ares_srv_reply' for proper name-spacing + +Yang Tse (29 Oct 2009) +- Add reference for ares_parse_srv_reply.pdf + +- Add reference for ares_parse_srv_reply docs + +- External API function linkage decoration adjustment + +- External API function linkage decoration adjustment + +- Initial step towards the ability to reduce c-ares exported symbols + based on the 'visibility' attribute for GNUC and __global for Sun + compilers, taking also in account __declspec function decoration + for Win32 and Symbian DLL's. + + Introducing configure options --enable-hidden-symbols and + --disable-hidden-symbols following libcurl's naming. + +- Fix comment + +- Fix spelling + +- Fix Pelles C Win32 target compilation issues + +- John Engelhart noticed an unreleased problem relative to a duplicate + ARES_ECANCELLED error code value and missing error code description. + +- Fix compiler warning: local variable may be used without having been initialized + +- Use *_CHECK_PATH_SEPARATOR_REQUIRED to ensure that *_CHECK_PATH_SEPARATOR + is only expanded and included once in the configure script. + +- Our _AS_PATH_SEPARATOR_PREPARE override is now m4_defun'd instead of m4_define'd + due to autoconf 2.64 m4_require'ing it in _AS_SHELL_SANITIZE indirectly through + _AS_PATH_WALK. + +- Fix compiler warning: argument is incompatible with corresponding format string conversion + +- Fix potential out-of-bounds read + +- Fix compiler warning: loop without body + +- Fix compiler warning + +- Fix compiler warning + +- Fix compiler warning + +- 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. + +- Fix ssize_t redefinition errors on WIN64 reported by Alexey Simak + +- more files to ignore + +- Check if _REENTRANT definition is required to + make errno available as a preprocessor macro. + +- Attempt to silence bogus compiler warning: "Potential null pointer dereference" + +- ignore more files + +Gisle Vanem (7 Sep 2009) +- Suppress warnings about unused prototypes in Watt32 and Win32 programs. + +- Update email address. + +- Update my email address. Add ares_config.h as dependency for 'make depend'. + +Yang Tse (6 Sep 2009) +- T_SRV portability check + +Gunter Knauf (5 Sep 2009) +- changed includes to match style how we do with all other *.c files. + +- 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. + +Gisle Vanem (5 Sep 2009) +- Replace 'uint16_t' with 'u_int16_t' since the latter is used in ares.h. + +- Added 'ares_parse_srv_reply.obj'. Added definition of 'u_int16_t'. This is I don't like; we should not depend on such non-universal types in a public header. But this is just a quick fix. + +Daniel Stenberg (4 Sep 2009) +- - Jakub Hrozek added ares_parse_srv_reply() for SRV parsing + +Steinar H. Gunderson (27 Aug 2009) +- Support lookup of IPv4 literals in ares_gethostbyname(), even when the address family is set to AF_INET6. + +Gisle Vanem (3 Aug 2009) +- Remove call to LoadLibrary(). (leftover from debugging). + +- Fix bad sentence. + +Daniel Stenberg (3 Aug 2009) +- - Timo Teras changed the reason code used in the resolve callback done when + ares_cancel() is used, to be ARES_ECANCELLED instead of ARES_ETIMEOUT to + better allow the callback to know what's happening. + +- - 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. + +Gunter Knauf (16 Jul 2009) +- test if adding ../lib to includes can fix the current break ... + +- renamed generated config.h to ares_config.h in order to avoid clashes when libcurl is used with other projects which also have a config.h. + +Yang Tse (21 Jun 2009) +- Refactor how libraries are checked for connect() function, follow-up. + +- Refactor how libraries are checked for connect() function, + and check for connect() as it is done for other functions. + +Gisle Vanem (20 Jun 2009) +- Remove unneeded defines. + +- Use select_s() and not select(). + +Yang Tse (19 Jun 2009) +- sclose() function-like macro definition used to close a socket, + now solely based on HAVE_CLOSESOCKET and HAVE_CLOSESOCKET_CAMEL + config file preprocessor definitions. + +- add CloseSocket camel case function check + +- check for socket() and closesocket() as it is done for other functions + +- Remove HAVE_CONFIG_H definition from here, + CFLAGS from common.dj already defines it. + +- initial step towards decoupling c-ares from libcurl for DOS + +- don't ignore these subdirs, they must be removed first + +- Remove DEBUGBUILD symbol definition, is not required for programs using the library. + +- DEBUGBUILD symbol definition for debug builds + +- ignore some subdirs + +- fix comment + +- Try to make more clear that --enable-curldebug has nothing to do with --enable-debug for this library. + +- Revert last change, it is inappropriate. + +Gisle Vanem (12 Jun 2009) +- Replace CURLDEBUG with DEBUGBUILD. + +Yang Tse (11 Jun 2009) +- when running automake copy missing files instead of symlinking them + +- Adjusted to take in account that... + + 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) + + DEBUGBUILD used for debug enabled specific code (--enable-debug) + +- c-ares' --enable-debug --enable-curldebug decoupling follow-up + +- mention last changes + +- Remove buildconf.bat from release and daily snapshot archives. + + buildconf.bat is only for CVS tree builds. + +- 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. + +Gisle Vanem (8 Jun 2009) +- Update comment about "ML". Removed "-D_USE_32BIT_TIME_T" (not a requirement). + +Yang Tse (8 Jun 2009) +- just comment it out + +- For debugging purposes... + + Disable the '-export-symbols-regex' to discard this as the origin + of link failures related with shared libraries and non-GNU linkers. + +- c-ares Makefile.am back to using $(top_builddir) for *_LDADD + +- c-ares' -no-undefined and --enable-curldebug adjustments + +- Use relative path to built c-ares tree libtool library + +- 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 + +- Fix compiler warning: out of bound access + +- fix compilation on AIX + +- c-ares' --enable-curldebug adjustments + +- Remove temporarily introduced memory leak. + +- Temporarily introduce a memory leak to verify curl debug memory tracking works. + +- Allow curl debug memory tracking when building a shared library on + systems which support external, undefined, symbols in shared libraries. + +Daniel Stenberg (26 May 2009) +- language fix + +Yang Tse (26 May 2009) +- Make ares_init(), ares_dup() and ares_init_options() return ARES_ENOTINITIALIZED + if library initialization has not been performed calling ares_library_init(). + +- c-ares's --enable-curldebug configure option decoupled from c-ares's --enable-debug + +- Prevent copying 'sourced' manpages for build targets that don't use them. + +Daniel Stenberg (23 May 2009) +- minor edits + +Yang Tse (21 May 2009) +- Include .pdf versions of c-ares man pages in distribution tarball. + +- Allow generation of .html and .pdf versions of c-ares man pages. + +Gisle Vanem (21 May 2009) +- $(OBJ_DIR)/ares_getopt.o must be cleaned explicitly. + +Yang Tse (20 May 2009) +- Mention last changes + +- Initial ares_library_cleanup(3) man page + +- Update man page + +- Update man page + +- Initial ares_library_init(3) man page attempt + +- Force revision update, to force CVS to update the $Id date string format + +- Add same copyright notice as other c-ares files + +- Fix case + +- Remove run-time requirement for advapi32.dll since + c-ares can work even with no advapi32.dll at all. + +- Intentionally avoid checking if the address of SystemFunction036, a.k.a. + RtlGenRandom, has been located or not. This function is only available on + WinXP and later. When unavailable c-ares uses portable rand() function. + +- - Provide in external interface preprocessor symbol definitions for + CARES_HAVE_ARES_LIBRARY_INIT and CARES_HAVE_ARES_LIBRARY_CLEANUP + to ease the use of new capabilities. + + - Move ares_version() prototype to ares.h + +- Introduction of ares_library_init() and ares_library_cleanup() + +- Introduction of ares_library_init() and ares_library_cleanup() + +- remove outdated comment + +- Fix preprocessor conditional expression + +- fiX *__SOCKLEN_T definitions for remaining targets + +- *__SOCKLEN_T definitions for OS400 already fixed + +- fIX *__SOCKLEN_T definitions for SYMBIAN32 and VMS targets + +Daniel Stenberg (11 May 2009) +- - Gregor Jasny made c-ares link with libtool 's -export-symbols-regex option to + only expose functions starting with ares_. + +Yang Tse (11 May 2009) +- Remove experimental check. Currently there's no need for it. + +- Fix an m4 overquoting triggering a spurious 'AS_TR_CPP' symbol definition + attempt in generated config.h + +- Proper naming for the experimental compiler test and moved to *-compilers.m4 + +- Moved *_CHECK_COMPILER_HALT_ON_ERROR and *_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE to *-compilers.m4 along with other *_CHECK_COMPILER_* + +- fIX *__SOCKLEN_T definitions for OS400 and generic GCC targets + +- fIX *__SOCKLEN_T definitions for MVS and 370 targets + +- fIX *__SOCKLEN_T definitions for several Windows target tool-chains + +- HP-UX's X/Open network library requirement check follow-up + +- HP-UX's X/Open network library requirement check follow-up + +- Use build-time configured ares_socklen_t instead of socklen_t + +- David McCreedy's "TPF-platform specific changes to various files" patch follow-up + +Daniel Stenberg (1 May 2009) +- s/libcurl/c-ares + +- version number typo fix + +Yang Tse (1 May 2009) +- David McCreedy's "TPF-platform specific changes to various files" patch + +- Check definition of _XOPEN_SOURCE_EXTENDED with the compiler + +- Check if X/Open network library is required + +- cope with ares_build.h and ares_rules.h follow-up + +- Added some notes regarding ares_build.h + +- fix EOL + +- fix EOL + +- cope with ares_build.h and ares_rules.h + +- buildconf.bat for CVS-tree c-ares + +- Use 'unsigned int' instead of size_t attempting to avoid header inclusion + +- NetWare LibC's getpeername() third argument data type is size_t + +- Remove temporary debug tracing for ares_socklen_t Windows targets + +- ares_socklen_t follow-up + +- ares_build.h Windows follow-up + +- Add temporary debug tracing for ares_socklen_t Windows targets + +- ares_build.h NetWare follow-up + +- ares_build.h NetWare attempt + +- Initial step towards a configure time ares_socklen_t definition + +- ignore stamp-h* + +- Added CARES_INCLUDES_SYS_TYPES + +- Initial step towards a configure time curl_socklen_t definition + +- avoid use of alloca() + +- Moved potential inclusion of system's malloc.h and memory.h header files to + setup_once.h. Inclusion of each header file is based on the definition of + NEED_MALLOC_H and NEED_MEMORY_H respectively. + +- ignore + +Gisle Vanem (18 Apr 2009) +- Added '-DHAVE_LIMITS_H'. + +Yang Tse (17 Apr 2009) +- remove compiler options used while debugging the icc 9.1 optimizer issue + +- moved HAVE_LIMITS_H to common defines + +- Set HP-UX compiler warning level back to the one that exposes + the socklen_t issue on this platform. + +- HAVE_LIMITS_H definition for NetWare CLIB + +- use HAVE_LIMITS_H symbol to protect limits.h inclusion + +- 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 + +Phil Blundell (3 Feb 2009) +- * February 3 2009 (Phil Blundell) + - If the server returns garbage or nothing at all in response to an AAAA query, + go on and ask for A records anyway. + +Daniel Stenberg (31 Jan 2009) +- - ares_gethostbyname() now accepts 'AF_UNSPEC' as a family for resolving + either AF_INET6 or AF_INET. It works by accepting any of the looksups in the + hosts file, and it resolves the AAAA field with a fallback to A. + +Gisle Vanem (18 Jan 2009) +- fopen() returns error in 'errno' even on Windows. + So don't use ERRNO (GetLastError()). Trimmed trailing + blanks. + +- Constified some arguments in local functions. + +Daniel Stenberg (14 Jan 2009) +- - ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but instead it + now declares the private struct ares_in6_addr for all systems instead of + relying on one possibly not present in the system. + +Phil Blundell (13 Jan 2009) +- - ares__send_query() now varies the retry timeout pseudo-randomly to avoid + packet storms when several queries were started at the same time. + +Daniel Stenberg (11 Jan 2009) +- - Phil Blundell added the internal function ares__expand_name_for_response() + that is now used by the ares_parse_*_reply() functions instead of the + ares_expand_name() simply to easier return ARES_EBADRESP for the cases where + the name expansion fails as in responses that really isn't expected. + +Gunter Knauf (30 Dec 2008) +- added HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID to ares Makefile.netware and sync'd with other Makefile.netware. + +Daniel Stenberg (9 Dec 2008) +- use the new URL + +- start over on the 1.6.1 release... + +Version 1.6.0 (9 Dec 2008) + +Daniel Stenberg (9 Dec 2008) +- add space + +Gisle Vanem (9 Dec 2008) +- Fix for Win32 targets using Watt-32. + +Dan Fandrich (9 Dec 2008) +- C89 compilers (like Minix' ACK) only need to handle 31 functions arguments + so split a long sprintf into two calls to get below that number. + +Gisle Vanem (8 Dec 2008) +- Added needed defines for Watt-32 on Windows. + +- Undefine 'optarg', 'optind' and 'opterr' when using Watt-32 + (to get correct linkage on Windows). + +- ares_writev() shall not be exported when using Watt-32 (has writev). + Added _USE_32BIT_TIME_T to avoid runtime warning. Applies to + VC-2008+ only. + +- Removed unneeded defines HAVE_SIGNAL_H, HAVE_SIG_ATOMIC_T, + RETSIGTYPE and HAVE_PROCESS_H. + +Daniel Stenberg (4 Dec 2008) +- the initial version of the ares_set_socket_callback man page + +- Gregor Jasny provided the patch that introduces ares_set_socket_callback(), + and I edited it to also get duped by ares_dup(). + +Dan Fandrich (4 Dec 2008) +- Bring the sys/include.h include test in line with curl's. + +Daniel Stenberg (3 Dec 2008) +- Let's not call ares_save_options() deprecated just yet + +- Introduce ares_dup(3) and new thoughts about API/ABI and how to move forwards. + Also discussed on the ml. + +Dan Fandrich (2 Dec 2008) +- Make sure sys/socket.h is included before netinet/in.h (required by + OpenWatcom C, and condoned by SUS) + +Daniel Stenberg (1 Dec 2008) +- minor indent fix + +- Convert the public config struct to the same binary size/construct as in the + latest releases to remain ABI compatible. + +Gisle Vanem (29 Nov 2008) +- Added '-DHAVE_GETHOSTNAME'. + +Dan Fandrich (29 Nov 2008) +- Make sure sys/socket.h is included before netinet/in.h (required by + OpenWatcom C) + +- Netware has gethostname() + +- Fixed a couple of typos + +- Don't tweak the HAVE_* macros when using autoconf + +- Make use of gethostname() conditional on it being available + +- Only set TCP_NODELAY when it exists + +Daniel Stenberg (28 Nov 2008) +- updated with changes, preparing for a release soon + +Yang Tse (26 Nov 2008) +- Gerald Combs fixed a bug in ares_parse_ptr_reply() which would cause a + buffer to shrink instead of expand if a reply contained 8 or more records. + +- Brad Spencer provided changes to allow buildconf to work on OS X. + +- In preparation for the upcomming IPv6 nameservers patch, the internal + ares_addr union is now changed into an internal struct which also holds + the address family. + +Dan Fandrich (20 Nov 2008) +- Make checking for struct ifreq a prerequisite for setting + HAVE_IOCTL_SIOCGIFADDR since it's needed to use SIOCGIFADDR and Watcom C + doesn't currently define it. + +Daniel Stenberg (20 Nov 2008) +- use unsigned short better intead of mixing with ints to prevent compiler + warnings + +- please the picky compilers by staying with short as the data we get is short + only + +- - Brad Spencer brought the new function ares_gethostbyname_file() which simply + resolves a host name from the given file, using the regular hosts syntax. + +Yang Tse (19 Nov 2008) +- user provided PATH_SEPARATOR always overrides auto-detected one + +- attempting to keep lines below 80 chars + +- provide a common PATH_SEPARATOR check method which is required by + upcomming work to support the broadest range of Autoconf versions + +- check for gethostbyaddr and gethostbyname as it is done for other functions + +- Make configure script check if ioctl with the SIOCGIFADDR command can be + used, and define HAVE_IOCTL_SIOCGIFADDR if appropriate. + +- fix leftover from previous commit + +- fix inet_pton() runtime configure check + +- trim down configure script size + +Daniel Stenberg (15 Nov 2008) +- Fixed an OOM condition reported by Jim Meyering + +Yang Tse (14 Nov 2008) +- fix typo affecting inclusion of in configure + checks for inet_ntoa_r() inet_ntop() and inet_pton() + +- #include in the getaddrinfo() runtime check for the memset() prototype + +- fix symbol definition check for fcntl.h inclusion + +- Refactor configure script detection of functions used to set sockets into + non-blocking mode, and decouple function detection from function capability. + +Daniel Stenberg (1 Nov 2008) +- Added a TODO file to list things we want changed, added or fixed. + +- - 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. + + You can enable it with ARES_OPT_ROTATE + +Yang Tse (1 Nov 2008) +- Adjust WIN32 freeaddrinfo, getaddrinfo and getnameinfo availability + +- WIN32 availability of freeaddrinfo, getaddrinfo and getnameinfo functions is quite + convoluted, compiler dependant and in some cases even build target dependat. + +- check for freeaddrinfo() at configuration phase + +- update aclocal file serial number + +- remove verification of the freeability of the addrinfo struct pointer members + +- fix comment + +- make CHECK_FUNC_GETADDRINFO_UNFREEABLE_AI_ADDR + and CHECK_FUNC_GETADDRINFO_UNFREEABLE_AI_CANONNAME + internal to CHECK_FUNC_GETADDRINFO + +- fix leftover + +- Initial attempt to detect at configuration time if the getaddrinfo() + function returns an addrinfo with an unfreeable ai_canonname member ptr. + +- Initial attempt to detect at configuration time if the getaddrinfo() + function returns an addrinfo with an unfreeable ai_addr member ptr. + +- icc adjustments: + + Select ANSI C89 dialect plus GNU extensions, again. + +- some more temporary magic for the icc seg-fault issue + +- icc permanent adjustment: + + Select precise floating-point model, otherwise doubles are less than 64-bit wide + + icc test adjustment: + + Select c89 dialect + +- icc adjustments: + + Enable more icc warnings. + + Optimization disabling options used only for icc 9.1 + +- #include for exit() prototype + +- some more temporary magic for the icc seg-fault issue + +- remove from configure.ac temporary magic for the icc seg-fault issue + +- some more temporary magic for the icc seg-fault issue + +- Charles Hardin patch: + + - handles the EINPROGRESS for UDP connects + - uses closesocket instead of close on some paths that were noticed + +- some more 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. + +- fix compiler warning + +- fix missing double-quotes + +Daniel Stenberg (17 Oct 2008) +- Charles Hardin made adig support a regular numerical dotted IP address for the + -s option as well. + +Yang Tse (16 Oct 2008) +- some more temporary magic for the icc seg-fault issue + +- Ensure that shell variable contents which have active meaning + to the shell echo command are not interpreted when trying to + remove extra whitespace from shell variable content. + +- Adjust Watcom C warnings: + + Disable warnings on structure members padding. + +- With this change Solaris target builds will now be done with _REENTRANT defined. + +- Adjust Tiny C basic options: + + Remove -b from debug-enabled configuration, as Tiny C might have + been built without the memory and bounds checker support. + +- Adjust GCC warnings: + + Better disable following warnings when cross-compiling with a gcc older + than 3.0, to avoid warnings from third party system headers: + + -Wmissing-declarations + -Wmissing-prototypes + -Wunused + -Wshadow + +- fix syntax error + +- Initial attempt to detect Watcom C compiler + +- make naming scheme more consistent across whole file + +- Adjust GCC warnings: + + Disable following warnings when cross-compiling with a gcc older + than 3.0, to avoid warnings from third party system headers: + + -Wmissing-prototypes + -Wunused + -Wshadow + +- Adjust GCC --enable-warnings: + + Do not enable -pedantic when cross-compiling with a gcc older + than 3.0, to avoid warnings from third party system headers. + +- adjust SGI MIPSpro C detection + +- LCC compiler adjustments: + + Highest warning level is double -A, next is single -A. + Due to the big number of warnings these trigger on third + party header files it is impratical for us to use any of + them here. If you want them simply define it in CPPFLAGS. + +- remove extra space + +- split SGI compiler check. One for MIPS C and another for MIPSpro C + +- LCC compiler adjustments: + + Warning level reduced from double -A to single -A + +- Initial attempt to detect Tiny C compiler + +- Initial attempt to detect LCC compiler + +- 1) fix bug in CONVERT_INCLUDE_TO_ISYSTEM + + 2) Disable SGI remark: controlling expression is constant + +- simplify SGI C compiler check + +- 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. + +- Add debug tracing for COMPILER_WORKS_IFELSE + +- configure will also warn on 'strict compiler warning' rejected options + +- convert rejected compiler options messages into a warnings + +- remove extra whitespace from string in SGI C check + +- oops + +- Initial attempt to detect SGI C compiler + +- HP C adjustments: + + Disallow run-time dereferencing of null pointers. + + Disable some remarks: + + #4227: padding struct with n bytes to align member. + + #4255: padding size of struct with n bytes to alignment boundary. + +- improve presentation of accepted/rejected debug/optimizer options + +- refactoring of COMPILER_BASIC_OPTS + +- Initial attempt to detect SUN C compiler + +- Initial attempt to detect HP C compiler + +- fix compiler warning: 'dot_4' may be used uninitialized in this function + +- adjust ICC_windows settings + +- fix VAR_STRIP + +- Sync up with reality + +- Initial attempt to support configure's --(dis|en)able-optimize + option to specify dis(activation) of compiler optimizations. + + If option is specified, it will be honored independant of the + --(dis|en)able-debug option. + +- fix comment + +- Initial attempt to support configure's --(dis|en)able-warnings + option to specify dis(activation) of picky compiler warnings. + + If option is specified, it will be honored independant of the + --(dis|en)able-debug option. + + If option is not specified, it will follow --(dis|en)able-debug + setting, whose default is disabled if not specified. + +- fix compiler warning: dereferencing type-punned pointer will break strict-aliasing rules + +- now compiler warnings are activated for all gcc builds, not only debug ones. + +- Use CFLAGS for icc linker options instead of LDFLAGS, + otherwise gethostbyname() is not detected. + +- use ac_cv_compiler and ac_cv_compiler_num to keep compiler ID and version number + +- Temporary icc adjustment: + + Disable floating point optimizations + +- HAVE_INET_PTON will only be defined when an IPv6 capable working + inet_pton function is available. + +- HAVE_INET_NTOP will only be defined when an IPv6 capable working + inet_ntop function is available. + +- ntoa() and inet_ntoa_r() no longer used + +- icc adjustments for icc 9.0 and prior versions: + + Disable remark #279: controlling expression is constant + + Remark triggered mostly on va_arg() and FD_ZERO() macros. + +- attempt to make work the gethostname function + check for winsock build target configurations + +Gisle Vanem (21 Sep 2008) +- Added HAVE_NETDB_H, HAVE_ARPA_INET_H, HAVE_STRCASECMP + and HAVE_STRNCASECMP. + +Yang Tse (19 Sep 2008) +- icc adjustments: + + Disable remark #981: operands are evaluated in unspecified order + + Function calls which are triggering this remark, today, do not depend + on the order of evaluation of its arguments. + + Disable remark #1469: "cc" clobber ignored + + Remark triggered on htons() and ntohs() due to glibc header files. + +- icc adjustments + +- fix netdb.h prerequisite inclusion + +- improve detection of getservbyport_r() + +- On Linux Intel's icc uses gcc's header files, so + we select ANSI C89 dialect plus GNU extensions. + +- improve detection of gethostname() + +- NetWare builds include "nameser.h" from the c-ares subdir + +- include + +- Sync up with reality + +- adjust inclusion of "nameser.h" + +- reorder some lines in file + +- code cleanup + +- NetWare seems to have writev() + +- rearrange to allow internal/private use of ares_writev to any system + that lacks the writev function. + +- NetWare CLIB target has stricmp() and strnicmp() + +- include header file only when available + +- rearrange to allow internal/private use of ares_strcasecmp to any system that + lacks the strcasecmp function. + +- improve detection of: + strcasecmp() + strcmpi() + stricmp() + strncasecmp() + strncmpi() + strnicmp() + +- *** empty log message *** + +Gisle Vanem (12 Sep 2008) +- djgpp does have strdup(). + +Yang Tse (12 Sep 2008) +- change CRLF into LF line endings + +- strdup() clone for systems/configurations which lack it + +- move inclusion of ares_private.h last + +- icc adjustments + +- icc adjustments + +- Select strict ANSI C89 conformance for icc + +- remove unnecessary typecasting of malloc() + +- remove unnecessary typecasting of realloc() + +Daniel Stenberg (29 Aug 2008) +- we start over working towards 1.5.4 + +Version 1.5.3 (29 Aug 2008) + +Daniel Stenberg (29 Aug 2008) +- Version 1.5.3 + +- added the three people from RELEASE-NOTES and sorted the list alphabetically + +Yang Tse (27 Aug 2008) +- Don't abort configuration if recvfrom() is not available. + +- Functionality only possible if recvfrom() is available. + +- George Neill's fix acountry sample application compilation failure. + +- Brad House's validation that DNS response address matches the request address + +- fix the output name + +- Get rid of ENABLE_64BIT symbol definition and usage. + + Improve HAVE_LONGLONG symbol description. + +- Export 'ares_process_fd' too. + +Gisle Vanem (16 Aug 2008) +- Ops, remove 'use_vc'. + +- Support Watt-32 under Win32. + +Yang Tse (10 Aug 2008) +- Fix: Remove now this SIZEOF_CURL_OFF_T symbol definition. + + This should have been done with the initial 64-bit curl_off_t patch. + +- Improve CURL_CHECK_DEF + +- Fix IBM C and DEC/Compaq C compiler detection + +- Initial support of curlbuild.h and curlrules.h which allows + to have a curl_off_t data type no longer gated to off_t. + +- The minimum autoconf version required for this file is 2.50 + + Avoid dot notation in aclocal serial file number, use a single number now. + +Daniel Stenberg (4 Aug 2008) +- - Fix by Tofu Linden: + + The symptom: + * Users (usually, but not always) on 2-Wire routers and the Comcast service + and a wired connection to their router would find that the second and + subsequent DNS lookups from fresh processes using c-ares to resolve the same + address would cause the process to never see a reply (it keeps polling for + around 1m15s before giving up). + + The repro: + * On such a machine (and yeah, it took us a lot of QA to find the systems + that reproduce such a specific problem!), do 'ahost www.secondlife.com', + then do it again. The first process's lookup will work, subsequent lookups + will time-out and fail. + + The cause: + * init_id_key() was calling randomize_key() *before* it initialized + key->state, meaning that the randomness generated by randomize_key() is + immediately overwritten with deterministic values. (/dev/urandom was also + being read incorrectly in the c-ares version we were using, but this was + fixed in a later version.) + * This makes the stream of generated query-IDs from any new c-ares process + be an identical and predictable sequence of IDs. + * This makes the 2-Wire's default built-in DNS server detect these queries + as probable-duplicates and (erroneously) not respond at all. + +Yang Tse (4 Aug 2008) +- Autoconf 2.62 has changed the behaviour of the AC_AIX macro which we use. + Prior versions of autoconf defined _ALL_SOURCE if _AIX was defined. But, + autoconf 2.62 version of AC_AIX defines _ALL_SOURCE along with other four + preprocessor symbols no matter if the system is AIX or not. To keep the + traditional behaviour, as well as an uniform one, across autoconf versions + AC_AIX is replaced with our own internal macro. + +- Adjust DEC/Compaq C compiler settings. + +- Another AC_TRY_LINK conversion to AC_LINK_IFELSE. + Proper definition of HAVE_function if function is found deeper. + +- Sync up with reality + +- Rename reentrant.m4 to avoid filename clash. + +- Add file version serial number that might be used by 'aclocal' and others. + + Keep the '#' character as the first one on the line. + +- Update copyright year. + +- Sync comment with reality. + +- Reinstate the 'aclocal -I m4' in buildconf and 'ACLOCAL_AMFLAGS = -I m4' way of + including our local m4/reentrant.m4 file. This even takes care of including the + file in the distribution tarball. + +- Add quoting for the AC_DEFINE arguments. + +- Also remove the whitespace. + +- Also remove the extra quoting. + +- Replace some '@%:@' quadigraphs by its actual representation '#'. + + This quadigraph used before a C preprocessor 'define' directive could + be fooling M4, when processing this file, and make it think that the + line contains a pure M4 'define' macro. + +- Tests done using 'aclocal -I m4' in buildconf and 'ACLOCAL_AMFLAGS = -I m4 + in top Makefile.am triggered a problem that prevented aclocal from running + successfully on SunOS 5.10 with GNU m4 1.4.5 and GNU Autoconf 2.61 + + A tarball which reproduces mentioned problem is the one dated July-28-2008 + http://cool.haxx.se/curl-daily/curl-7.19.0-20080728.tar.gz + + We actually don't need all the bells and whistles that the above mechanism + provides. We only need to include our m4/reentrant.m4 file in acinclude.m4 + so here we go with this simpler mechanism. + +- for debugging purposes show ACLOCAL_FLAGS + +- These lines were unintentionally removed in previous commit + +- Partially undo change that prevented SED, GREP, EGREP and AR from being changed by libtool or autoconf. + +- Assert that SED and GREP are set + +- Require autoconf 2.57 or newer + +- When calling aclocal, user defined ACLOCAL_FLAGS will now precede ours. + +- move ACLOCAL_AMFLAGS after AUTOMAKE_OPTIONS + +- setup.h handles definition of _REENTRANT based on NEED_REENTRANT + definition which might be defined in config.h or config-*.h files + +- Remove explicit inclusion of our m4 files first. It was interesting as a test, + but it breaks aclocal execution on some systems, with the following error: + + Can't locate object method "rel2abs" via package "File::Spec" at /usr/local/bin/aclocal line 256. + +- Another step towards detecting if _REENTRANT is already defined or actually + needed, and being able to define it if appropriate for further configure tests + as well as for the generated config file. + +- Explicitly include our m4 files first. This might minimize the impact + that other package's underquoted m4 function definitions have on ours. + +- Add a 3 argument check for getprotobyname_r diff --git a/INSTALL b/INSTALL index 4db2baf..c78487d 100644 --- a/INSTALL +++ b/INSTALL @@ -321,7 +321,7 @@ PORTS Useful URLs =========== -c-ares http://c-ares.haxx.se/ +c-ares https://c-ares.haxx.se/ MingW http://www.mingw.org/ MinGW-w64 http://mingw-w64.sourceforge.net/ diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..86b520b --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,15 @@ +# c-ares license + +Copyright (c) 2007 - 2016, Daniel Stenberg with many contributors, see AUTHORS +file. + +Copyright 1998 by the Massachusetts Institute of Technology. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, provided that +the above copyright notice appear in all copies and that both that copyright +notice and this permission notice appear in supporting documentation, and that +the name of M.I.T. not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior permission. +M.I.T. makes no representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied warranty. diff --git a/Makefile.am b/Makefile.am index af0ceb2..3ba40ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,7 +56,7 @@ EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \ 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 \ - README.md + README.md LICENSE.md CLEANFILES = $(PDFPAGES) $(HTMLPAGES) @@ -67,7 +67,7 @@ DIST_SUBDIRS = test pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libcares.pc -CARES_VERSION_INFO = -version-info 3:0:1 +CARES_VERSION_INFO = -version-info 4:0:2 # This flag accepts an argument of the form current[:revision[:age]]. So, # passing -version-info 3:12:1 sets current to 3, revision to 12, and age to # 1. diff --git a/Makefile.dj b/Makefile.dj index 799611f..f891f7f 100644 --- a/Makefile.dj +++ b/Makefile.dj @@ -1,6 +1,6 @@ # # c-ares Makefile for djgpp/gcc/Watt-32. -# By Gisle Vanem 2004. +# By Gisle Vanem 2004. # diff --git a/Makefile.m68k b/Makefile.m68k index d5e285f..f077f3a 100644 --- a/Makefile.m68k +++ b/Makefile.m68k @@ -1,68 +1,53 @@ -LIB = libcares.a AR = m68k-amigaos-ar CC = m68k-amigaos-gcc LD = m68k-amigaos-gcc RANLIB = m68k-amigaos-ranlib RM = rm -f -CP = cp -afv -CFLAGS = -O2 -Wall -I. -Iinclude -DHAVE_CONFIG_H -DCARES_STATICLIB -DAOS3 +CFLAGS = -O2 -Wall -I. -Iinclude -DHAVE_CONFIG_H -DCARES_STATICLIB -DAMIGA -DAOS3 LDFLAGS = -noixemul -s LIBS = -lm +LIB = libcares.a +LIBH = ares.h ares_build.h ares_rules.h + # Makefile.inc provides the CSOURCES and HHEADERS defines include Makefile.inc OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES))) +all: $(LIB) dig host country doc + +dig: adig.o ares_getopt.o $(LIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o dig adig.o ares_getopt.o $(LIB) $(LIBS) + +host: ahost.o ares_getopt.o $(LIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o host ahost.o ares_getopt.o $(LIB) $(LIBS) + +country: acountry.o ares_getopt.o $(LIB) + $(CC) $(CFLAGS) $(LDFLAGS) -o country acountry.o ares_getopt.o $(LIB) $(LIBS) $(LIB): $(OBJLIB) $(AR) cru $@ $^ $(RANLIB) $@ -all: $(LIB) demos doc - doc: - ./workman1 adig.1 >adig.txt - ./workman2 adig.1 >adig.help - ./workman1 ahost.1 >ahost.txt - ./workman2 ahost.1 >ahost.help - ./workman1 acountry.1 >acountry.txt - ./workman2 acountry.1 >acountry.help - -demos: adig.exe ahost.exe acountry.exe + ./workman1 adig.1 >dig.txt + ./workman2 adig.1 >dig.help + ./workman1 ahost.1 >host.txt + ./workman2 ahost.1 >host.help + ./workman1 acountry.1 >country.txt + ./workman2 acountry.1 >country.help tags: etags *.[ch] -%.exe: %.o ares_getopt.o $(LIB) - $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) - $(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h .c.o: $(CC) $(CFLAGS) -c $< -ares_build.h: - $(CP) ares_build.h.dist ares_build.h - -check: - -install: - ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir} - ${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir} - ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3 - ${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir} - ${RANLIB} ${DESTDIR}${libdir}/$(LIB) - chmod u-w ${DESTDIR}${libdir}/$(LIB) - ${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir} - ${INSTALL} -m 444 ${srcdir}/ares_build.h ${DESTDIR}${includedir} - ${INSTALL} -m 444 ${srcdir}/ares_rules.h ${DESTDIR}${includedir} - (for man in $(MANPAGES); do \ - ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \ - done) - clean: - $(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe adig.txt adig.help ahost.txt ahost.help acountry.txt acountry.help + $(RM) adig.o ahost.o acountry.o ares_getopt.o $(OBJLIB) $(LIB) dig host country dig.txt dig.help host.txt host.help country.txt country.help distclean: clean $(RM) config.cache config.log config.status Makefile diff --git a/Makefile.msvc b/Makefile.msvc index 7f4806b..e05e317 100644 --- a/Makefile.msvc +++ b/Makefile.msvc @@ -18,12 +18,12 @@ # Makefile for building c-ares libraries and sample programs with MSVC. # # Usage: nmake /f makefile.msvc CFG= -# +# # must be one of: [ lib-release | lib-debug | dll-release | dll-debug } # must be one of: [ ALL | c-ares | acountry | adig | ahost | clean } -# +# # If a other than ALL or clean is given, becomes mandatory. -# +# # If neither nor are specified this results in # all targets being built for all c-ares library types. # @@ -71,74 +71,10 @@ RTLIBD = /MTd USE_WATT32 = 0 -# ------------------------------------------- -# Detect NMAKE version deducing MSVC version -# ------------------------------------------- - -!IFNDEF _NMAKE_VER -! MESSAGE Macro _NMAKE_VER not defined. -! MESSAGE Use MSVC's NMAKE to process this makefile. -! ERROR See previous message. -!ENDIF - -!IF "$(_NMAKE_VER)" == "6.00.8168.0" -CC_VERS_NUM = 60 -!ELSEIF "$(_NMAKE_VER)" == "6.00.9782.0" -CC_VERS_NUM = 60 -!ELSEIF "$(_NMAKE_VER)" == "7.00.8882" -CC_VERS_NUM = 70 -!ELSEIF "$(_NMAKE_VER)" == "7.00.9466" -CC_VERS_NUM = 70 -!ELSEIF "$(_NMAKE_VER)" == "7.00.9955" -CC_VERS_NUM = 70 -!ELSEIF "$(_NMAKE_VER)" == "7.10.2240.8" -CC_VERS_NUM = 71 -!ELSEIF "$(_NMAKE_VER)" == "7.10.3077" -CC_VERS_NUM = 71 -!ELSEIF "$(_NMAKE_VER)" == "8.00.40607.16" -CC_VERS_NUM = 80 -!ELSEIF "$(_NMAKE_VER)" == "8.00.50727.42" -CC_VERS_NUM = 80 -!ELSEIF "$(_NMAKE_VER)" == "8.00.50727.762" -CC_VERS_NUM = 80 -!ELSEIF "$(_NMAKE_VER)" == "9.00.20706.01" -CC_VERS_NUM = 90 -!ELSEIF "$(_NMAKE_VER)" == "9.00.21022.08" -CC_VERS_NUM = 90 -!ELSEIF "$(_NMAKE_VER)" == "9.00.30729.01" -CC_VERS_NUM = 90 -!ELSEIF "$(_NMAKE_VER)" == "10.00.20506.01" -CC_VERS_NUM = 100 -!ELSEIF "$(_NMAKE_VER)" == "10.00.21003.01" -CC_VERS_NUM = 100 -!ELSEIF "$(_NMAKE_VER)" == "10.00.30128.01" -CC_VERS_NUM = 100 -!ELSEIF "$(_NMAKE_VER)" == "10.00.30319.01" -CC_VERS_NUM = 100 -!ELSEIF "$(_NMAKE_VER)" == "10.00.40219.01" -CC_VERS_NUM = 100 -!ELSEIF "$(_NMAKE_VER)" == "11.00.50522.1" -CC_VERS_NUM = 110 -!ELSEIF "$(_NMAKE_VER)" == "11.00.50727.1" -CC_VERS_NUM = 110 -!ELSEIF "$(_NMAKE_VER)" == "11.00.51106.1" -CC_VERS_NUM = 110 -!ELSEIF "$(_NMAKE_VER)" == "11.00.60315.1" -CC_VERS_NUM = 110 -!ELSEIF "$(_NMAKE_VER)" == "11.00.61030.0" -CC_VERS_NUM = 110 -!ELSEIF "$(_NMAKE_VER)" == "12.00.21005.1" -CC_VERS_NUM = 120 -!ELSEIF "$(_NMAKE_VER)" == "14.00.23026.0" -CC_VERS_NUM = 140 -!ELSE -! MESSAGE Unknown value for _NMAKE_VER macro: "$(_NMAKE_VER)" -! MESSAGE Please, report this condition on the c-ares development -! MESSAGE mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/ -! ERROR See previous message. -!ENDIF - -CC_VERS_STR = msvc$(CC_VERS_NUM) +# -------------------------------------------------------- +# Detect compiler version. +# -------------------------------------------------------- +!INCLUDE .\msvc_ver.inc # ---------------------------------------------------- # Verify that current subdir is the c-ares source one diff --git a/Makefile.netware b/Makefile.netware index 653efb0..fa8f831 100644 --- a/Makefile.netware +++ b/Makefile.netware @@ -306,7 +306,6 @@ ifeq ($(LIBARCH),CLIB) @echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ - @echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@ else @echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ @@ -349,8 +348,6 @@ else @echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@ @echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ @echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@ - @echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@ - @echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@ endif @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ @@ -397,9 +394,6 @@ endif @echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@ @echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@ @echo $(DL)#define RETSIGTYPE void$(DL) >> $@ - @echo $(DL)#define SIZEOF_INT 4$(DL) >> $@ - @echo $(DL)#define SIZEOF_SHORT 2$(DL) >> $@ - @echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@ @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ ifdef NW_WINSOCK @@ -431,11 +425,8 @@ ares_build.h: Makefile.netware FORCE @echo $(DL)#define __CARES_BUILD_H$(DL) >> $@ ifeq ($(LIBARCH),CLIB) @echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T int$(DL) >> $@ - @echo $(DL)#define CARES_SIZEOF_ARES_SOCKLEN_T 4$(DL) >> $@ else @echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int$(DL) >> $@ - @echo $(DL)#define CARES_SIZEOF_ARES_SOCKLEN_T 4$(DL) >> $@ endif - @echo $(DL)#define CARES_SIZEOF_LONG 4$(DL) >> $@ @echo $(DL)typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;$(DL) >> $@ @echo $(DL)#endif /* __CARES_BUILD_H */$(DL) >> $@ diff --git a/README.cares b/README.cares index 817f130..4dee46e 100644 --- a/README.cares +++ b/README.cares @@ -12,4 +12,4 @@ compatible with ares: a new name makes that more obvious to the public. The original libares was distributed at ftp://athena-dist.mit.edu:pub/ATHENA/ares (which seems to not be alive anymore). A local copy of the original ares package is kept here: -http://c-ares.haxx.se/download/ares-1.1.1.tar.gz +https://c-ares.haxx.se/download/ares-1.1.1.tar.gz diff --git a/README.md b/README.md index a643aa4..fdf3a71 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ c-ares ====== +[![Build Status](https://travis-ci.org/c-ares/c-ares.svg?branch=master)](https://travis-ci.org/c-ares/c-ares) +[![Windows Build Status](https://ci.appveyor.com/api/projects/status/03i7151772eq3wn3/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares) +[![Coverage Status](https://coveralls.io/repos/c-ares/c-ares/badge.svg?branch=master&service=github)](https://coveralls.io/github/c-ares/c-ares?branch=master) +[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/291/badge)](https://bestpractices.coreinfrastructure.org/projects/291) + This is c-ares, an asynchronous resolver library. It is intended for applications which need to perform DNS queries without blocking, or need to perform multiple DNS queries in parallel. The primary examples of such @@ -18,7 +23,7 @@ c-ares is of course distributed under the same MIT-style license as the original ares. You'll find all c-ares details and news here: - http://c-ares.haxx.se/ + https://c-ares.haxx.se/ Notes for c-ares hackers diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9a4752d..dffb023 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,15 +1,46 @@ -c-ares version 1.11.1 +c-ares version 1.12.0 Changes: - o + o api: add ARES_OPT_NOROTATE optmask value Bug fixes: - o + o CVE-2016-5180: ares_create_query single byte out of buffer write [4] + o configure: acknowledge --disable-tests [1] + o man pages: fix typos detected by Lintian + o test: add missing #includes for dns-proto.cc + o test: avoid in6addr_* constants + o test: Build with MinGW on AppVeyor + o Makefile.m32: add support for extra flags + o Makefile.m32: add support for CROSSPREFIX + o configure: check if tests can get built before enabled + o ares_library_cleanup: reset ares_realloc too + o ahost.c: add cast to fix C++ compile + o test: Only pass unused args to GoogleTest + o build: commonize MSVC version detection + o msvc_ver.inc: support Visual Studio 2015 Update 1, 2, 3 + o test: for AF_UNSPEC, return CNAME only for AAAA, but valid A record + o ares_getnameinfo: explicitly clear struct servent before use + o test: Update fuzzing function prototype + o init: fix nsort initialization + o test: add fuzzing check script to tests + o web: http => https + o read_tcp_data: remove superfluous NULL check + o LICENSE.md: add a stand-alone license file + o SECURITY.md: suggested "security process" for the project + o ares_init_options: only propagate init failures from options [2] + o headers: remove checks for and defines of variable sizes + o test: fix gMock to work with gcc >= 6.x [3] Thanks go to these friendly people for their efforts and contributions: + Alexander Drachevskiy, Brad House, Chris Araman, Daniel Stenberg, + David Drysdale, Gregor Jasny, Svante Karlsson, Viktor Szakats +References to bug reports and discussions on issues: -Have fun! + [1] = https://github.com/c-ares/c-ares/issues/44 + [2] = https://github.com/c-ares/c-ares/issues/60 + [3] = https://github.com/google/googletest/issues/705#issuecomment-235067917 + [4] = https://c-ares.haxx.se/adv_20160929.html diff --git a/acountry.1 b/acountry.1 index 74c4e34..ba59d1c 100644 --- a/acountry.1 +++ b/acountry.1 @@ -1,8 +1,8 @@ -.TH ACOUNTRY "1" "April 2011" "c-ares utilities" +.TH COUNTRY "1" "April 2011" "c-ares utilities" .SH NAME -acountry \- print the country where an IPv4 address or host is located +country \- print the country where an IPv4 address or host is located .SH SYNOPSIS -.B acountry +.B country [\fIOPTION\fR]... \fIHOST\fR... .SH DESCRIPTION .PP diff --git a/acountry.c b/acountry.c index f2e4d4b..d90b61f 100644 --- a/acountry.c +++ b/acountry.c @@ -15,7 +15,7 @@ * * Ref: http://countries.nerd.dk/more.html * - * Written by G. Vanem 2006, 2007 + * Written by G. Vanem 2006, 2007 * * NB! This program may not be big-endian aware. * @@ -69,7 +69,18 @@ #define INADDR_NONE 0xffffffff #endif -static const char *usage = "acountry [-vh?] {host|addr} ...\n"; +const char *vers = "\0$VER: country 1.12 (29.09.2016) c-ares " ARES_VERSION_STR; + +static const char *usage = +#ifdef ANSI_CONSOLE + "\33[33mcountry version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\33[31m\n" +#else + "country version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\n" +#endif + "Usage: country [options] { host | addr } ...\n" + "\t-v: Be more verbose. Print extra information\n" + "\t-h: Display this help and exit\n"; + static const char nerd_fmt[] = "%u.%u.%u.%u.zz.countries.nerd.dk"; static const char *nerd_ver1 = nerd_fmt + 14; /* .countries.nerd.dk */ static const char *nerd_ver2 = nerd_fmt + 11; /* .zz.countries.nerd.dk */ @@ -94,8 +105,6 @@ static void Abort(const char *fmt, ...) exit(1); } -const char *vers = "\0$VER: acountry 1.11 (01.03.2016) c-ares 1.11.0"; - int main(int argc, char **argv) { ares_channel channel; diff --git a/adig.1 b/adig.1 index 76e9689..19b1b47 100644 --- a/adig.1 +++ b/adig.1 @@ -1,8 +1,8 @@ -.TH ADIG "1" "April 2011" "c-ares utilities" +.TH DIG "1" "April 2011" "c-ares utilities" .SH NAME -adig \- print information collected from Domain Name System (DNS) servers +dig \- print information collected from Domain Name System (DNS) servers .SH SYNOPSIS -.B adig +.B dig [\fIOPTION\fR]... \fINAME\fR... .SH DESCRIPTION .PP diff --git a/adig.c b/adig.c index 6905330..040c940 100644 --- a/adig.c +++ b/adig.c @@ -178,7 +178,7 @@ static void destroy_addr_list(struct ares_addr_node *head); static void append_addr_list(struct ares_addr_node **head, struct ares_addr_node *node); -const char *vers = "\0$VER: adig 1.11 (01.03.2016) c-ares 1.11.0"; +const char *vers = "\0$VER: dig 1.12 (29.09.2016) c-ares " ARES_VERSION_STR; int main(int argc, char **argv) { @@ -799,9 +799,24 @@ static const char *class_name(int dnsclass) static void usage(void) { - fprintf(stderr, "usage: adig [-f flag] [-s server] [-c class] " - "[-t type] [-p port] name ...\n"); - exit(1); + fprintf(stderr, +#ifdef ANSI_CONSOLE + "\33[33mdig version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\33[31m\n" +#else + "dig version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\n" +#endif + "Usage: dig [options] name\n" + "\t-s : connect to specified DNS server. Default is 8.8.8.8.\n" + "\t-f : set the query class: NY, CHAOS, HS, IN (default)\n" + "\t-f : add a flag: igntc, noaliases, norecurse, primary, stayopen, usevc\n" + "\t-t : query records of specified type, default is A. Possible values:\n" + "\t AAAA, AFSDB, ANY, AXFR, CNAME, GPOS, HINFO, ISDN, KEY,LOC,\n" + "\t MAILA, MAILB, MB, MD, MF, MG, MINFO, MR, MX, NAPTR, NS, NSAP\n" + "\t NSAP_PTR, NULL, PTR, PX, RP, RT, SIG, SOA, SRV, TXT, WKS, X25\n" + "\t-p : use specified TCP port to connect to DNS server\n" + "\t-U : use specified UDP port to connect to DNS server\n" + ); + exit(1); } static void destroy_addr_list(struct ares_addr_node *head) diff --git a/ahost.1 b/ahost.1 index c83cfcf..a880285 100644 --- a/ahost.1 +++ b/ahost.1 @@ -1,8 +1,8 @@ -.TH AHOST "1" "April 2011" "c-ares utilities" +.TH HOST "1" "April 2011" "c-ares utilities" .SH NAME -ahost \- print the A or AAAA record associated with a hostname or IP address +host \- print the A or AAAA record associated with a hostname or IP address .SH SYNOPSIS -.B ahost +.B host [\fIOPTION\fR]... \fIHOST\fR... .SH DESCRIPTION .PP diff --git a/ahost.c b/ahost.c index bc18b84..54d4314 100644 --- a/ahost.c +++ b/ahost.c @@ -50,7 +50,7 @@ static void callback(void *arg, int status, int timeouts, struct hostent *host); static void usage(void); -const char *vers = "\0$VER: ahost 1.11 (01.03.2016) c-ares 1.11.0"; +const char *vers = "\0$VER: host 1.12 (29.09.2016) c-ares " ARES_VERSION_STR; int main(int argc, char **argv) { @@ -92,8 +92,8 @@ int main(int argc, char **argv) case 's': optmask |= ARES_OPT_DOMAINS; options.ndomains++; - options.domains = realloc(options.domains, - options.ndomains * sizeof(char *)); + options.domains = (char **)realloc(options.domains, + options.ndomains * sizeof(char *)); options.domains[options.ndomains - 1] = strdup(optarg); break; case 't': @@ -205,6 +205,16 @@ static void callback(void *arg, int status, int timeouts, struct hostent *host) static void usage(void) { - fprintf(stderr, "usage: ahost [-t {a|aaaa|u}] {host|addr} ...\n"); - exit(1); + fprintf(stderr, + #ifdef ANSI_CONSOLE + "\33[33mhost version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\33[31m\n" + #else + "host version " ARES_VERSION_STR " (c) " ARES_COPYRIGHT "\n" + #endif + "Usage: host [-t type] { host | addr } ...\n" + "\t-ta: print the A record (default)\n" + "\t-tu: look for either AAAA or A record\n" + "\t-taaaa: print the AAAA record\n" + ); + exit(1); } diff --git a/amiga_port.c b/amiga_port.c index 5026f58..20113e8 100644 --- a/amiga_port.c +++ b/amiga_port.c @@ -1,7 +1,6 @@ #include "ares_setup.h" #if defined(AOS3) || defined(AROS) - /* * Written by Carsten Larsen. * Public domain. @@ -13,7 +12,6 @@ #include #include #include -#include #define OPEN_ERROR "Cannot open %s.\n" #define OPEN_VER_ERROR "Cannot open %s (%d.0)\n" @@ -31,11 +29,8 @@ int h_errno; #endif -struct Library* DOSBase = NULL; -struct Library* SocketBase = NULL; -struct Library* UtilityBase = NULL; -struct Device* TimerBase = NULL; -struct timerequest* TimeRequest = NULL; +struct Library* DOSBase = NULL; +struct Library* SocketBase = NULL; char *prog; @@ -64,14 +59,12 @@ void ares_amiga_cleanup() int ares_amiga_init() { - struct timeval tv; - - if(!(DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV))) { + if((DOSBase = OpenLibrary((STRPTR)DOSLIB_NAME, DOSLIB_REV)) == NULL) { amiga_open_lib_error(DOSLIB_NAME, DOSLIB_REV); return LIB_ERROR; } - if(!(SocketBase = OpenLibrary((STRPTR)BSDLIB_NAME, BSDLIB_REV))) { + if((SocketBase = OpenLibrary((STRPTR)BSDLIB_NAME, BSDLIB_REV)) == NULL) { amiga_open_lib_error(BSDLIB_NAME, BSDLIB_REV); return LIB_ERROR; } else { @@ -81,9 +74,6 @@ int ares_amiga_init() SBTM_SETVAL(SBTC_LOGTAGPTR), (IPTR) &prog, TAG_DONE ); } - - gettimeofday(&tv, NULL); - srand(tv.tv_sec); return 0; } diff --git a/ares.h b/ares.h index 3d57760..81a9393 100644 --- a/ares.h +++ b/ares.h @@ -158,6 +158,7 @@ extern "C" { #define ARES_OPT_TIMEOUTMS (1 << 13) #define ARES_OPT_ROTATE (1 << 14) #define ARES_OPT_EDNSPSZ (1 << 15) +#define ARES_OPT_NOROTATE (1 << 16) /* Nameinfo flag values */ #define ARES_NI_NOFQDN (1 << 0) diff --git a/ares_build.h b/ares_build.h new file mode 100644 index 0000000..9633212 --- /dev/null +++ b/ares_build.h @@ -0,0 +1,95 @@ +/* ares_build.h. Generated from ares_build.h.in by configure. */ +#ifndef __CARES_BUILD_H +#define __CARES_BUILD_H + + +/* Copyright (C) 2009 by Daniel Stenberg et al + * + * 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: + * ------- + * + * 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/ + * + * This header file shall only export symbols which are 'cares' or 'CARES' + * prefixed, otherwise public name space would be polluted. + * + * NOTE 2: + * ------- + * + * Right now you might be staring at file ares_build.h.in or ares_build.h, + * this is due to the following reason: + * + * 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. + * + */ + +/* ================================================================ */ +/* 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 CONFIGURE CAPABLE SYSTEMS ONLY */ +/* ================================================================ */ + +/* Configure process defines this to 1 when it finds out that system */ +/* header file ws2tcpip.h must be included by the external interface. */ +/* #undef CARES_PULL_WS2TCPIP_H */ +#ifdef CARES_PULL_WS2TCPIP_H +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# endif +# include +# include +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/types.h must be included by the external interface. */ +/* #undef CARES_PULL_SYS_TYPES_H */ +#ifdef CARES_PULL_SYS_TYPES_H +# include +#endif + +/* Configure process defines this to 1 when it finds out that system */ +/* header file sys/socket.h must be included by the external interface. */ +/* #undef CARES_PULL_SYS_SOCKET_H */ +#ifdef CARES_PULL_SYS_SOCKET_H +# include +#endif + +/* Integral data type used for ares_socklen_t. */ +#define CARES_TYPEOF_ARES_SOCKLEN_T int + +/* Data type definition of ares_socklen_t. */ +typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; + +#endif /* __CARES_BUILD_H */ diff --git a/ares_build.h.in b/ares_build.h.in index 227782c..e582523 100644 --- a/ares_build.h.in +++ b/ares_build.h.in @@ -50,21 +50,11 @@ /* DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE */ /* ================================================================ */ -#ifdef CARES_SIZEOF_LONG -# error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h" - Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined -#endif - #ifdef CARES_TYPEOF_ARES_SOCKLEN_T # error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined #endif -#ifdef CARES_SIZEOF_ARES_SOCKLEN_T -# error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" - Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined -#endif - /* ================================================================ */ /* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */ /* ================================================================ */ @@ -95,15 +85,9 @@ # include #endif -/* The size of `long', as computed by sizeof. */ -#undef CARES_SIZEOF_LONG - /* Integral data type used for ares_socklen_t. */ #undef CARES_TYPEOF_ARES_SOCKLEN_T -/* The size of `ares_socklen_t', as computed by sizeof. */ -#undef CARES_SIZEOF_ARES_SOCKLEN_T - /* Data type definition of ares_socklen_t. */ typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; diff --git a/ares_cancel.3 b/ares_cancel.3 index 0bf6281..e534e3f 100644 --- a/ares_cancel.3 +++ b/ares_cancel.3 @@ -23,14 +23,15 @@ ares_cancel \- Cancel a resolve .B void ares_cancel(ares_channel \fIchannel\fP) .fi .SH DESCRIPTION -The \fBares_cancel\fP function cancels all lookups/requests made on the the -name service channel identified by \fIchannel\fP. \fBares_cancel\fP invokes -the callbacks for each pending query on the channel, passing a status of +The \fBares_cancel(3)\fP function cancels all lookups/requests made on the the +name service channel identified by \fIchannel\fP. \fBares_cancel(3)\fP +invokes the callbacks for each pending query on the channel, passing a status +of .BR ARES_ECANCELLED . -These calls give the callbacks a chance to clean up any state which -might have been stored in their arguments. If such a callback invocation adds -a new request to the channel, that request will \fInot\fP be cancelled by the -current invocation of \fBares_cancel\fP. +These calls give the callbacks a chance to clean up any state which might have +been stored in their arguments. If such a callback invocation adds a new +request to the channel, that request will \fInot\fP be cancelled by the +current invocation of \fBares_cancel(3)\fP. .SH SEE ALSO .BR ares_init (3) .BR ares_destroy (3) diff --git a/ares_config.h b/ares_config.h new file mode 100644 index 0000000..dcfa7bc --- /dev/null +++ b/ares_config.h @@ -0,0 +1,502 @@ +/* ares_config.h. Generated from ares_config.h.in by configure. */ +/* ares_config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* define this if ares is built for a big endian system */ +#define ARES_BIG_ENDIAN 1 + +/* when building as static part of libcurl */ +/* #undef BUILDING_LIBCURL */ + +/* Defined for build that exposes internal static functions for testing. */ +/* #undef CARES_EXPOSE_STATICS */ + +/* Defined for build with symbol hiding. */ +/* #undef CARES_SYMBOL_HIDING */ + +/* Definition to make a library symbol externally visible. */ +/* #undef CARES_SYMBOL_SCOPE_EXTERN */ + +/* Use resolver library to configure cares */ +/* #undef CARES_USE_LIBRESOLV */ + +/* if a /etc/inet dir is being used */ +/* #undef ETC_INET */ + +/* Define to the type of arg 2 for gethostname. */ +#define GETHOSTNAME_TYPE_ARG2 int + +/* Define to the type qualifier of arg 1 for getnameinfo. */ +/* #undef GETNAMEINFO_QUAL_ARG1 */ + +/* Define to the type of arg 1 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG1 */ + +/* Define to the type of arg 2 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG2 */ + +/* Define to the type of args 4 and 6 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG46 */ + +/* Define to the type of arg 7 for getnameinfo. */ +/* #undef GETNAMEINFO_TYPE_ARG7 */ + +/* Specifies the number of arguments to getservbyport_r */ +/* #undef GETSERVBYPORT_R_ARGS */ + +/* Specifies the size of the buffer to pass to getservbyport_r */ +/* #undef GETSERVBYPORT_R_BUFSIZE */ + +/* Define to 1 if you have AF_INET6. */ +/* #undef HAVE_AF_INET6 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_NAMESER_COMPAT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_NAMESER_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the `bitncmp' function. */ +/* #undef HAVE_BITNCMP */ + +/* Define to 1 if bool is an available type. */ +#define HAVE_BOOL_T 1 + +/* Define to 1 if you have the clock_gettime function and monotonic timer. */ +/* #undef HAVE_CLOCK_GETTIME_MONOTONIC */ + +/* Define to 1 if you have the closesocket function. */ +/* #undef HAVE_CLOSESOCKET */ + +/* Define to 1 if you have the CloseSocket camel case function. */ +/* #undef HAVE_CLOSESOCKET_CAMEL */ + +/* Define to 1 if you have the connect function. */ +#define HAVE_CONNECT 1 + +/* define if the compiler supports basic C++11 syntax */ +/* #undef HAVE_CXX11 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the fcntl function. */ +/* #undef HAVE_FCNTL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have a working fcntl O_NONBLOCK function. */ +/* #undef HAVE_FCNTL_O_NONBLOCK */ + +/* Define to 1 if you have the freeaddrinfo function. */ +/* #undef HAVE_FREEADDRINFO */ + +/* Define to 1 if you have a working getaddrinfo function. */ +/* #undef HAVE_GETADDRINFO */ + +/* Define to 1 if the getaddrinfo function is threadsafe. */ +/* #undef HAVE_GETADDRINFO_THREADSAFE */ + +/* Define to 1 if you have the getenv function. */ +#define HAVE_GETENV 1 + +/* Define to 1 if you have the gethostbyaddr function. */ +#define HAVE_GETHOSTBYADDR 1 + +/* Define to 1 if you have the gethostbyname function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the getnameinfo function. */ +/* #undef HAVE_GETNAMEINFO */ + +/* Define to 1 if you have the getservbyport_r function. */ +/* #undef HAVE_GETSERVBYPORT_R */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `if_indextoname' function. */ +/* #undef HAVE_IF_INDEXTONAME */ + +/* Define to 1 if you have a IPv6 capable working inet_net_pton function. */ +/* #undef HAVE_INET_NET_PTON */ + +/* Define to 1 if you have a IPv6 capable working inet_ntop function. */ +/* #undef HAVE_INET_NTOP */ + +/* Define to 1 if you have a IPv6 capable working inet_pton function. */ +/* #undef HAVE_INET_PTON */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_INTTYPES_H */ + +/* Define to 1 if you have the ioctl function. */ +#define HAVE_IOCTL 1 + +/* Define to 1 if you have the ioctlsocket function. */ +/* #undef HAVE_IOCTLSOCKET */ + +/* Define to 1 if you have the IoctlSocket camel case function. */ +/* #undef HAVE_IOCTLSOCKET_CAMEL */ + +/* Define to 1 if you have a working IoctlSocket camel case FIONBIO function. + */ +/* #undef HAVE_IOCTLSOCKET_CAMEL_FIONBIO */ + +/* Define to 1 if you have a working ioctlsocket FIONBIO function. */ +/* #undef HAVE_IOCTLSOCKET_FIONBIO */ + +/* Define to 1 if you have a working ioctl FIONBIO function. */ +#define HAVE_IOCTL_FIONBIO 1 + +/* Define to 1 if you have a working ioctl SIOCGIFADDR function. */ +#define HAVE_IOCTL_SIOCGIFADDR 1 + +/* Define to 1 if you have the `resolve' library (-lresolve). */ +/* #undef HAVE_LIBRESOLVE */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* if your compiler supports LL */ +#define HAVE_LL 1 + +/* Define to 1 if the compiler supports the 'long long' data type. */ +#define HAVE_LONGLONG 1 + +/* Define to 1 if you have the malloc.h header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the memory.h header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the MSG_NOSIGNAL flag. */ +/* #undef HAVE_MSG_NOSIGNAL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_TCP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NET_IF_H 1 + +/* Define to 1 if you have PF_INET6. */ +/* #undef HAVE_PF_INET6 */ + +/* Define to 1 if you have the recv function. */ +#define HAVE_RECV 1 + +/* Define to 1 if you have the recvfrom function. */ +#define HAVE_RECVFROM 1 + +/* Define to 1 if you have the send function. */ +#define HAVE_SEND 1 + +/* Define to 1 if you have the setsockopt function. */ +#define HAVE_SETSOCKOPT 1 + +/* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */ +/* #undef HAVE_SETSOCKOPT_SO_NONBLOCK */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if sig_atomic_t is an available typedef. */ +#define HAVE_SIG_ATOMIC_T 1 + +/* Define to 1 if sig_atomic_t is already defined as volatile. */ +/* #undef HAVE_SIG_ATOMIC_T_VOLATILE */ + +/* Define to 1 if your struct sockaddr_in6 has sin6_scope_id. */ +/* #undef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID */ + +/* Define to 1 if you have the socket function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDINT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the strcasecmp function. */ +#define HAVE_STRCASECMP 1 + +/* Define to 1 if you have the strcmpi function. */ +/* #undef HAVE_STRCMPI */ + +/* Define to 1 if you have the strdup function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the stricmp function. */ +#define HAVE_STRICMP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the strncasecmp function. */ +#define HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the strncmpi function. */ +/* #undef HAVE_STRNCMPI */ + +/* Define to 1 if you have the strnicmp function. */ +/* #undef HAVE_STRNICMP */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STROPTS_H */ + +/* Define to 1 if you have struct addrinfo. */ +/* #undef HAVE_STRUCT_ADDRINFO */ + +/* Define to 1 if you have struct in6_addr. */ +/* #undef HAVE_STRUCT_IN6_ADDR */ + +/* Define to 1 if you have struct sockaddr_in6. */ +/* #undef HAVE_STRUCT_SOCKADDR_IN6 */ + +/* if struct sockaddr_storage is defined */ +/* #undef HAVE_STRUCT_SOCKADDR_STORAGE */ + +/* Define to 1 if you have the timeval struct. */ +#define HAVE_STRUCT_TIMEVAL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +//#define HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the windows.h header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the winsock2.h header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the winsock.h header file. */ +/* #undef HAVE_WINSOCK_H */ + +/* Define to 1 if you have the writev function. */ +/* #undef HAVE_WRITEV */ + +/* Define to 1 if you have the ws2tcpip.h header file. */ +/* #undef HAVE_WS2TCPIP_H */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if you need the malloc.h header file even with stdlib.h */ +/* #undef NEED_MALLOC_H */ + +/* Define to 1 if you need the memory.h header file even with stdlib.h */ +/* #undef NEED_MEMORY_H */ + +/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */ +/* #undef NEED_REENTRANT */ + +/* Define to 1 if _THREAD_SAFE preprocessor symbol must be defined. */ +/* #undef NEED_THREAD_SAFE */ + +/* cpu-machine-OS */ +#define OS "m68k-unknown-amigaos" + +/* Name of package */ +#define PACKAGE "c-ares" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "c-ares" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "c-ares 1.12.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "c-ares" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.12.0" + +/* a suitable file/device to read random data from */ +/* #undef RANDOM_FILE */ + +/* Define to the type qualifier pointed by arg 5 for recvfrom. */ +#define RECVFROM_QUAL_ARG5 + +/* Define to the type of arg 1 for recvfrom. */ +#define RECVFROM_TYPE_ARG1 int + +/* Define to the type pointed by arg 2 for recvfrom. */ +#define RECVFROM_TYPE_ARG2 void + +/* Define to 1 if the type pointed by arg 2 for recvfrom is void. */ +#define RECVFROM_TYPE_ARG2_IS_VOID 1 + +/* Define to the type of arg 3 for recvfrom. */ +#define RECVFROM_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recvfrom. */ +#define RECVFROM_TYPE_ARG4 int + +/* Define to the type pointed by arg 5 for recvfrom. */ +#define RECVFROM_TYPE_ARG5 struct sockaddr + +/* Define to 1 if the type pointed by arg 5 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG5_IS_VOID */ + +/* Define to the type pointed by arg 6 for recvfrom. */ +#define RECVFROM_TYPE_ARG6 int + +/* Define to 1 if the type pointed by arg 6 for recvfrom is void. */ +/* #undef RECVFROM_TYPE_ARG6_IS_VOID */ + +/* Define to the function return type for recvfrom. */ +#define RECVFROM_TYPE_RETV int + +/* Define to the type of arg 1 for recv. */ +#define RECV_TYPE_ARG1 int + +/* Define to the type of arg 2 for recv. */ +#define RECV_TYPE_ARG2 void * + +/* Define to the type of arg 3 for recv. */ +#define RECV_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for recv. */ +#define RECV_TYPE_ARG4 int + +/* Define to the function return type for recv. */ +#define RECV_TYPE_RETV int + +/* Define as the return type of signal handlers (`int' or `void'). */ +#define RETSIGTYPE void + +/* Define to the type qualifier of arg 2 for send. */ +#define SEND_QUAL_ARG2 const + +/* Define to the type of arg 1 for send. */ +#define SEND_TYPE_ARG1 int + +/* Define to the type of arg 2 for send. */ +#define SEND_TYPE_ARG2 void * + +/* Define to the type of arg 3 for send. */ +#define SEND_TYPE_ARG3 size_t + +/* Define to the type of arg 4 for send. */ +#define SEND_TYPE_ARG4 int + +/* Define to the function return type for send. */ +#define SEND_TYPE_RETV int + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to disable non-blocking sockets. */ +#define USE_BLOCKING_SOCKETS 1 + +/* Version number of package */ +#define VERSION "1.12.0" + +/* Define to avoid automatic inclusion of winsock.h */ +/* #undef WIN32_LEAN_AND_MEAN */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to 1 if OS is AIX. */ +#ifndef _ALL_SOURCE +/* # undef _ALL_SOURCE */ +#endif + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +# define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Type to use in place of in_addr_t when system does not provide it. */ +#define in_addr_t unsigned long + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* the signed version of size_t */ +/* #undef ssize_t */ diff --git a/ares_create_query.3 b/ares_create_query.3 index 5fd94fc..59af0f0 100644 --- a/ares_create_query.3 +++ b/ares_create_query.3 @@ -18,45 +18,39 @@ ares_create_query \- Compose a single-question DNS query buffer .SH SYNOPSIS .nf -.B #include -.PP -.B int ares_create_query(const char *\fIname\fP, int \fIdnsclass\fP,\ - int \fItype\fP, -.B unsigned short \fIid\fP, int \fIrd\fP,\ - unsigned char **\fIbuf\fP, -.B int *\fIbuflen\fP, int \fImax_udp_size\fP) +#include + +int ares_create_query(const char *\fIname\fP, + int \fIdnsclass\fP, + int \fItype\fP, + unsigned short \fIid\fP, + int \fIrd\fP, + unsigned char **\fIbuf\fP, + int *\fIbuflen\fP, + int \fImax_udp_size\fP) .fi .SH DESCRIPTION -The -.B ares_create_query -function composes a DNS query with a single question. -The parameter -.I name -gives the query name as a NUL-terminated C string of period-separated -labels optionally ending with a period; periods and backslashes within -a label must be escaped with a backlash. The parameters -.I dnsclass -and -.I type -give the class and type of the query using the values defined in -.BR . -The parameter -.I id -gives a 16-bit identifier for the query. The parameter -.I rd -should be nonzero if recursion is desired, zero if not. The query -will be placed in an allocated buffer, a pointer to which will be -stored in the variable pointed to by -.IR buf , -and the length of which will be stored in the variable pointed to by -.IR buflen . +The \fIares_create_query(3)\fP function composes a DNS query with a single +question. The parameter \fIname\fP gives the query name as a NUL-terminated C +string of period-separated labels optionally ending with a period; periods and +backslashes within a label must be escaped with a backlash. + +The parameters \fIdnsclass\fP and \fItype\fP give the class and type of the +query using the values defined in \fB\fP. + +The parameter \fIid\fP gives a 16-bit identifier for the query. + +The parameter \fIrd\fP should be nonzero if recursion is desired, zero if not. + +The query will be placed in an allocated buffer, a pointer to which will be +stored in the variable pointed to by \fIbuf\fP, and the length of which will +be stored in the variable pointed to by \fIbuflen\fP. + It is the caller's responsibility to free this buffer using -\fIares_free_string(3)\fP when it is no longer needed. -The parameter -.I max_udp_size -should be nonzero to activate EDNS. Usage of \fIares_create_query(3)\fP\ with -.I max_udp_size -set to zero is equivalent to \fIares_mkquery(3)\fP. +\fIares_free_string(3)\fP when it is no longer needed. The parameter +\fImax_udp_size\fP should be nonzero to activate EDNS. Usage of +\fIares_create_query(3)\fP\ with \fImax_udp_size\fP set to zero is equivalent +to using \fIares_mkquery(3)\fP. .SH RETURN VALUES .B ares_create_query can return any of the following values: @@ -77,5 +71,6 @@ Memory was exhausted. Added in c-ares 1.10.0 .SH SEE ALSO .BR ares_expand_name (3), -.BR ares_free_string (3) +.BR ares_free_string (3), +.BR ares_mkquery (3) .SH AUTHOR diff --git a/ares_create_query.c b/ares_create_query.c index a34dda7..7f4c52d 100644 --- a/ares_create_query.c +++ b/ares_create_query.c @@ -85,57 +85,31 @@ */ int ares_create_query(const char *name, int dnsclass, int type, - unsigned short id, int rd, unsigned char **buf, - int *buflen, int max_udp_size) + unsigned short id, int rd, unsigned char **bufp, + int *buflenp, int max_udp_size) { - int len; + size_t len; unsigned char *q; const char *p; + size_t buflen; + unsigned char *buf; /* Set our results early, in case we bail out early with an error. */ - *buflen = 0; - *buf = NULL; + *buflenp = 0; + *bufp = NULL; - /* Compute the length of the encoded name so we can check buflen. - * Start counting at 1 for the zero-length label at the end. */ - len = 1; - for (p = name; *p; p++) - { - if (*p == '\\' && *(p + 1) != 0) - p++; - len++; - } - /* If there are n periods in the name, there are n + 1 labels, and - * thus n + 1 length fields, unless the name is empty or ends with a - * period. So add 1 unless name is empty or ends with a period. + /* Allocate a memory area for the maximum size this packet might need. +2 + * is for the length byte and zero termination if no dots or ecscaping is + * used. */ - if (*name && *(p - 1) != '.') - len++; - - /* Immediately reject names that are longer than the maximum of 255 - * bytes that's specified in RFC 1035 ("To simplify implementations, - * the total length of a domain name (i.e., label octets and label - * length octets) is restricted to 255 octets or less."). We aren't - * doing this just to be a stickler about RFCs. For names that are - * too long, 'dnscache' closes its TCP connection to us immediately - * (when using TCP) and ignores the request when using UDP, and - * BIND's named returns ServFail (TCP or UDP). Sending a request - * that we know will cause 'dnscache' to close the TCP connection is - * painful, since that makes any other outstanding requests on that - * connection fail. And sending a UDP request that we know - * 'dnscache' will ignore is bad because resources will be tied up - * until we time-out the request. - */ - if (len > MAXCDNAME) - return ARES_EBADNAME; - - *buflen = len + HFIXEDSZ + QFIXEDSZ + (max_udp_size ? EDNSFIXEDSZ : 0); - *buf = ares_malloc(*buflen); - if (!*buf) - return ARES_ENOMEM; + len = strlen(name) + 2 + HFIXEDSZ + QFIXEDSZ + + (max_udp_size ? EDNSFIXEDSZ : 0); + buf = ares_malloc(len); + if (!buf) + return ARES_ENOMEM; /* Set up the header. */ - q = *buf; + q = buf; memset(q, 0, HFIXEDSZ); DNS_HEADER_SET_QID(q, id); DNS_HEADER_SET_OPCODE(q, QUERY); @@ -159,8 +133,10 @@ int ares_create_query(const char *name, int dnsclass, int type, q += HFIXEDSZ; while (*name) { - if (*name == '.') + if (*name == '.') { + free (buf); return ARES_EBADNAME; + } /* Count the number of bytes in this label. */ len = 0; @@ -170,8 +146,10 @@ int ares_create_query(const char *name, int dnsclass, int type, p++; len++; } - if (len > MAXLABEL) + if (len > MAXLABEL) { + free (buf); return ARES_EBADNAME; + } /* Encode the length and copy the data. */ *q++ = (unsigned char)len; @@ -195,14 +173,30 @@ int ares_create_query(const char *name, int dnsclass, int type, DNS_QUESTION_SET_TYPE(q, type); DNS_QUESTION_SET_CLASS(q, dnsclass); + q += QFIXEDSZ; if (max_udp_size) { - q += QFIXEDSZ; memset(q, 0, EDNSFIXEDSZ); q++; DNS_RR_SET_TYPE(q, T_OPT); DNS_RR_SET_CLASS(q, max_udp_size); + q += (EDNSFIXEDSZ-1); } + buflen = (q - buf); + + /* Reject names that are longer than the maximum of 255 bytes that's + * specified in RFC 1035 ("To simplify implementations, the total length of + * a domain name (i.e., label octets and label length octets) is restricted + * to 255 octets or less."). */ + if (buflen > (MAXCDNAME + HFIXEDSZ + QFIXEDSZ + + (max_udp_size ? EDNSFIXEDSZ : 0))) { + free (buf); + return ARES_EBADNAME; + } + + /* we know this fits in an int at this point */ + *buflenp = (int) buflen; + *bufp = buf; return ARES_SUCCESS; } diff --git a/ares_destroy.3 b/ares_destroy.3 index 3724df1..7af7fe3 100644 --- a/ares_destroy.3 +++ b/ares_destroy.3 @@ -23,18 +23,14 @@ ares_destroy \- Destroy a resolver channel .B void ares_destroy(ares_channel \fIchannel\fP) .fi .SH DESCRIPTION -The -.B ares_destroy -function destroys the name service channel identified by -.IR channel , -freeing all memory and closing all sockets used by the channel. -.B ares_destroy -invokes the callbacks for each pending query on the channel, passing a -status of -.BR ARES_EDESTRUCTION . -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. +The \fBares_destroy(3)\fP function destroys the name service channel +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 +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 .BR ares_init (3), .BR ares_cancel (3) diff --git a/ares_destroy_options.3 b/ares_destroy_options.3 index 3e564b2..31e346b 100644 --- a/ares_destroy_options.3 +++ b/ares_destroy_options.3 @@ -23,12 +23,9 @@ ares_destroy_options \- Destroy options initialized with ares_save_options .B void ares_destroy_options(struct ares_options *\fIoptions\fP) .fi .SH DESCRIPTION -The -.B ares_destroy_options -function destroys the options struct identified by -.IR options , -freeing all memory allocated by ares_save_options. - +The \fBares_destroy_options(3)\fP function destroys the options struct +identified by \Ioptions\fP, freeing all memory allocated by +\fBares_save_options(3)\fP. .SH SEE ALSO .BR ares_save_options (3), .BR ares_init_options (3) diff --git a/ares_dns.h b/ares_dns.h index 374954d..70fac61 100644 --- a/ares_dns.h +++ b/ares_dns.h @@ -45,18 +45,15 @@ ((p)[3] = (unsigned char)((v) & 0xff))) #endif - #if 0 /* we cannot use this approach on systems where we can't access 16/32 bit data on un-aligned addresses */ -// align recieve buffer with memcpy instead #define DNS__16BIT(p) ntohs(*(unsigned short*)(p)) #define DNS__32BIT(p) ntohl(*(unsigned long*)(p)) #define DNS__SET16BIT(p, v) *(unsigned short*)(p) = htons(v) #define DNS__SET32BIT(p, v) *(unsigned long*)(p) = htonl(v) #endif - /* use use this approach on systems where we can't access 16/32 bit data on un-aligned addresses */ #ifdef ARES_BIG_ENDIAN @@ -71,7 +68,6 @@ #define DNS__SET32BIT(p, v) le32enc #endif - /* Macros for parsing a DNS header */ #define DNS_HEADER_QID(h) DNS__16BIT(h) #define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1) diff --git a/ares_dup.3 b/ares_dup.3 index 87bf209..e64c104 100644 --- a/ares_dup.3 +++ b/ares_dup.3 @@ -33,7 +33,7 @@ handle when the channel is no longer needed. .BR ares_init(3), .BR ares_library_init(3) .SH AVAILABILITY -ares_dup(3) was added in c-ares 1.6.0 +\fIares_dup(3)\fP was added in c-ares 1.6.0 .SH AUTHOR Daniel Stenberg diff --git a/ares_free_string.3 b/ares_free_string.3 index 55af7d2..61d88aa 100644 --- a/ares_free_string.3 +++ b/ares_free_string.3 @@ -23,9 +23,8 @@ ares_free_string \- Free strings allocated by ares functions .B void ares_free_string(void *\fIstr\fP) .fi .SH DESCRIPTION -The -.I ares_free_string -function frees a string allocated by an ares function. +The \fIares_free_string(3)\fP function frees a string allocated by an ares +function. .SH SEE ALSO .BR ares_mkquery (3) .BR ares_expand_string (3) diff --git a/ares_getnameinfo.c b/ares_getnameinfo.c index d5571a7..4516112 100644 --- a/ares_getnameinfo.c +++ b/ares_getnameinfo.c @@ -299,6 +299,7 @@ static char *lookup_service(unsigned short port, int flags, else proto = "tcp"; #ifdef HAVE_GETSERVBYPORT_R + memset(&se, 0, sizeof(se)); sep = &se; memset(tmpbuf, 0, sizeof(tmpbuf)); #if GETSERVBYPORT_R_ARGS == 6 diff --git a/ares_init.3 b/ares_init.3 index c3e40cf..0baf4b7 100644 --- a/ares_init.3 +++ b/ares_init.3 @@ -16,167 +16,24 @@ .\" .TH ARES_INIT 3 "5 March 2010" .SH NAME -ares_init, ares_init_options \- Initialize a resolver channel +ares_init \- Initialize a resolver channel .SH SYNOPSIS .nf -.B #include -.PP -.B int ares_init(ares_channel *\fIchannelptr\fP) -.B int ares_init_options(ares_channel *\fIchannelptr\fP, -.B struct ares_options *\fIoptions\fP, int \fIoptmask\fP) -.PP -.B cc file.c -lcares +#include + +int ares_init(ares_channel *\fIchannelptr\fP) .fi .SH DESCRIPTION -The \fBares_init\fP function initializes a communications channel for name -service lookups. If it returns successfully, \fBares_init\fP will set the +The \fBares_init(3)\fP function initializes a communications channel for name +service lookups. If it returns successfully, \fBares_init(3)\fP will set the variable pointed to by \fIchannelptr\fP to a handle used to identify the name -service channel. The caller should invoke -.BR ares_destroy (3) -on the handle when the channel is no longer needed. -.PP -The \fBares_init_options\fP function also initializes a name service channel, -with additional options useful for applications requiring more control over -name service configuration. The \fIoptmask\fP parameter specifies which fields -in the structure pointed to by \fIoptions\fP are set, as follows: -.TP 18 -.B ARES_OPT_FLAGS -.B int \fIflags\fP; -.br -Flags controlling the behavior of the resolver. See below for a -description of possible flag values. -.TP 18 -.B ARES_OPT_TIMEOUT -.B int \fItimeout\fP; -.br -The number of seconds each name server is given to respond to a query on the -first try. (After the first try, the timeout algorithm becomes more -complicated, but scales linearly with the value of \fItimeout\fP.) The -default is five seconds. This option is being deprecated by -\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2. -.TP 18 -.B ARES_OPT_TIMEOUTMS -.B int \fItimeout\fP; -.br -The number of milliseconds each name server is given to respond to a query on -the first try. (After the first try, the timeout algorithm becomes more -complicated, but scales linearly with the value of \fItimeout\fP.) The -default is five seconds. Note that this option is specified with the same -struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits -that tell c-ares how to interpret the number. This option was added in c-ares -1.5.2. -.TP 18 -.B ARES_OPT_TRIES -.B int \fItries\fP; -.br -The number of tries the resolver will try contacting each name server -before giving up. The default is four tries. -.TP 18 -.B ARES_OPT_NDOTS -.B int \fIndots\fP; -.br -The number of dots which must be present in a domain name for it to be -queried for "as is" prior to querying for it with the default domain -extensions appended. The default value is 1 unless set otherwise by -resolv.conf or the RES_OPTIONS environment variable. -.TP 18 -.B ARES_OPT_PORT -.B unsigned short \fIport\fP; -.br -The port to use for queries (both TCP and UDP), in network byte order. -The default value is 53 (in network byte order), the standard name -service port. -.TP 18 -.B ARES_OPT_SERVERS -.B struct in_addr *\fIservers\fP; -.br -.B int \fInservers\fP; -.br -The list of IPv4 servers to contact, instead of the servers specified in -resolv.conf or the local named. In order to allow specification of either -IPv4 or IPv6 name servers, the -.BR ares_set_servers(3) -function must be used instead. -.TP 18 -.B ARES_OPT_DOMAINS -.B char **\fIdomains\fP; -.br -.B int \fIndomains\fP; -.br -The domains to search, instead of the domains specified in resolv.conf -or the domain derived from the kernel hostname variable. -.TP 18 -.B ARES_OPT_LOOKUPS -.B char *\fIlookups\fP; -.br -The lookups to perform for host queries. -.I lookups -should be set to a string of the characters "b" or "f", where "b" -indicates a DNS lookup and "f" indicates a lookup in the hosts file. -.TP 18 -.B ARES_OPT_SOCK_STATE_CB -.B void (*\fIsock_state_cb\fP)(void *data, int s, int read, int write); -.br -.B void *\fIsock_state_cb_data\fP; -.br -A callback function to be invoked when a socket changes state. -.I s -will be passed the socket whose state has changed; -.I read -will be set to true if the socket should listen for read events, and -.I write -will be set to true if the socket should listen for write events. -The value of -.I sock_state_cb_data -will be passed as the -.I data -argument. -.PP -The -.I flags -field should be the bitwise or of some subset of the following values: -.TP 23 -.B ARES_FLAG_USEVC -Always use TCP queries (the "virtual circuit") instead of UDP -queries. Normally, TCP is only used if a UDP query yields a truncated -result. -.TP 23 -.B ARES_FLAG_PRIMARY -Only query the first server in the list of servers to query. -.TP 23 -.B ARES_FLAG_IGNTC -If a truncated response to a UDP query is received, do not fall back -to TCP; simply continue on with the truncated response. -.TP 23 -.B ARES_FLAG_NORECURSE -Do not set the "recursion desired" bit on outgoing queries, so that the name -server being contacted will not try to fetch the answer from other servers if -it doesn't know the answer locally. Be aware that ares will not do the -recursion for you. Recursion must be handled by the application calling ares -if \fIARES_FLAG_NORECURSE\fP is set. -.TP 23 -.B ARES_FLAG_STAYOPEN -Do not close communications sockets when the number of active queries -drops to zero. -.TP 23 -.B ARES_FLAG_NOSEARCH -Do not use the default search domains; only query hostnames as-is or -as aliases. -.TP 23 -.B ARES_FLAG_NOALIASES -Do not honor the HOSTALIASES environment variable, which normally -specifies a file of hostname translations. -.TP 23 -.B ARES_FLAG_NOCHECKRESP -Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED -response code or responses whose questions don't match the questions -in the request. Primarily useful for writing clients which might be -used to test or debug name servers. +service channel. The caller should invoke \fIares_destroy(3)\fP on the handle +when the channel is no longer needed. + +The \fIares_init_options(3)\fP function is provide to offer more init +alternatives. .SH RETURN VALUES -.I ares_init -or -.I ares_init_options -can return any of the following values: +\fIares_init(3)\fP can return any of the following values: .TP 14 .B ARES_SUCCESS Initialization succeeded. @@ -211,6 +68,7 @@ please see the .BR resolv.conf (5) manual page. .SH SEE ALSO +.BR ares_init_options(3), .BR ares_destroy(3), .BR ares_dup(3), .BR ares_library_init(3), diff --git a/ares_init.c b/ares_init.c index 47180cd..50bd93a 100644 --- a/ares_init.c +++ b/ares_init.c @@ -112,7 +112,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ares_channel channel; int i; int status = ARES_SUCCESS; - int status2; struct timeval now; #ifdef CURLDEBUG @@ -190,18 +189,17 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, * precedence to lowest. */ - if (status == ARES_SUCCESS) { - status = init_by_options(channel, options, optmask); - if (status != ARES_SUCCESS) - DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", - ares_strerror(status))); - } - if (status == ARES_SUCCESS) { - status = init_by_environment(channel); - if (status != ARES_SUCCESS) - DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", - ares_strerror(status))); + status = init_by_options(channel, options, optmask); + if (status != ARES_SUCCESS) { + DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", + ares_strerror(status))); + /* If we fail to apply user-specified options, fail the whole init process */ + goto done; } + status = init_by_environment(channel); + if (status != ARES_SUCCESS) + DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", + ares_strerror(status))); if (status == ARES_SUCCESS) { status = init_by_resolv_conf(channel); if (status != ARES_SUCCESS) @@ -213,13 +211,10 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, * No matter what failed or succeeded, seed defaults to provide * useful behavior for things that we missed. */ - status2 = init_by_defaults(channel); - if (status2 != ARES_SUCCESS) { + status = init_by_defaults(channel); + if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", ares_strerror(status))); - if (status == ARES_SUCCESS) - status = status2; - } /* Generate random key */ @@ -232,6 +227,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, ares_strerror(status))); } +done: if (status != ARES_SUCCESS) { /* Something failed; clean up memory we may have allocated. */ @@ -350,8 +346,8 @@ int ares_save_options(ares_channel channel, struct ares_options *options, (*optmask) = (ARES_OPT_FLAGS|ARES_OPT_TRIES|ARES_OPT_NDOTS| ARES_OPT_UDP_PORT|ARES_OPT_TCP_PORT|ARES_OPT_SOCK_STATE_CB| ARES_OPT_SERVERS|ARES_OPT_DOMAINS|ARES_OPT_LOOKUPS| - ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS) | - (channel->optmask & ARES_OPT_ROTATE); + ARES_OPT_SORTLIST|ARES_OPT_TIMEOUTMS); + (*optmask) |= (channel->rotate ? ARES_OPT_ROTATE : ARES_OPT_NOROTATE); /* Copy easy stuff */ options->flags = channel->flags; @@ -447,6 +443,8 @@ static int init_by_options(ares_channel channel, channel->ndots = options->ndots; if ((optmask & ARES_OPT_ROTATE) && channel->rotate == -1) channel->rotate = 1; + if ((optmask & ARES_OPT_NOROTATE) && channel->rotate == -1) + channel->rotate = 0; if ((optmask & ARES_OPT_UDP_PORT) && channel->udp_port == -1) channel->udp_port = htons(options->udp_port); if ((optmask & ARES_OPT_TCP_PORT) && channel->tcp_port == -1) @@ -520,13 +518,14 @@ static int init_by_options(ares_channel channel, } /* copy sortlist */ - if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1) && - (options->nsort>0)) { - channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern)); - if (!channel->sortlist) - return ARES_ENOMEM; - for (i = 0; i < options->nsort; i++) - channel->sortlist[i] = options->sortlist[i]; + if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1)) { + if (options->nsort > 0) { + channel->sortlist = ares_malloc(options->nsort * sizeof(struct apattern)); + if (!channel->sortlist) + return ARES_ENOMEM; + for (i = 0; i < options->nsort; i++) + channel->sortlist[i] = options->sortlist[i]; + } channel->nsort = options->nsort; } @@ -1625,7 +1624,7 @@ static int config_lookup(ares_channel channel, const char *str, channel->lookups = ares_strdup(lookups); return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; } -#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ */ +#endif /* !WIN32 & !WATT32 & !ANDROID & !__ANDROID__ & !CARES_USE_LIBRESOLV */ #ifndef WATT32 static int config_nameserver(struct server_state **servers, int *nservers, diff --git a/ares_init_options.3 b/ares_init_options.3 index 27b149b..ff677c9 100644 --- a/ares_init_options.3 +++ b/ares_init_options.3 @@ -1 +1,262 @@ -.so man3/ares_init.3 +.\" +.\" Copyright 1998 by the Massachusetts Institute of Technology. +.\" Copyright (C) 2004-2010 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_INIT 3 "5 March 2010" +.SH NAME +ares_init_options \- Initialize a resolver channel +.SH SYNOPSIS +.nf +#include + +int ares_init_options(ares_channel *\fIchannelptr\fP, + struct ares_options *\fIoptions\fP, + int \fIoptmask\fP) +.fi +.SH DESCRIPTION +The \fBares_init_options(3)\fP function initializes a communications channel +for name service lookups. If it returns successfully, +\fBares_init_options(3)\fP will set the variable pointed to by +\fIchannelptr\fP to a handle used to identify the name service channel. The +caller should invoke \fIares_destroy(3)\fP on the handle when the channel is +no longer needed. + +The \fIoptmask\fP parameter generally specifies which fields in the structure pointed to +by \fIoptions\fP are set, as follows: +.TP 18 +.B ARES_OPT_FLAGS +.B int \fIflags\fP; +.br +Flags controlling the behavior of the resolver. See below for a +description of possible flag values. +.TP 18 +.B ARES_OPT_TIMEOUT +.B int \fItimeout\fP; +.br +The number of seconds each name server is given to respond to a query on the +first try. (After the first try, the timeout algorithm becomes more +complicated, but scales linearly with the value of \fItimeout\fP.) The +default is five seconds. This option is being deprecated by +\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2. +.TP 18 +.B ARES_OPT_TIMEOUTMS +.B int \fItimeout\fP; +.br +The number of milliseconds each name server is given to respond to a query on +the first try. (After the first try, the timeout algorithm becomes more +complicated, but scales linearly with the value of \fItimeout\fP.) The +default is five seconds. Note that this option is specified with the same +struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits +that tell c-ares how to interpret the number. This option was added in c-ares +1.5.2. +.TP 18 +.B ARES_OPT_TRIES +.B int \fItries\fP; +.br +The number of tries the resolver will try contacting each name server +before giving up. The default is four tries. +.TP 18 +.B ARES_OPT_NDOTS +.B int \fIndots\fP; +.br +The number of dots which must be present in a domain name for it to be +queried for "as is" prior to querying for it with the default domain +extensions appended. The default value is 1 unless set otherwise by +resolv.conf or the RES_OPTIONS environment variable. +.TP 18 +.B ARES_OPT_UDP_PORT +.B unsigned short \fIudp_port\fP; +.br +The port to use for queries over UDP, in network byte order. +The default value is 53 (in network byte order), the standard name +service port. +.TP 18 +.B ARES_OPT_TCP_PORT +.B unsigned short \fItcp_port\fP; +.br +The port to use for queries over TCP, in network byte order. +The default value is 53 (in network byte order), the standard name +service port. +.TP 18 +.B ARES_OPT_SERVERS +.B struct in_addr *\fIservers\fP; +.br +.B int \fInservers\fP; +.br +The list of IPv4 servers to contact, instead of the servers specified in +resolv.conf or the local named. In order to allow specification of either +IPv4 or IPv6 name servers, the +.BR ares_set_servers(3) +function must be used instead. +.TP 18 +.B ARES_OPT_DOMAINS +.B char **\fIdomains\fP; +.br +.B int \fIndomains\fP; +.br +The domains to search, instead of the domains specified in resolv.conf +or the domain derived from the kernel hostname variable. +.TP 18 +.B ARES_OPT_LOOKUPS +.B char *\fIlookups\fP; +.br +The lookups to perform for host queries. +.I lookups +should be set to a string of the characters "b" or "f", where "b" +indicates a DNS lookup and "f" indicates a lookup in the hosts file. +.TP 18 +.B ARES_OPT_SOCK_STATE_CB +.B void (*\fIsock_state_cb\fP)(void *data, int s, int read, int write); +.br +.B void *\fIsock_state_cb_data\fP; +.br +A callback function to be invoked when a socket changes state. +.I s +will be passed the socket whose state has changed; +.I read +will be set to true if the socket should listen for read events, and +.I write +will be set to true if the socket should listen for write events. +The value of +.I sock_state_cb_data +will be passed as the +.I data +argument. +.TP 18 +.B ARES_OPT_SORTLIST +.B struct apattern *\fIsortlist\fP; +.br +.B int \fInsort\fP; +.br +A list of IP address ranges that specifies the order of preference that +results from \fIares_gethostbyname\fP should be returned in. Note that +this can only be used with a sortlist retrieved via +\fBares_save_options(3)\fP (because +.B struct apattern +is opaque); to set a fresh sort list, use \fBares_set_sortlist(3)\fP. +.TP 18 +.B ARES_OPT_SOCK_SNDBUF +.B int \fIsocket_send_buffer_size\fP; +.br +The send buffer size to set for the socket. +.TP 18 +.B ARES_OPT_SOCK_RCVBUF +.B int \fIsocket_receive_buffer_size\fP; +.br +The receive buffer size to set for the socket. +.TP 18 +.B ARES_OPT_EDNSPSZ +.B int \fIednspsz\fP; +.br +The message size to be advertized in EDNS; only takes effect if the +.B ARES_FLAG_EDNS +flag is set. +.br +.PP +The \fIoptmask\fP parameter also includes options without a corresponding +field in the +.B ares_options +structure, as follows: +.TP 23 +.B ARES_OPT_ROTATE +Perform round-robin selection of the nameservers configured for the channel +for each resolution. +.TP 23 +.B ARES_OPT_NOROTATE +Do not perform round-robin nameserver selection; always use the list of +nameservers in the same order. +.PP +The +.I flags +field should be the bitwise or of some subset of the following values: +.TP 23 +.B ARES_FLAG_USEVC +Always use TCP queries (the "virtual circuit") instead of UDP +queries. Normally, TCP is only used if a UDP query yields a truncated +result. +.TP 23 +.B ARES_FLAG_PRIMARY +Only query the first server in the list of servers to query. +.TP 23 +.B ARES_FLAG_IGNTC +If a truncated response to a UDP query is received, do not fall back +to TCP; simply continue on with the truncated response. +.TP 23 +.B ARES_FLAG_NORECURSE +Do not set the "recursion desired" bit on outgoing queries, so that the name +server being contacted will not try to fetch the answer from other servers if +it doesn't know the answer locally. Be aware that ares will not do the +recursion for you. Recursion must be handled by the application calling ares +if \fIARES_FLAG_NORECURSE\fP is set. +.TP 23 +.B ARES_FLAG_STAYOPEN +Do not close communications sockets when the number of active queries +drops to zero. +.TP 23 +.B ARES_FLAG_NOSEARCH +Do not use the default search domains; only query hostnames as-is or +as aliases. +.TP 23 +.B ARES_FLAG_NOALIASES +Do not honor the HOSTALIASES environment variable, which normally +specifies a file of hostname translations. +.TP 23 +.B ARES_FLAG_NOCHECKRESP +Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED +response code or responses whose questions don't match the questions +in the request. Primarily useful for writing clients which might be +used to test or debug name servers. +.TP 23 +.B ARES_FLAG_EDNS +Include an EDNS pseudo-resource record (RFC 2671) in generated requests. +.SH RETURN VALUES +\fBares_init_options(3)\fP can return any of the following values: +.TP 14 +.B ARES_SUCCESS +Initialization succeeded. +.TP 14 +.B ARES_EFILE +A configuration file could not be read. +.TP 14 +.B ARES_ENOMEM +The process's available memory was exhausted. +.TP 14 +.B ARES_ENOTINITIALIZED +c-ares library initialization not yet performed. +.SH NOTES +When initializing from +.B /etc/resolv.conf, +\fBares_init_options(3)\fP reads the \fIdomain\fP and \fIsearch\fP directives +to allow lookups of short names relative to the domains specified. The +\fIdomain\fP and \fIsearch\fP directives override one another. If more that +one instance of either \fIdomain\fP or \fIsearch\fP directives is specified, +the last occurrence wins. For more information, please see the +.BR resolv.conf (5) +manual page. +.SH SEE ALSO +.BR ares_init(3), +.BR ares_destroy(3), +.BR ares_dup(3), +.BR ares_library_init(3), +.BR ares_save_options(3), +.BR ares_set_servers(3), +.BR ares_set_sortlist(3) +.SH AUTHOR +Greg Hudson, MIT Information Systems +.br +Copyright 1998 by the Massachusetts Institute of Technology. +.br +Copyright (C) 2004-2010 by Daniel Stenberg. + diff --git a/ares_ipv6.h b/ares_ipv6.h index 1830076..b0017f1 100644 --- a/ares_ipv6.h +++ b/ares_ipv6.h @@ -47,16 +47,16 @@ struct addrinfo #endif #ifndef NS_IN6ADDRSZ -#if SIZEOF_STRUCT_IN6_ADDR == 0 +#ifndef HAVE_STRUCT_IN6_ADDR /* We cannot have it set to zero, so we pick a fixed value here */ #define NS_IN6ADDRSZ 16 #else -#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR +#define NS_IN6ADDRSZ sizeof(struct in6_addr) #endif #endif #ifndef NS_INADDRSZ -#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR +#define NS_INADDRSZ sizeof(struct in_addr) #endif #ifndef NS_INT16SZ diff --git a/ares_library_init.3 b/ares_library_init.3 index 8959a80..4734f92 100644 --- a/ares_library_init.3 +++ b/ares_library_init.3 @@ -19,12 +19,14 @@ ares_library_init \- c-ares library initialization .SH SYNOPSIS .nf -.B #include -.PP -.B int ares_library_init(int \fIflags\fP) -.B int ares_library_init_mem(int \fIflags\fP, void *(*\fIamalloc\fP)(size_t), void (*\fIafree\fP)(void *)) -.PP -.B cc file.c -lcares +#include + +int ares_library_init(int \fIflags\fP) + +int ares_library_init_mem(int \fIflags\fP, + void *(*\fIamalloc\fP)(size_t), + void (*\fIafree\fP)(void *ptr), + void (*\fIarealloc\fP)(void *ptr, size_t size)) .fi .SH DESCRIPTION .PP @@ -54,9 +56,9 @@ familiar with it and trying to control some internal c-ares feature. .PP The .B ares_library_init_mem -function allows the caller to provide memory management -functions that the c-ares library will be use instead of \fImalloc(3)\fP and -\fIfree(3)\fP. +function allows the caller to provide memory management functions that the +c-ares library will be use instead of \fImalloc(3)\fP, \fIfree(3)\fP and +\fIrealloc(3)\fP. .PP .B This function is not thread safe. You have to call it once the program has started, but this call must be done diff --git a/ares_library_init.c b/ares_library_init.c index 964a02a..9b3d2ab 100644 --- a/ares_library_init.c +++ b/ares_library_init.c @@ -111,7 +111,14 @@ int ares_library_init(int flags) return ARES_SUCCESS; } ares_initialized++; - + + if (flags & ARES_LIB_INIT_AMIGA) + { + res = ares_amiga_init(); + if (res != ARES_SUCCESS) + return res; + } + if (flags & ARES_LIB_INIT_WIN32) { res = ares_win32_init(); @@ -119,13 +126,6 @@ int ares_library_init(int flags) return res; /* LCOV_EXCL_LINE: can't test Win32 init failure */ } - if (flags & ARES_LIB_INIT_AMIGA) - { - res = ares_amiga_init(); - if (res != ARES_SUCCESS) - return res; - } - ares_init_flags = flags; return ARES_SUCCESS; @@ -157,11 +157,12 @@ void ares_library_cleanup(void) if (ares_init_flags & ARES_LIB_INIT_WIN32) ares_win32_cleanup(); - if (ares_init_flags & ARES_LIB_INIT_WIN32) + if (ares_init_flags & ARES_LIB_INIT_AMIGA) ares_amiga_cleanup(); ares_init_flags = ARES_LIB_INIT_NONE; ares_malloc = malloc; + ares_realloc = realloc; ares_free = free; } @@ -178,5 +179,3 @@ int ares_library_initialized(void) #endif return ARES_SUCCESS; } - - diff --git a/ares_nowarn.c b/ares_nowarn.c index d4bd272..7f9035c 100644 --- a/ares_nowarn.c +++ b/ares_nowarn.c @@ -40,42 +40,22 @@ #include "ares_nowarn.h" -#if (SIZEOF_SHORT == 2) +#ifndef HAVE_LIMITS_H +/* systems without we guess have 16 bit shorts, 32bit ints and + 32bit longs */ # define CARES_MASK_SSHORT 0x7FFF # define CARES_MASK_USHORT 0xFFFF -#elif (SIZEOF_SHORT == 4) -# define CARES_MASK_SSHORT 0x7FFFFFFF -# define CARES_MASK_USHORT 0xFFFFFFFF -#elif (SIZEOF_SHORT == 8) -# define CARES_MASK_SSHORT 0x7FFFFFFFFFFFFFFF -# define CARES_MASK_USHORT 0xFFFFFFFFFFFFFFFF +# define CARES_MASK_SINT 0x7FFFFFFF +# define CARES_MASK_UINT 0xFFFFFFFF +# define CARES_MASK_SLONG 0x7FFFFFFFL +# define CARES_MASK_ULONG 0xFFFFFFFFUL #else -# error "SIZEOF_SHORT not defined" -#endif - -#if (SIZEOF_INT == 2) -# define CARES_MASK_SINT 0x7FFF -# define CARES_MASK_UINT 0xFFFF -#elif (SIZEOF_INT == 4) -# define CARES_MASK_SINT 0x7FFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFF -#elif (SIZEOF_INT == 8) -# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF -#elif (SIZEOF_INT == 16) -# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -#else -# error "SIZEOF_INT not defined" -#endif - -#ifndef HAVE_LIMITS_H -/* systems without we guess have 32 bit longs */ -#define CARES_MASK_SLONG 0x7FFFFFFFL -#define CARES_MASK_ULONG 0xFFFFFFFFUL -#else -#define CARES_MASK_ULONG ULONG_MAX -#define CARES_MASK_SLONG LONG_MAX +# define CARES_MASK_SSHORT SHRT_MAX +# define CARES_MASK_USHORT USHRT_MAX +# define CARES_MASK_SINT INT_MAX +# define CARES_MASK_UINT UINT_MAX +# define CARES_MASK_SLONG LONG_MAX +# define CARES_MASK_ULONG ULONG_MAX #endif /* diff --git a/ares_process.c b/ares_process.c index edfb9cb..20604a2 100644 --- a/ares_process.c +++ b/ares_process.c @@ -391,8 +391,7 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, */ process_answer(channel, server->tcp_buffer, server->tcp_length, i, 1, now); - if (server->tcp_buffer) - ares_free(server->tcp_buffer); + ares_free(server->tcp_buffer); server->tcp_buffer = NULL; server->tcp_lenbuf_pos = 0; server->tcp_buffer_pos = 0; diff --git a/ares_rules.h b/ares_rules.h index 44f08f8..e617fdc 100644 --- a/ares_rules.h +++ b/ares_rules.h @@ -73,11 +73,6 @@ Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing #endif -#ifndef CARES_SIZEOF_ARES_SOCKLEN_T -# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!" - Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing -#endif - /* * Macros private to this header file. */ @@ -94,7 +89,7 @@ typedef char __cares_rule_02__ - [CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)]; + [CareschkszEQ(ares_socklen_t, sizeof(CARES_TYPEOF_ARES_SOCKLEN_T))]; /* * Verify at compile time that the size of ares_socklen_t as reported diff --git a/ares_setup.h b/ares_setup.h index 30863ba..b394431 100644 --- a/ares_setup.h +++ b/ares_setup.h @@ -28,16 +28,6 @@ * configuration file for platforms which lack config tool. */ -/* amiga */ -#ifdef AOS3 -#include -#include -int ares_amiga_init(void); -void ares_amiga_cleanup(void); -extern struct Library *SocketBase; -extern char *prog; -#endif - #ifdef HAVE_CONFIG_H #include "ares_config.h" #else @@ -48,6 +38,10 @@ extern char *prog; #endif /* HAVE_CONFIG_H */ +#ifdef AMIGA +#include "config-amiga.h" +#endif + /* ================================================================ */ /* Definition of preprocessor macros/symbols which modify compiler */ /* behaviour or generated code characteristics must be done here, */ diff --git a/ares_version.h b/ares_version.h index d0050cf..92c8584 100644 --- a/ares_version.h +++ b/ares_version.h @@ -6,12 +6,12 @@ #define ARES_COPYRIGHT "2004 - 2016 Daniel Stenberg, ." #define ARES_VERSION_MAJOR 1 -#define ARES_VERSION_MINOR 11 -#define ARES_VERSION_PATCH 1 +#define ARES_VERSION_MINOR 12 +#define ARES_VERSION_PATCH 0 #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ (ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_PATCH)) -#define ARES_VERSION_STR "1.11.1-DEV" +#define ARES_VERSION_STR "1.12.0" #if (ARES_VERSION >= 0x010700) # define CARES_HAVE_ARES_LIBRARY_INIT 1 diff --git a/buildconf b/buildconf old mode 100755 new mode 100644 diff --git a/c-ares-src.readme b/c-ares-src.readme new file mode 100644 index 0000000..3bb5345 --- /dev/null +++ b/c-ares-src.readme @@ -0,0 +1,30 @@ +Short: Asynchronous DNS resolver library (src) +Author: Daniel Stenberg, Greg Hudson and others +Uploader: Carsten Larsen (carsten larsen mail com) +Type: dev/gcc +Version: 1.12.0 +Architecture: generic +URL: http://c-ares.haxx.se/ + + +ABOUT + + Source code for c-ares asynchronous resolver library. + +DESCRIPTION + + c-ares is an asynchronous resolver library. It is intended for + applications which need to perform DNS queries without blocking, + or need to perform multiple DNS queries in parallel. + + The primary examples of such applications are servers which communicate + with multiple clients and programs with graphical user interfaces. + +BUGS + + If you find bugs, correct flaws, have questions or have comments in general + in regard to c-ares (or by all means the original ares too), get in touch + with us on the c-ares mailing list. + + c-ares is of course distributed under the same MIT-style license as the + original ares. diff --git a/cares.rc b/cares.rc index 50a5e8e..76ec06c 100644 --- a/cares.rc +++ b/cares.rc @@ -1,5 +1,5 @@ -/* Copyright (C) 2009 by Daniel Stenberg +/* Copyright (C) 2009-2016 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without @@ -39,7 +39,7 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "CompanyName", "The c-ares library, http://c-ares.haxx.se/\0" + VALUE "CompanyName", "The c-ares library, https://c-ares.haxx.se/\0" #if defined(DEBUGBUILD) || defined(_DEBUG) VALUE "FileDescription", "c-ares Debug Shared Library\0" VALUE "FileVersion", ARES_VERSION_STR "\0" @@ -54,7 +54,7 @@ BEGIN VALUE "ProductName", "The c-ares library\0" VALUE "ProductVersion", ARES_VERSION_STR "\0" VALUE "LegalCopyright", "© " ARES_COPYRIGHT "\0" - VALUE "License", "http://c-ares.haxx.se/license.html\0" + VALUE "License", "https://c-ares.haxx.se/license.html\0" END END diff --git a/config-amiga.h b/config-amiga.h new file mode 100644 index 0000000..dc44d9d --- /dev/null +++ b/config-amiga.h @@ -0,0 +1,14 @@ +#ifndef HEADER_CARES_CONFIG_AMIGA_H +#define HEADER_CARES_CONFIG_AMIGA_H + +#ifdef AOS3 +#include +#include +#define ANSI_CONSOLE +int ares_amiga_init(void); +void ares_amiga_cleanup(void); +extern struct Library *SocketBase; +extern char *prog; +#endif + +#endif diff --git a/config-dos.h b/config-dos.h index f80ca2c..b895987 100644 --- a/config-dos.h +++ b/config-dos.h @@ -32,9 +32,6 @@ #define NEED_MALLOC_H 1 #define RETSIGTYPE void -#define SIZEOF_INT 4 -#define SIZEOF_SHORT 2 -#define SIZEOF_SIZE_T 4 #define TIME_WITH_SYS_TIME 1 /* Qualifiers for send(), recv(), recvfrom() and getnameinfo(). */ diff --git a/config-win32.h b/config-win32.h index 374cd9a..dd95525 100644 --- a/config-win32.h +++ b/config-win32.h @@ -234,19 +234,6 @@ /* TYPE SIZES */ /* ---------------------------------------------------------------- */ -/* Define to the size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* Define to the size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* Define to the size of `size_t', as computed by sizeof. */ -#if defined(_WIN64) -# define SIZEOF_SIZE_T 8 -#else -# define SIZEOF_SIZE_T 4 -#endif - /* ---------------------------------------------------------------- */ /* STRUCT RELATED */ /* ---------------------------------------------------------------- */ diff --git a/configure.ac b/configure.ac index b21bddb..b89ce35 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_PREREQ(2.57) dnl Version not hardcoded here. Fetched later from ares_version.h -AC_INIT([c-ares], [-], +AC_INIT([c-ares], [1.12.0], [c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares]) XC_OVR_ZZ50 @@ -82,6 +82,7 @@ dnl Get system canonical name AC_DEFINE_UNQUOTED(OS, "${host}", [cpu-machine-OS]) XC_CHECK_PROG_CC +AX_CXX_COMPILE_STDCXX_11([noext],[optional]) XC_AUTOMAKE @@ -481,12 +482,6 @@ AC_TYPE_SIZE_T AC_HEADER_TIME CURL_CHECK_STRUCT_TIMEVAL -AC_CHECK_SIZEOF(size_t) -AC_CHECK_SIZEOF(long) -AC_CHECK_SIZEOF(int) -AC_CHECK_SIZEOF(short) -AC_CHECK_SIZEOF(time_t) - AC_CHECK_TYPE(long long, [AC_DEFINE(HAVE_LONGLONG, 1, [Define to 1 if the compiler supports the 'long long' data type.])] @@ -759,63 +754,6 @@ AC_CHECK_FUNCS([bitncmp \ ]) -AC_CHECK_SIZEOF(struct in6_addr, , -[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#endif -] -) - -AC_CHECK_SIZEOF(struct in_addr, , -[ -#undef inline -#ifdef HAVE_WINDOWS_H -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#ifdef HAVE_WINSOCK2_H -#include -#ifdef HAVE_WS2TCPIP_H -#include -#endif -#endif -#else -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#endif -] -) - - dnl Check if the getnameinfo function is available dnl and get the types of five of its arguments. CURL_CHECK_FUNC_GETNAMEINFO @@ -877,28 +815,30 @@ squeeze CARES_PRIVATE_LIBS XC_CHECK_BUILD_FLAGS -BUILDTESTS="yes" -AC_MSG_CHECKING([whether to build the tests]) +AC_MSG_CHECKING([whether to build tests]) AC_ARG_ENABLE(tests, -AC_HELP_STRING([--disable-tests],[skip building the tests]), -[ case "$enableval" in - no) - BUILDTESTS="no" - AC_MSG_RESULT(no) - ;; - yes) - AC_MSG_RESULT(yes) - ;; - *) AC_MSG_RESULT(yes) - ;; - esac ], - AC_MSG_RESULT(yes) + AC_HELP_STRING([--enable-tests], [build test suite]), + [ build_tests="$enableval" ], + [ if test "x$HAVE_CXX11" = "x1" && test "x$cross_compiling" = "xno" ; then + build_tests="yes" + else + build_tests="no" + fi + ] ) -if test "$BUILDTESTS" = "yes"; then - if test "x$cross_compiling" = "xno"; then - AC_CONFIG_SUBDIRS([test]) - fi +if test "x$build_tests" = "xyes" ; then + if test "x$HAVE_CXX11" = "0" ; then + AC_MSG_ERROR([*** Building tests requires a CXX11 compiler]) + fi + if test "x$cross_compiling" = "xyes" ; then + AC_MSG_ERROR([*** Tests not supported when cross compiling]) + fi +fi +AC_MSG_RESULT([$build_tests]) + +if test "x$build_tests" = "xyes" ; then + AC_CONFIG_SUBDIRS([test]) fi AC_CONFIG_FILES([Makefile libcares.pc]) diff --git a/include/clib/amitcp_protos.h b/include/clib/amitcp_protos.h index 856a082..b18b9b3 100644 --- a/include/clib/amitcp_protos.h +++ b/include/clib/amitcp_protos.h @@ -1,29 +1,3 @@ -/* - * Copyright (c) 2015 Carsten Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - #ifndef _SOCKET_AMITCP_H #define _SOCKET_AMITCP_H //--------------------------------------------------------------------------// diff --git a/include/inline/amitcp.h b/include/inline/amitcp.h index 1ee4f30..2bac6fe 100644 --- a/include/inline/amitcp.h +++ b/include/inline/amitcp.h @@ -1,5 +1,3 @@ -/* Automatically generated header! Do not edit! */ - #ifndef _INLINE_AMITCP_H #define _INLINE_AMITCP_H diff --git a/install-sh b/install-sh old mode 100755 new mode 100644 diff --git a/maketgz b/maketgz old mode 100755 new mode 100644 diff --git a/mkinstalldirs b/mkinstalldirs old mode 100755 new mode 100644 diff --git a/setup_once.h b/setup_once.h index 25b144a..012fd1a 100644 --- a/setup_once.h +++ b/setup_once.h @@ -521,6 +521,55 @@ typedef int sig_atomic_t; #define EREMOTE WSAEREMOTE #endif +/* + * Compatibility + */ + +#ifndef HFIXEDSZ +#define HFIXEDSZ 12 +#endif +#ifndef T_TXT +#define T_TXT 16 +#endif +#ifndef T_RP +#define T_RP 17 +#endif +#ifndef T_AFSDB +#define T_AFSDB 18 +#endif +#ifndef T_X25 +#define T_X25 19 +#endif +#ifndef T_ISDN +#define T_ISDN 20 +#endif +#ifndef T_RT +#define T_RT 21 +#endif +#ifndef T_NSAP +#define T_NSAP 22 +#endif +#ifndef T_NSAP_PTR +#define T_NSAP_PTR 23 +#endif +#ifndef T_SIG +#define T_SIG 24 +#endif +#ifndef T_KEY +#define T_KEY 25 +#endif +#ifndef T_PX +#define T_PX 26 +#endif +#ifndef T_GPOS +#define T_GPOS 27 +#endif +#ifndef T_AAAA +#define T_AAAA 28 +#endif +#ifndef T_LOC +#define T_LOC 29 +#endif /* * Actually use __32_getpwuid() on 64-bit VMS builds for getpwuid() diff --git a/test/Makefile.am b/test/Makefile.am index 4809b51..da771ab 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -13,9 +13,9 @@ CXXFLAGS += -Wall $(PTHREAD_CFLAGS) # Makefile.inc provides the TESTSOURCES, TESTHEADERS and FUZZSOURCES defines include Makefile.inc -TESTS = arestest +TESTS = arestest fuzzcheck.sh -noinst_PROGRAMS = arestest aresfuzz +noinst_PROGRAMS = arestest aresfuzz dnsdump arestest_SOURCES = $(TESTSOURCES) $(TESTHEADERS) arestest_LDADD = libgmock.la libgtest.la $(ARES_BLD_DIR)/libcares.la $(PTHREAD_LIBS) @@ -33,4 +33,7 @@ libgtest_la_CPPFLAGS = -isystem $(GTEST_DIR)/include -I$(GTEST_DIR) -isystem $(G aresfuzz_SOURCES = $(FUZZSOURCES) aresfuzz_LDADD = $(ARES_BLD_DIR)/libcares.la +dnsdump_SOURCES = $(DUMPSOURCES) +dnsdump_LDADD = $(ARES_BLD_DIR)/libcares.la + test: check diff --git a/test/Makefile.inc b/test/Makefile.inc index 54e424b..2fa98b1 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -22,5 +22,8 @@ TESTSOURCES = ares-test-main.cc \ TESTHEADERS = ares-test.h \ dns-proto.h -FUZZSOURCES = ares-test-fuzz.cc \ - ares-fuzz.cc +FUZZSOURCES = ares-test-fuzz.c \ + ares-fuzz.c + +DUMPSOURCES = dns-proto.cc \ + dns-dump.cc diff --git a/test/ares-fuzz.c b/test/ares-fuzz.c new file mode 100644 index 0000000..9276128 --- /dev/null +++ b/test/ares-fuzz.c @@ -0,0 +1,58 @@ +/* + * General driver to allow command-line fuzzer (i.e. afl) to + * exercise the libFuzzer entrypoint. + */ + +#include +#include +#include +#include +#include +#include + +#define kMaxAflInputSize (1 << 20) +static unsigned char afl_buffer[kMaxAflInputSize]; + +#ifdef __AFL_LOOP +/* If we are built with afl-clang-fast, use persistent mode */ +#define KEEP_FUZZING(count) __AFL_LOOP(1000) +#else +/* If we are built with afl-clang, execute each input once */ +#define KEEP_FUZZING(count) ((count) < 1) +#endif + +/* In ares-test-fuzz.c: */ +int LLVMFuzzerTestOneInput(const unsigned char *data, unsigned long size); + +static void ProcessFile(int fd) { + ssize_t count = read(fd, afl_buffer, kMaxAflInputSize); + /* + * Make a copy of the data so that it's not part of a larger + * buffer (where buffer overflows would go unnoticed). + */ + unsigned char *copied_data = (unsigned char *)malloc(count); + LLVMFuzzerTestOneInput(copied_data, count); + free(copied_data); +} + +int main(int argc, char *argv[]) { + if (argc == 1) { + int count = 0; + while (KEEP_FUZZING(count)) { + ProcessFile(fileno(stdin)); + count++; + } + } else { + int ii; + for (ii = 1; ii < argc; ++ii) { + int fd = open(argv[ii], O_RDONLY); + if (fd < 0) { + fprintf(stderr, "Failed to open '%s'\n", argv[ii]); + continue; + } + ProcessFile(fd); + close(fd); + } + } + return 0; +} diff --git a/test/ares-test-fuzz.c b/test/ares-test-fuzz.c new file mode 100644 index 0000000..528e76c --- /dev/null +++ b/test/ares-test-fuzz.c @@ -0,0 +1,46 @@ +#include + +#include "ares.h" + +// Entrypoint for Clang's libfuzzer +int LLVMFuzzerTestOneInput(const unsigned char *data, + unsigned long size) { + // Feed the data into each of the ares_parse_*_reply functions. + struct hostent *host = NULL; + struct ares_addrttl info[5]; + int count = 5; + ares_parse_a_reply(data, size, &host, info, &count); + if (host) ares_free_hostent(host); + + host = NULL; + struct ares_addr6ttl info6[5]; + count = 5; + ares_parse_aaaa_reply(data, size, &host, info6, &count); + if (host) ares_free_hostent(host); + + host = NULL; + unsigned char addrv4[4] = {0x10, 0x20, 0x30, 0x40}; + ares_parse_ptr_reply(data, size, addrv4, sizeof(addrv4), AF_INET, &host); + if (host) ares_free_hostent(host); + + host = NULL; + ares_parse_ns_reply(data, size, &host); + if (host) ares_free_hostent(host); + + struct ares_srv_reply* srv = NULL; + ares_parse_srv_reply(data, size, &srv); + if (srv) ares_free_data(srv); + + struct ares_mx_reply* mx = NULL; + ares_parse_mx_reply(data, size, &mx); + if (mx) ares_free_data(mx); + + struct ares_txt_reply* txt = NULL; + ares_parse_txt_reply(data, size, &txt); + if (txt) ares_free_data(txt); + + struct ares_soa_reply* soa = NULL; + ares_parse_soa_reply(data, size, &soa); + if (soa) ares_free_data(soa); + return 0; +} diff --git a/test/ares-test-init.cc b/test/ares-test-init.cc index c9c6089..66570ac 100644 --- a/test/ares-test-init.cc +++ b/test/ares-test-init.cc @@ -354,6 +354,26 @@ CONTAINED_TEST_F(LibraryTest, ContainerChannelInit, return HasFailure(); } +CONTAINED_TEST_F(LibraryTest, ContainerSortlistOptionInit, + "myhostname", "mydomainname.org", filelist) { + ares_channel channel = nullptr; + struct ares_options opts = {0}; + int optmask = 0; + optmask |= ARES_OPT_SORTLIST; + opts.nsort = 0; + // Explicitly specifying an empty sortlist in the options should override the + // environment. + EXPECT_EQ(ARES_SUCCESS, ares_init_options(&channel, &opts, optmask)); + ares_save_options(channel, &opts, &optmask); + EXPECT_EQ(0, opts.nsort); + EXPECT_EQ(nullptr, opts.sortlist); + EXPECT_EQ(ARES_OPT_SORTLIST, (optmask & ARES_OPT_SORTLIST)); + ares_destroy_options(&opts); + + ares_destroy(channel); + return HasFailure(); +} + NameContentList fullresolv = { {"/etc/resolv.conf", " nameserver 1.2.3.4 \n" "search first.com second.com\n" @@ -431,8 +451,8 @@ CONTAINED_TEST_F(LibraryTest, ContainerResolvConfNotReadable, "myhostname", "mydomainname.org", filelist) { ares_channel channel = nullptr; MakeUnreadable hide("/etc/resolv.conf"); - // Unavailable /etc/resolv.conf fails initialization. - EXPECT_EQ(ARES_EFILE, ares_init(&channel)); + // Unavailable /etc/resolv.conf falls back to defaults + EXPECT_EQ(ARES_SUCCESS, ares_init(&channel)); return HasFailure(); } CONTAINED_TEST_F(LibraryTest, ContainerNsswitchConfNotReadable, @@ -470,6 +490,41 @@ CONTAINED_TEST_F(LibraryTest, ContainerSvcConfNotReadable, return HasFailure(); } +NameContentList rotateenv = { + {"/etc/resolv.conf", "nameserver 1.2.3.4\n" + "search first.com second.com\n" + "options rotate\n"}}; +CONTAINED_TEST_F(LibraryTest, ContainerRotateInit, + "myhostname", "mydomainname.org", rotateenv) { + ares_channel channel = nullptr; + EXPECT_EQ(ARES_SUCCESS, ares_init(&channel)); + + struct ares_options opts; + int optmask = 0; + ares_save_options(channel, &opts, &optmask); + EXPECT_EQ(ARES_OPT_ROTATE, (optmask & ARES_OPT_ROTATE)); + ares_destroy_options(&opts); + + ares_destroy(channel); + return HasFailure(); +} + +CONTAINED_TEST_F(LibraryTest, ContainerRotateOverride, + "myhostname", "mydomainname.org", rotateenv) { + ares_channel channel = nullptr; + struct ares_options opts = {0}; + int optmask = ARES_OPT_NOROTATE; + EXPECT_EQ(ARES_SUCCESS, ares_init_options(&channel, &opts, optmask)); + + optmask = 0; + ares_save_options(channel, &opts, &optmask); + EXPECT_EQ(ARES_OPT_NOROTATE, (optmask & ARES_OPT_NOROTATE)); + ares_destroy_options(&opts); + + ares_destroy(channel); + return HasFailure(); +} + NameContentList multiresolv = { {"/etc/resolv.conf", " nameserver 1::2 ; ;;\n" " domain first.com\n"}, diff --git a/test/ares-test-live.cc b/test/ares-test-live.cc index 94b4921..b8ff8eb 100644 --- a/test/ares-test-live.cc +++ b/test/ares-test-live.cc @@ -205,7 +205,7 @@ INSTANTIATE_TEST_CASE_P(Modes, DefaultChannelModeTest, TEST_F(DefaultChannelTest, LiveSearchA) { SearchResult result; - ares_search(channel_, "www.facebook.com.", ns_c_in, ns_t_a, + ares_search(channel_, "www.youtube.com.", ns_c_in, ns_t_a, SearchCallback, &result); Process(); EXPECT_TRUE(result.done_); diff --git a/test/ares-test-main.cc b/test/ares-test-main.cc index 329d34d..f7e90cb 100644 --- a/test/ares-test-main.cc +++ b/test/ares-test-main.cc @@ -4,15 +4,20 @@ #include "ares-test.h" int main(int argc, char* argv[]) { - ::testing::InitGoogleTest(&argc, argv); + std::vector gtest_argv = {argv[0]}; for (int ii = 1; ii < argc; ii++) { if (strcmp(argv[ii], "-v") == 0) { ares::test::verbose = true; } else if ((strcmp(argv[ii], "-p") == 0) && (ii + 1 < argc)) { ii++; ares::test::mock_port = atoi(argv[ii]); + } else { + gtest_argv.push_back(argv[ii]); } } + int gtest_argc = gtest_argv.size(); + gtest_argv.push_back(nullptr); + ::testing::InitGoogleTest(>est_argc, gtest_argv.data()); #ifdef WIN32 WORD wVersionRequested = MAKEWORD(2, 2); diff --git a/test/ares-test-misc.cc b/test/ares-test-misc.cc index bde4678..5e5bc0b 100644 --- a/test/ares-test-misc.cc +++ b/test/ares-test-misc.cc @@ -193,6 +193,19 @@ TEST_F(LibraryTest, CreateQuery) { EXPECT_EQ(expected, actual); } +TEST_F(LibraryTest, CreateQueryTrailingEscapedDot) { + byte* p; + int len; + EXPECT_EQ(ARES_SUCCESS, + ares_create_query("example.com\\.", ns_c_in, ns_t_a, 0x1234, 0, + &p, &len, 0)); + std::vector data(p, p + len); + ares_free_string(p); + + std::string actual = PacketToString(data); + EXPECT_EQ("REQ QRY Q:{'example.com\\.' IN A}", actual); +} + TEST_F(LibraryTest, CreateQueryFailures) { byte* p; int len; diff --git a/test/ares-test-mock.cc b/test/ares-test-mock.cc index 29b77b1..2cbe6b4 100644 --- a/test/ares-test-mock.cc +++ b/test/ares-test-mock.cc @@ -647,17 +647,17 @@ TEST_P(MockChannelTest, UnspecifiedFamilyV6) { } TEST_P(MockChannelTest, UnspecifiedFamilyV4) { + DNSPacket rsp6; + rsp6.set_response().set_aa() + .add_question(new DNSQuestion("example.com", ns_t_aaaa)); + ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + .WillByDefault(SetReply(&server_, &rsp6)); DNSPacket rsp4; rsp4.set_response().set_aa() .add_question(new DNSQuestion("example.com", ns_t_a)) .add_answer(new DNSARR("example.com", 100, {2, 3, 4, 5})); ON_CALL(server_, OnRequest("example.com", ns_t_a)) .WillByDefault(SetReply(&server_, &rsp4)); - DNSPacket rsp6; - rsp6.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_aaaa)); - ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) - .WillByDefault(SetReply(&server_, &rsp6)); HostResult result; ares_gethostbyname(channel_, "example.com.", AF_UNSPEC, HostCallback, &result); @@ -669,17 +669,17 @@ TEST_P(MockChannelTest, UnspecifiedFamilyV4) { } TEST_P(MockChannelTest, UnspecifiedFamilyNoData) { - DNSPacket rsp4; - rsp4.set_response().set_aa() - .add_question(new DNSQuestion("example.com", ns_t_a)); - ON_CALL(server_, OnRequest("example.com", ns_t_a)) - .WillByDefault(SetReply(&server_, &rsp4)); DNSPacket rsp6; rsp6.set_response().set_aa() .add_question(new DNSQuestion("example.com", ns_t_aaaa)) .add_answer(new DNSCnameRR("example.com", 100, "elsewhere.com")); ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) .WillByDefault(SetReply(&server_, &rsp6)); + DNSPacket rsp4; + rsp4.set_response().set_aa() + .add_question(new DNSQuestion("example.com", ns_t_a)); + ON_CALL(server_, OnRequest("example.com", ns_t_a)) + .WillByDefault(SetReply(&server_, &rsp4)); HostResult result; ares_gethostbyname(channel_, "example.com.", AF_UNSPEC, HostCallback, &result); @@ -690,6 +690,29 @@ TEST_P(MockChannelTest, UnspecifiedFamilyNoData) { EXPECT_EQ("{'' aliases=[] addrs=[]}", ss.str()); } +TEST_P(MockChannelTest, UnspecifiedFamilyCname6A4) { + DNSPacket rsp6; + rsp6.set_response().set_aa() + .add_question(new DNSQuestion("example.com", ns_t_aaaa)) + .add_answer(new DNSCnameRR("example.com", 100, "elsewhere.com")); + ON_CALL(server_, OnRequest("example.com", ns_t_aaaa)) + .WillByDefault(SetReply(&server_, &rsp6)); + DNSPacket rsp4; + rsp4.set_response().set_aa() + .add_question(new DNSQuestion("example.com", ns_t_a)) + .add_answer(new DNSARR("example.com", 100, {1, 2, 3, 4})); + ON_CALL(server_, OnRequest("example.com", ns_t_a)) + .WillByDefault(SetReply(&server_, &rsp4)); + + HostResult result; + ares_gethostbyname(channel_, "example.com.", AF_UNSPEC, HostCallback, &result); + Process(); + EXPECT_TRUE(result.done_); + std::stringstream ss; + ss << result.host_; + EXPECT_EQ("{'example.com' aliases=[] addrs=[1.2.3.4]}", ss.str()); +} + TEST_P(MockChannelTest, ExplicitIP) { HostResult result; ares_gethostbyname(channel_, "1.2.3.4", AF_INET, HostCallback, &result); diff --git a/test/dns-dump.cc b/test/dns-dump.cc new file mode 100644 index 0000000..023de36 --- /dev/null +++ b/test/dns-dump.cc @@ -0,0 +1,35 @@ +#include +#include +#include + +#include +#include + +#include "dns-proto.h" + +namespace ares { + +static void ShowFile(const char* filename) { + int fd = open(filename, O_RDONLY); + if (fd < 0) { + std::cerr << "Failed to open '" << filename << "'" << std::endl; + return; + } + std::vector contents; + while (true) { + unsigned char buffer[1024]; + int len = read(fd, buffer, sizeof(buffer)); + if (len <= 0) break; + contents.insert(contents.end(), buffer, buffer + len); + } + std::cout << PacketToString(contents) << std::endl; +} + +} // namespace ares + +int main(int argc, char* argv[]) { + for (int ii = 1; ii < argc; ++ii) { + ares::ShowFile(argv[ii]); + } +} + diff --git a/workman1 b/workman1 old mode 100755 new mode 100644 index 818e9e8..f83bb85 --- a/workman1 +++ b/workman1 @@ -1,16 +1,11 @@ #! /bin/sh -# This file is in the public domain, so clarified as of -# 2009-05-17 by Arthur David Olson. +# Taken from the tz distribution. # Tell groff not to emit SGR escape sequences (ANSI color escapes). GROFF_NO_SGR=1 export GROFF_NO_SGR -# Tell groff to emit SGR escape sequences (ANSI color escapes). -#GROFF_SGR=1 -#export GROFF_SGR - echo ".am TH .hy 0 .na diff --git a/workman2 b/workman2 old mode 100755 new mode 100644 index bd0c508..9d134c6 --- a/workman2 +++ b/workman2 @@ -1,11 +1,6 @@ #! /bin/sh -# This file is in the public domain, so clarified as of -# 2009-05-17 by Arthur David Olson. - -# Tell groff not to emit SGR escape sequences (ANSI color escapes). -#GROFF_NO_SGR=1 -#export GROFF_NO_SGR +# Taken from the tz distribution. # Tell groff to emit SGR escape sequences (ANSI color escapes). GROFF_SGR=1