Commit Graph

28 Commits

Author SHA1 Message Date
David Drysdale 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
David Drysdale d493e9b17c 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.
2016-02-02 10:05:07 +00:00
David Drysdale 4aa1fc4163 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).
2013-11-12 17:40:42 -08:00
Yang Tse a1035276c1 Header inclusion clean-up
Remove header inclusions already done in setup_once.h
2012-12-14 18:25:56 +01:00
Yang Tse c7ce7c7d45 ares_search: use ERRNO macro for portability sake 2011-03-22 20:50:42 +01:00
Yang Tse 8c503ddf79 System's errno.h inclusion cleanup.
System's errno.h is conditionally included from setup_once.h
2011-03-22 14:02:23 +01:00
Mike Crowe fa0dd472cd 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 <mac@mcrowe.com>
2010-09-30 00:23:08 +02:00
Daniel Stenberg 63627fa5ab remove all $Id$ lines 2010-03-27 19:42:02 +01:00
Yang Tse a82a8fbf82 Renamed c-ares setup.h to ares_setup.h 2009-11-02 11:55:53 +00:00
Yang Tse f3346ca16b Fix compiler warning 2009-10-08 18:38:29 +00:00
Gisle Vanem 054aa0e11e fopen() returns error in 'errno' even on Windows.
So don't use ERRNO (GetLastError()). Trimmed trailing
blanks.
2009-01-18 17:03:31 +00:00
Yang Tse 8f51d8e9ac include <strings.h> 2008-09-17 03:25:52 +00:00
Yang Tse f214b583f5 adjust inclusion of "nameser.h" 2008-09-17 01:02:57 +00:00
Steinar H. Gunderson 6bd2b895fb Fix a bug where fallback from AF_INET6 to AF_INET would not work properly together with relative search; if you had a search path of .a.com and .b.com, and foo.a.com would return ARES_ENODATA and foo.b.com would return ARES_ENOTFOUND, the lookup would not properly retry with AF_INET as it forgot the first ARES_ENODATA. 2007-10-16 21:27:51 +00:00
Steinar H. Gunderson 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
Yang Tse 679a675660 add debug messages for initialization failures 2007-02-19 02:03:58 +00:00
Yang Tse 675bdce3b2 compiler warning fix 2007-02-17 11:34:33 +00:00
Yang Tse 8595ddf7c4 add debug messages for fopen() failures 2007-02-16 19:17:05 +00:00
Yang Tse dd3b42e1ac Replace is*() macros with our own IS*() ones.
Get rid of non ANSI/ISO isascii().
2006-10-18 03:42:06 +00:00
Gisle Vanem 0a83c1e416 2nd try adding CVS id. 2006-07-22 15:37:10 +00:00
Gisle Vanem f6e7395ca0 Added CVS id. 2006-07-22 15:21:13 +00:00
Daniel Stenberg 3e748f4b50 removed tabs and trailing whitespace from source 2004-10-06 07:50:18 +00:00
Gisle Vanem 6deb40acac Changes for Watt-32 on Windows. I've assumed Configure
sets the required HAVE_xx defines for non-DOS/Win targets.
2004-08-20 13:45:26 +00:00
Daniel Stenberg d5f3636a52 - Fixed a few variable return types for some system calls. Made configure
check for ssize_t to make it possible to use that when receiving the send()
  error code. This is necessary to prevent compiler warnings on some systems.

- Made configure create config.h, and all source files now include setup.h that
  might include the proper config.h (or a handicrafted alternative).

- Switched to 'ares_socket_t' type for sockets in ares, since Windows don't
  use 'int' for that.

- automake-ified and libool-ified c-ares. Now it builds libcares as a shared
  lib on most platforms if wanted. (This bloated the size of the release
  archive with another 200K!)

- Makefile.am now uses Makefile.inc for the c sources, h headers and man
  pages, to make it easier for other makefiles to use the exact same set of
  files.

- Adjusted 'maketgz' to use the new automake magic when building distribution
  archives.
2004-07-22 22:18:45 +00:00
Daniel Stenberg 080f8f4cd4 free() allocated memory when the ares search can't be made 2004-05-27 07:10:36 +00:00
Daniel Stenberg a58afac1f1 more int vs long/size_t fixes after icc compiler warnings 2004-02-23 08:04:31 +00:00
Daniel Stenberg 3d0a7c00df remove rcsid stuff from c files, it serves no useful purpose 2004-02-02 15:59:35 +00:00
Daniel Stenberg 5e847a14bd ares 1.1.1 with collected applied patches 2003-10-07 21:54:04 +00:00