CHECK_LIBRARY_EXISTS(), while it takes a function name, does not actually verify the function exists in the library being evaluated. Instead, if the function is found in any dependent library, and the referenced library also exists, it returns true. This is not desirable.
Wrap with a Macro to change the behavior.
Fixes: #307
Fix By: Brad House (@bradh352)
Added the capability of parsing SOA record from a response buffer of ns_t_any type query, this implementation doesn't interfere with existing T_SOA query's response as that too is treated as a list of records. The function returns ARES_EBADRESP if no SOA record is found(as per RFC).
The basic idea of sticking to RFC that a ns_t_any too should return an SOA record is something open for discussion but I have kept the functionality intact as it was previously i.e the function returns ARES_EBADRESP if it doesn't find a SOA record regardless of which response it is parsing i.e. T_SOA or T_ANY.
Note that asking for T_ANY is generally a bad idea:
- https://blog.cloudflare.com/what-happened-next-the-deprecation-of-any/
- https://tools.ietf.org/html/draft-ietf-dnsop-refuse-any
Bug: #102
Fix By: Dron Rathore (@DronRathore)
Added CPack functionality for generating RPM or DEB packages
ie: run `cpack -G RPM` (or "DEB") after building with CMake.
The current configuration creates 3 separate packages for the shared library,
the development files and the tools.
Fix By: Stephen Bryant (@bf-bryants)
ares_gethostbyname() was returning ESUCCESS when no A or AAAA record was found but a CNAME pointing nowhere was present. ENODATA should be returned instead, however the hosts pointer will still be present to provide the alias list.
* Return ENODATA if no valid A or AAAA record found
* Fix and update test ParseAReplyNoData.
* Add test for new ENODATA behaviour in ares_gethostbyname.
Fixes Bug #303
Fix By: @tjwalton
Before this change, SetServers, SetServersPorts and SetServersCSV
contained test cases trying to make DNS queries with the google.com
hostname, which requires Internet connectivity. Tests with that
requirement should be defined in the ares-test-live.cc file and contain
"Live" prefix to filter them out with `--gtest_filter=-*.Live*` on
machines without Internet connectivity.
Fix By: Michal Rostecki (@mrostecki)
When ares_parse_a_reply or ares_parse_aaaa_reply is called in case
where another AAAA and A responses exist, the resulting ares_addrttl
count is invalid and the structure points to gibberish.
This is a regression since 1.15.
Issue: https://github.com/c-ares/c-ares/issues/300
Fix By: Adam Majer (@AdamMajer)
* Add CARES_BUILD_CONTAINER_TESTS CMake option to add ability to build the Linux-only containerized tests.
* Accept invalid /etc/resolv.conf lookup values
Before this commit invalid `lookup` values resulted in c-ares not using
any lookups without any clear indication why. After this commit it uses
the default "fb".
Fix By: Ben Noordhuis (@bnoordhuis)
A and AAAA lookups for ares_getaddrinfo() are now performed in parallel.
For this change `ares_search` was removed from `ares_getaddrinfo`.
Instead `ares_query` in combination with `next_dns_lookup` are
doing the suffix search.
Adding support for `.onion` addresses which are tested by
`TEST_F(DefaultChannelTest, GetAddrinfoOnionDomain)`
Fix By: Christian Ammer (@ChristianAmmer)
7e6af8e inserted the documentation of resolvconf_path in the middle of
the item for ednspsz, leading to broken layout. Fix that.
Fix By: Peter Eisentraut (@petere)
The const AddrInfo& argument to operator<< overload for AddrInfo can be
a nullptr unique_ptr. Handle this explicitly by printing {nullptr} if
the rest of the function cannot be safely executed.
Fix-by: Dan Noé <dpn@google.com>
This files references INT_MAX, but does not include limits.h. This can
cause a build failure on some platforms. Include limits.h if we have it.
Fix-by: Dan Noé <dpn@google.com>
* fix leak if naddress of particular type found
* fix segfault when wanted ttls count lesser than count of result records
* add fuzzer input files that trigger problems (from #263)
Reported-By: David Drysdale (@daviddrysdale)
Fix-By: Andrew Selivanov (@ki11roy)
* Service support has been added to getaddrinfo.
* ares_parse_a/aaaa_record now share code with the addrinfo parser.
* Private ares_addrinfo structure with useful extensions such as ttls (including cname ttls),
as well as the ability to list multiple cnames in chain of lookups
Work By: Andrew Selivanov @ki11roy
Some socket functions weren't exposed for use by other areas of the library. Expose
those and make use of them in ares__sortaddrinfo().
Fix By: Andrew Selivanov (@ki11roy)
Due to an order of incrementing the remaining queries and calling ares_query, on a bad domain
the registered callback wouldn't be called.
Bug: #248
Fixed-By: @kedixa
Fix link issues caused by missing library that appears to only be required on ARM (though
docs don't list this restriction). Doesn't hurt to require it everywhere.
Bug: #251
Fixed-By: Darrin Cullop (@dwcullop)
There are two possible causes for infinite loops fo NXDOMAIN, based on how many dots are in the domain name (one for < ARES_OPT_NDOTS and one for >= ARES_OPT_NDOTS), where it will repeat the same query over and over as the hquery->next_domain doesn't increment.
Fix By: @kedixa
When querying a .onion domain, it returns directly without setting bufp to NULL. A subsequent free() that occurs can cause a segmentation fault.
Fix By: Khaidi Chu (@XadillaX)
This is a port of RFC 6724 compliant sorting function from Android Bionic project:
e919b116d3/libc/netbsd/net/getaddrinfo.c
The latest version is essentially the same, except two additional parameters to test connection with (mark/uid):
https://android.googlesource.com/platform/bionic/+/master/libc/dns/net/getaddrinfo.c
Please note that even that version has some restrictions. It doesn't support some rules from RFC 6724:
Rule 3 (Avoid deprecated addresses)
Rule 4 (Prefer home addresses)
Rule 7 (Prefer native transport)
Submitted By: Andrew Selivanov (@ki11roy)
* using portable ares_inet_pton and updated includes in ares-test-mock-ai
* forgot to remove deleted ares-test-ai.cc in Makefile.inc
Fix By: Christian Ammer (@ChristianAmmer)
This PullRequest fixes a bug in the function add_to_addrinfo which task is to add new addrinfo items to the ai_next linked list. Also additional unit tests for testing ares_getaddrinfo will be added:
Additional mock server test classes (ares-test-mock-ai.cc):
MockTCPChannelTestAI
MockExtraOptsTestAI
MockNoCheckRespChannelTestAI
MockEDNSChannelTestAI
RotateMultiMockTestAI
NoRotateMultiMockTestAI
Additional live tests (ares-test-live-ai.cc):
LiveGetHostByNameV4
LiveGetHostByNameV6
LiveGetHostByNameV4AndV6
Fix By: Christian Ammer (@ChristianAmmer)
Initial implementation for ares_getaddrinfo(). It is NOT compliant with RFC6724, though
it is expected to come closer to conformance prior to the next release.
Features not supported include sorted addresses and honoring of service and hints
parameters.
Implementation by: Christian Ammer (@ChristianAmmer)
The LiveGetLocalhostByAddrV6 test expected to see "localhost" in the
result when doing an address-to-name lookup for ::1 but on my system
that resolves to "ip6-loopback" because of this stanza in /etc/hosts:
$ grep ^::1 /etc/hosts
::1 ip6-localhost ip6-loopback
Fix By: Ben Noordhuis (@bnoordhuis)
Bug: #85
Quoting RFC 7686:
Name Resolution APIs and Libraries (...) MUST either respond
to requests for .onion names by resolving them according to
[tor-rendezvous] or by responding with NXDOMAIN.
A legacy client may inadvertently attempt to resolve a .onion
name through the DNS. This causes a disclosure that the client
is attempting to use Tor to reach a specific service. Malicious
resolvers could be engineered to capture and record such leaks,
which might have very adverse consequences for the well-being
of the user.
Bug: #196
Fix By: Ben Noordhuis @bnoordhuis
AIX attempts to include both nameser_compat.h and onameser_compat.h. It appears
the proper fix is to define _USE_IRS so that only nameser_compat.h is used.
Bug: #224
Fix By: Brad House (@bradh352)
ares_dup() calls ares_init_options() by making its own fake option
mask since the original mask isn't stored but ARES_OPT_RESOLVCONF
was always set, instead of conditionally set. This caused a crash
because ares_strdup() isn't NULL-safe if no custom path was set.
Made ares_dup() set ARES_OPT_RESOLVCONF conditionally.
Fix By: Brad House (@bradh352)
Add resolvconf_path to end of struct ares_options with ARES_OPT_RESOLVCONF option
so on Unix-like systems a custom path can be specified. If no path is specified,
/etc/resolv.conf is used like normal.
Fix By: Sarat Addepalli @SirR4T
Fixes Bug: #220
Review By: Brad House @bradh352