Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

c-ares: upgrade to 1.7.5

  • Loading branch information...
bnoordhuis committed Sep 24, 2011
1 parent 8f617b9 commit 94dbbee0f85f41839f380c977a4c6d8816bcb138
Showing with 854 additions and 325 deletions.
  1. +11 −2 include/ares.h
  2. +2 −2 include/ares_version.h
  3. +20 −0 src/ares/CHANGES
  4. +24 −0 src/ares/README.msvc
  5. +18 −17 src/ares/RELEASE-NOTES
  6. +8 −1 src/ares/ares_expand_name.c
  7. +1 −0 src/ares/ares_fds.c
  8. +3 −0 src/ares/ares_free_hostent.c
  9. +30 −0 src/ares/ares_getenv.c
  10. +26 −0 src/ares/ares_getenv.h
  11. +11 −2 src/ares/ares_gethostbyaddr.c
  12. +17 −9 src/ares/ares_gethostbyname.c
  13. +3 −2 src/ares/ares_getnameinfo.c
  14. +235 −94 src/ares/ares_init.c
  15. +10 −0 src/ares/ares_library_init.c
  16. +4 −1 src/ares/ares_library_init.h
  17. +126 −4 src/ares/ares_nowarn.c
  18. +32 −1 src/ares/ares_nowarn.h
  19. +4 −9 src/ares/ares_options.c
  20. +3 −0 src/ares/ares_parse_a_reply.c
  21. +3 −0 src/ares/ares_parse_aaaa_reply.c
  22. +2 −2 src/ares/ares_parse_mx_reply.c
  23. +2 −2 src/ares/ares_parse_ns_reply.c
  24. +12 −3 src/ares/ares_parse_ptr_reply.c
  25. +3 −3 src/ares/ares_parse_srv_reply.c
  26. +43 −0 src/ares/ares_platform.h
  27. +6 −2 src/ares/ares_private.h
  28. +24 −25 src/ares/ares_process.c
  29. +1 −2 src/ares/ares_search.c
  30. +1 −1 src/ares/ares_send.c
  31. +12 −4 src/ares/ares_setup.h
  32. +2 −0 src/ares/config_cygwin/ares_config.h
  33. +2 −0 src/ares/config_darwin/ares_config.h
  34. +2 −0 src/ares/config_freebsd/ares_config.h
  35. +2 −0 src/ares/config_linux/ares_config.h
  36. +2 −0 src/ares/config_netbsd/ares_config.h
  37. +2 −0 src/ares/config_openbsd/ares_config.h
  38. +2 −0 src/ares/config_sunos/ares_config.h
  39. +21 −20 src/ares/inet_net_pton.c
  40. +6 −6 src/ares/inet_net_pton.h
  41. +79 −103 src/ares/inet_ntop.c
  42. +0 −1 src/ares/inet_ntop.h
  43. +10 −0 src/ares/nameser.h
  44. +18 −2 src/ares/setup_once.h
  45. +9 −5 uv.gyp
@@ -1,6 +1,6 @@

/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
* Copyright (C) 2007-2010 by Daniel Stenberg
* Copyright (C) 2007-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -96,10 +96,19 @@ typedef int ares_socklen_t;
# include <netinet/in.h>
# include <sys/socket.h>
# include <tcp.h>
#elif defined(_WIN32_WCE)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# include <winsock.h>
#elif defined(WIN32)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# include <winsock2.h>
# include <ws2tcpip.h>
# include <windows.h>
#else
# include <sys/socket.h>
# include <netinet/in.h>
@@ -7,11 +7,11 @@

#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 7
#define ARES_VERSION_PATCH 4
#define ARES_VERSION_PATCH 5
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.7.4"
#define ARES_VERSION_STR "1.7.5-DEV"

#if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1
@@ -1,5 +1,25 @@
Changelog for the c-ares project

Version 1.7.5 (August 16, 2011)

Fixed:

o detection of semicolon comments in resolv.conf
o avoid using system's inet_net_pton affected by the WLB-2008080064 advisory
o replacement ares_inet_net_pton affected by the WLB-2008080064 advisory
o replacement ares_inet_ntop affected by potential out of bounds write
o added install target to Makefile.msvc
o only fall back to AF_INET searches when looking for AF_UNSPEC addresses
o fixed ares_parse_*_reply memory leaks
o Use correct sizeof in ares_getnameinfo()
o IPv6-on-windows: find DNS servers correctly
o man pages: docs for the c-ares utility programs
o getservbyport replacement for Win CE
o config_sortlist: (win32) missing else
o advance_tcp_send_queue: avoid NULL ptr dereference
o configure: fix a bashism
o ares_expand_name: Fix encoded length for indirect root

Version 1.7.4 (December 9, 2010)

Changed:
@@ -40,6 +40,30 @@
library version it is using.


How to install using MSVC from the command line
-----------------------------------------------

In order to allow easy usage of c-ares libraries it may be convenient to
install c-ares libraries and header files to a common subdirectory tree.

Once that c-ares libraries have been built using procedure described above,
use same command prompt window to define environment variable INSTALL_DIR
to designate the top subdirectory where installation of c-ares libraries and
header files will be done.

> set INSTALL_DIR=c:\c-ares

Afterwards, run following command to actually perform the installation:

> nmake -f Makefile.msvc install

Installation procedure will copy c-ares libraries to subdirectory 'lib' and
c-ares header files to subdirectory 'include' below the INSTALL_DIR subdir.

When environment variable INSTALL_DIR is not defined, installation is done
to c-ares source folder where Makefile.msvc file is located.


How to build using Visual Studio 6 IDE
--------------------------------------

@@ -1,25 +1,26 @@
c-ares version 1.7.4

Changed:

o local-bind: Support binding to local interface/IPs, see
ares_set_local_ip4, ares_set_local_ip6, ares_set_local_dev
c-ares version 1.7.5

Fixed:

o memory leak in ares_getnameinfo
o add missing break that caused get_ares_servers to fail
o ares_parse_a_reply: fix CNAME response parsing
o init_by_options: don't copy an empty sortlist
o Replaced uint32_t with unsigned int to fix broken builds
on a couple of platforms
o Fix lookup with HOSTALIASES set
o adig: fix NAPTR parsing
o compiler warning cleanups
o detection of semicolon comments in resolv.conf
o avoid using system's inet_net_pton affected by the WLB-2008080064 advisory
o replacement ares_inet_net_pton affected by the WLB-2008080064 advisory
o replacement ares_inet_ntop affected by potential out of bounds write
o added install target to Makefile.msvc
o only fall back to AF_INET searches when looking for AF_UNSPEC addresses
o fixed ares_parse_*_reply memory leaks
o Use correct sizeof in ares_getnameinfo()
o IPv6-on-windows: find DNS servers correctly
o man pages: docs for the c-ares utility programs
o getservbyport replacement for Win CE
o config_sortlist: (win32) missing else
o advance_tcp_send_queue: avoid NULL ptr dereference
o configure: fix a bashism
o ares_expand_name: Fix encoded length for indirect root

Thanks go to these friendly people for their efforts and contributions:

Andrew C. Morrow, Ben Greear, Ben Noordhuis, Daniel Stenberg,
Guenter Knauf, Mike Crowe, Patrik Thunstrom, Yang Tse
Yang Tse, Jakub Hrozek, Gisle Vanem, Tom Hughes, David Stuart, Dima Tisnek,
Peter Pentchev, Stefan Buhler

Have fun!
@@ -87,7 +87,14 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
* Since this function strips trailing dots though, it becomes ""
*/
q[0] = '\0';
*enclen = 1; /* the caller should move one byte to get past this */

/* indirect root label (like 0xc0 0x0c) is 2 bytes long (stupid, but
valid) */
if ((*encoded & INDIR_MASK) == INDIR_MASK)
*enclen = 2;
else
*enclen = 1; /* the caller should move one byte to get past this */

return ARES_SUCCESS;
}

@@ -21,6 +21,7 @@
#endif

#include "ares.h"
#include "ares_nowarn.h"
#include "ares_private.h"

int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
@@ -28,6 +28,9 @@ void ares_free_hostent(struct hostent *host)
{
char **p;

if (!host)
return;

free((char *)(host->h_name));
for (p = host->h_aliases; *p; p++)
free(*p);
@@ -0,0 +1,30 @@


/* 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.
*/

#include "ares_setup.h"
#include "ares_getenv.h"

#ifndef HAVE_GETENV

char *ares_getenv(const char *name)
{
#ifdef _WIN32_WCE
return NULL;
#endif
}

#endif
@@ -0,0 +1,26 @@
#ifndef HEADER_CARES_GETENV_H
#define HEADER_CARES_GETENV_H


/* 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.
*/

#include "ares_setup.h"

#ifndef HAVE_GETENV
extern char *ares_getenv(const char *name);
#endif

#endif /* HEADER_CARES_GETENV_H */
@@ -42,6 +42,7 @@

#include "ares.h"
#include "inet_net_pton.h"
#include "ares_platform.h"
#include "ares_private.h"

#ifdef WATT32
@@ -186,7 +187,13 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host)

#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
if (IS_NT()) {
win_platform platform;

PATH_HOSTS[0] = '\0';

platform = ares__getplatform();

if (platform == WIN_NT) {
char tmp[MAX_PATH];
HKEY hkeyHosts;

@@ -200,8 +207,10 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host)
RegCloseKey(hkeyHosts);
}
}
else
else if (platform == WIN_9X)
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
else
return ARES_ENOTFOUND;

strcat(PATH_HOSTS, WIN_PATH_HOSTS);

@@ -48,6 +48,7 @@
#include "ares.h"
#include "inet_net_pton.h"
#include "bitncmp.h"
#include "ares_platform.h"
#include "ares_private.h"

#ifdef WATT32
@@ -193,11 +194,11 @@ static void host_callback(void *arg, int status, int timeouts,
else if (hquery->sent_family == AF_INET6)
{
status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
if (status == ARES_ENODATA || status == ARES_EBADRESP) {
if ((status == ARES_ENODATA || status == ARES_EBADRESP) &&
hquery->want_family == AF_UNSPEC) {
/* The query returned something but either there were no AAAA
records (e.g. just CNAME) or the response was malformed. Try
looking up A instead. We should possibly limit this
attempt-next logic to AF_UNSPEC lookups only. */
looking up A instead. */
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A,
host_callback, hquery);
@@ -209,11 +210,10 @@ static void host_callback(void *arg, int status, int timeouts,
end_hquery(hquery, status, host);
}
else if ((status == ARES_ENODATA || status == ARES_EBADRESP ||
status == ARES_ETIMEOUT) && hquery->sent_family == AF_INET6)
status == ARES_ETIMEOUT) && (hquery->sent_family == AF_INET6 &&
hquery->want_family == AF_UNSPEC))
{
/* The AAAA query yielded no useful result. Now look up an A instead.
We should possibly limit this attempt-next logic to AF_UNSPEC lookups
only. */
/* The AAAA query yielded no useful result. Now look up an A instead. */
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
hquery);
@@ -344,7 +344,13 @@ static int file_lookup(const char *name, int family, struct hostent **host)

#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
if (IS_NT()) {
win_platform platform;

PATH_HOSTS[0] = '\0';

platform = ares__getplatform();

if (platform == WIN_NT) {
char tmp[MAX_PATH];
HKEY hkeyHosts;

@@ -358,8 +364,10 @@ static int file_lookup(const char *name, int family, struct hostent **host)
RegCloseKey(hkeyHosts);
}
}
else
else if (platform == WIN_9X)
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
else
return ARES_ENOTFOUND;

strcat(PATH_HOSTS, WIN_PATH_HOSTS);

@@ -58,6 +58,7 @@
#include "ares.h"
#include "ares_ipv6.h"
#include "inet_ntop.h"
#include "ares_nowarn.h"
#include "ares_private.h"

struct nameinfo_query {
@@ -187,15 +188,15 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
if (sa->sa_family == AF_INET)
{
niquery->family = AF_INET;
memcpy(&niquery->addr.addr4, addr, sizeof(addr));
memcpy(&niquery->addr.addr4, addr, sizeof(struct in_addr));
ares_gethostbyaddr(channel, &addr->sin_addr,
sizeof(struct in_addr), AF_INET,
nameinfo_callback, niquery);
}
else
{
niquery->family = AF_INET6;
memcpy(&niquery->addr.addr6, addr6, sizeof(addr6));
memcpy(&niquery->addr.addr6, addr6, sizeof(struct ares_in6_addr));
ares_gethostbyaddr(channel, &addr6->sin6_addr,
sizeof(struct ares_in6_addr), AF_INET6,
nameinfo_callback, niquery);

0 comments on commit 94dbbee

Please sign in to comment.
You can’t perform that action at this time.