f1bcfa1122
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
2016-02-02 10:05:07 +00:00
52c9bc57bd
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).
2016-01-24 09:05:40 +00:00
c1fe47f6d9
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.
2014-07-24 16:12:39 +02:00
cf7ad9758d
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.
2013-02-17 17:44:02 +01:00
2a3a63ae1f
ares__bitncmp: use two underscores for private functions
...
It used a single one previously making it look like a public one
2013-02-13 14:58:04 +01:00
0c677f578e
setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>
...
Inclusion of these two header files now done in setup_once.h
2012-12-14 18:36:59 +01:00
a1035276c1
Header inclusion clean-up
...
Remove header inclusions already done in setup_once.h
2012-12-14 18:25:56 +01:00
14eb79f660
warnings: fix some 'conversion may lose significant bits' compiler warnings
2011-08-20 23:05:14 +02:00
bb4096effe
Only fall back to AF_INET searches when looking for AF_UNSPEC addresses
2011-08-15 13:34:20 +02:00
159b82c056
Revert "Only fall back to AF_INET searches when looking for AF_UNSPEC addresses"
...
This reverts commit b5823d6570
.
This patch was not reviewed properly before pushing
2011-06-15 10:56:05 +02:00
b5823d6570
Only fall back to AF_INET searches when looking for AF_UNSPEC addresses
2011-06-14 16:41:29 +02:00
5e5c0132e6
renamed getplatform() to ares__getplatform() to avoid namespace pollution
2011-03-25 17:57:02 +01:00
5b6a188909
build: move platform stuff to ares_platform.c and ares_platform.h
2011-03-24 11:31:50 +01:00
bd066ab8ef
build: find out windows platform using GetVersionEx()
2011-03-23 20:53:28 +01:00
0e8dc6f18e
style: make code less than 80 columns wide
2010-06-02 23:10:21 +02:00
63627fa5ab
remove all $Id$ lines
2010-03-27 19:42:02 +01:00
e51156c080
removed usage of 's6_addr', fixing compilation issue triggered with no
...
longer using 'in6_addr' but only our 'ares_in6_addr' struct
2010-03-06 01:23:09 +00:00
8fe746fcf2
Added IPv6 name servers support
2010-03-05 20:01:47 +00:00
a82a8fbf82
Renamed c-ares setup.h to ares_setup.h
2009-11-02 11:55:53 +00:00
cef560e871
Support lookup of IPv4 literals in ares_gethostbyname(), even when the address family is set to AF_INET6.
2009-08-27 09:53:55 +00:00
737707bf4b
fix compiler warning: implicit conversion shortens 64-bit value into a 32-bit value
2009-04-14 12:53:53 +00:00
3f7fc80ab5
* 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.
2009-02-03 14:38:09 +00:00
1ce8e6583e
- 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.
2009-01-31 20:17:41 +00:00
f94afa4fdc
Constified some arguments in local functions.
2009-01-18 16:33:10 +00:00
aa1534eb20
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.
2008-11-25 16:26:58 +00:00
acf5ca090a
use unsigned short better intead of mixing with ints to prevent compiler
...
warnings
2008-11-20 07:50:48 +00:00
8a6b51d560
- Brad Spencer brought the new function ares_gethostbyname_file() which simply
...
resolves a host name from the given file, using the regular hosts syntax.
2008-11-19 15:16:16 +00:00
f214b583f5
adjust inclusion of "nameser.h"
2008-09-17 01:02:57 +00:00
f2582d6949
include header file only when available
2008-09-15 17:14:29 +00:00
2cb5cbba34
move inclusion of ares_private.h last
2008-09-11 03:46:47 +00:00
93e7573628
- Phil Blundell: If you ask ares_gethostbyname() to do an AF_INET6 lookup and
...
the target host has only A records, it automatically falls back to an
AF_INET lookup and gives you the A results. However, if the target host has
a CNAME record, this behaviour is defeated since the original query does
return some data even though ares_parse_aaa_reply() doesn't consider it
relevant. Here's a small patch to make it behave the same with and without
the CNAME.
2008-07-03 11:32:35 +00:00
7829b79768
check for strings.h in configure and use it for the strcasecmp() proto
2008-05-08 22:11:38 +00:00
c73ff0391f
fix compiler warning: local variable may be used without having been initialized
2008-04-07 14:20:05 +00:00
ba5bd647f9
fix next_lookup() to continue searching even if c-ares failed to load the
...
/etc/hosts file, pointed out by Erik Kline:
http://daniel.haxx.se/projects/c-ares/mail/c-ares-archive-2007-11/0027.shtml
2007-11-28 10:46:40 +00:00
d9dd239771
When looking up in DNS and then in the hosts file, return the error code from DNS if both fail, instead of returning the error code from the hosts file, as today. Patch from the Google tree.
2007-11-15 09:16:48 +00:00
b4bdb6d4d7
Return TTL data from ares_parse_{a,aaaa}_reply, if the user is so inclined. Patch from the Google tree.
2007-11-15 08:36:25 +00:00
338d59bd0b
Fixed the problem where next_lookup would use 'status' uninitialized. Now
...
it gets passed the initial value as an argument.
2007-10-02 08:12:30 +00:00
879f89a989
Fix a memory leak that I recently inadvertedly introduced.
2007-09-30 00:08:01 +00:00
60519063ea
Use ISDIGIT instead of isdigit; fixes a gcc warning.
2007-09-29 21:57:05 +00:00
cccd9a58cd
Be stricter about what's a valid IP address in fake_hostent. (Patch from the Google tree.)
2007-09-29 13:52:14 +00:00
3b5e49995f
Unrevert previous 'missing' hunks. They were missing since the patch is still in for review :-)
2007-09-28 15:56:28 +00:00
f785dbd9c4
Yet more missing hunks... Nggh.
2007-09-28 15:55:11 +00:00
50ba81cd23
Make the query callbacks return the number of timeouts that happened during the execution of a query, and update documentation accordingly. (Patch from the Google tree.)
2007-09-28 14:46:51 +00:00
9089e0c26c
Revered Ashish Sharma's multiple entries patch, as it caused memory madness
2007-06-04 21:33:02 +00:00
4e27354b82
Ashish Sharma provided a patch for supporting multiple entries in the
...
/etc/hosts file. Patch edited for coding style and functionality by me
(Daniel).
2007-06-02 19:42:25 +00:00
a627160041
Removed inclusion of <sys/types.h> in .c-files
...
since it's already included through "setup.h".
2007-02-26 04:33:19 +00:00
679a675660
add debug messages for initialization failures
2007-02-19 02:03:58 +00:00
3c90d9d6d3
fix compiler warning "discards qualifiers from pointer target type" in debug builds
2007-01-29 20:56:27 +00:00
415e2ae109
Fixed comment.
2006-08-04 15:41:56 +00:00
0a83c1e416
2nd try adding CVS id.
2006-07-22 15:37:10 +00:00