tests += tst-res_hconf_reorder
endif
extra-libs-others = $(extra-libs)
-libresolv-routines := gethnamaddr res_comp res_debug \
+libresolv-routines := res_comp res_debug \
res_data res_mkquery res_query res_send \
inet_net_ntop inet_net_pton inet_neta base64 \
ns_parse ns_name ns_netint ns_ttl ns_print \
- ns_samedomain ns_date compat-hooks
+ ns_samedomain ns_date \
+ compat-hooks compat-gethnamaddr
libanl-routines := gai_cancel gai_error gai_misc gai_notify gai_suspend \
getaddrinfo_a
include ../Rules
-CPPFLAGS += -Dgethostbyname=res_gethostbyname \
- -Dgethostbyname2=res_gethostbyname2 \
- -Dgethostbyaddr=res_gethostbyaddr \
- -Dgetnetbyname=res_getnetbyname \
- -Dgetnetbyaddr=res_getnetbyaddr
-
CFLAGS-res_hconf.c = -fexceptions
# The DNS NSS modules needs the resolver.
it exports symbols in the libresolv ABI. The file is not maintained any
more, nor are these functions. */
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-#include <stdio.h>
-#include <netdb.h>
-#include <resolv.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define MAXALIASES 35
-#define MAXADDRS 35
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_25)
+
+# include <sys/types.h>
+# include <sys/param.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# include <arpa/nameser.h>
+
+# include <stdio.h>
+# include <netdb.h>
+# include <resolv.h>
+# include <ctype.h>
+# include <errno.h>
+# include <stdlib.h>
+# include <string.h>
+
+# define MAXALIASES 35
+# define MAXADDRS 35
static char *h_addr_ptrs[MAXADDRS + 1];
extern void addrsort (char **, int) __THROW;
-#if PACKETSZ > 65536
-#define MAXPACKET PACKETSZ
-#else
-#define MAXPACKET 65536
-#endif
+# if PACKETSZ > 65536
+# define MAXPACKET PACKETSZ
+# else
+# define MAXPACKET 65536
+# endif
/* As per RFC 1034 and 1035 a host name cannot exceed 255 octets in length. */
-#ifdef MAXHOSTNAMELEN
-# undef MAXHOSTNAMELEN
-#endif
-#define MAXHOSTNAMELEN 256
+# ifdef MAXHOSTNAMELEN
+# undef MAXHOSTNAMELEN
+# endif
+# define MAXHOSTNAMELEN 256
typedef union {
HEADER hdr;
char ac;
} align;
-#ifndef h_errno
+# ifndef h_errno
extern int h_errno;
-#endif
+# endif
-#ifdef DEBUG
+# ifdef DEBUG
static void
Dprintf (char *msg, int num)
{
__set_errno (save);
}
}
-#else
-# define Dprintf(msg, num) /*nada*/
-#endif
+# else
+# define Dprintf(msg, num) /*nada*/
+# endif
-#define BOUNDED_INCR(x) \
+# define BOUNDED_INCR(x) \
do { \
cp += x; \
if (cp > eom) { \
} \
} while (0)
-#define BOUNDS_CHECK(ptr, count) \
+# define BOUNDS_CHECK(ptr, count) \
do { \
if ((ptr) + (count) > eom) { \
__set_h_errno (NO_RECOVERY); \
return (NULL);
}
-extern struct hostent *gethostbyname2(const char *name, int af);
-libresolv_hidden_proto (gethostbyname2)
+extern struct hostent *res_gethostbyname2(const char *name, int af);
+libresolv_hidden_proto (res_gethostbyname2)
struct hostent *
-gethostbyname (const char *name)
+res_gethostbyname (const char *name)
{
struct hostent *hp;
return (NULL);
}
if (_res.options & RES_USE_INET6) {
- hp = gethostbyname2(name, AF_INET6);
+ hp = res_gethostbyname2(name, AF_INET6);
if (hp)
return (hp);
}
- return (gethostbyname2(name, AF_INET));
+ return (res_gethostbyname2(name, AF_INET));
}
+compat_symbol (libresolv, res_gethostbyname, res_gethostbyname, GLIBC_2_0);
struct hostent *
-gethostbyname2 (const char *name, int af)
+res_gethostbyname2 (const char *name, int af)
{
union
{
free (buf.buf);
return ret;
}
-libresolv_hidden_def (gethostbyname2)
+libresolv_hidden_def (res_gethostbyname2)
+compat_symbol (libresolv, res_gethostbyname2, res_gethostbyname2, GLIBC_2_0);
struct hostent *
-gethostbyaddr (const void *addr, socklen_t len, int af)
+res_gethostbyaddr (const void *addr, socklen_t len, int af)
{
const u_char *uaddr = (const u_char *)addr;
static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
__set_h_errno (NETDB_SUCCESS);
return (hp);
}
+compat_symbol (libresolv, res_gethostbyaddr, res_gethostbyaddr, GLIBC_2_0);
void
_sethtent (int f)
stayopen = f;
}
libresolv_hidden_def (_sethtent)
+compat_symbol (libresolv, _sethtent, _sethtent, GLIBC_2_0);
-void
+static void
_endhtent (void)
{
if (hostf && !stayopen) {
return (&host);
}
libresolv_hidden_def (_gethtent)
+compat_symbol (libresolv, _gethtent, _gethtent, GLIBC_2_0);
struct hostent *
_gethtbyname (const char *name)
}
return (_gethtbyname2(name, AF_INET));
}
+compat_symbol (libresolv, _gethtbyname, _gethtbyname, GLIBC_2_0);
struct hostent *
_gethtbyname2 (const char *name, int af)
return (p);
}
libresolv_hidden_def (_gethtbyname2)
+compat_symbol (libresolv, _gethtbyname2, _gethtbyname2, GLIBC_2_0);
struct hostent *
_gethtbyaddr (const char *addr, size_t len, int af)
return (p);
}
libresolv_hidden_def (_gethtbyaddr)
+compat_symbol (libresolv, _gethtbyaddr, _gethtbyaddr, GLIBC_2_0);
static void
map_v4v6_address (const char *src, char *dst)
needsort++;
}
}
+
+#endif /* SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_25) */