summaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-25 08:56:57 +0000
committerRoland McGrath <roland@gnu.org>1996-06-25 08:56:57 +0000
commit5f0e6fc702296840d2daa39f83f6cb1e40073d58 (patch)
tree6e6c29e50f713eac4c87b54a6e5730fa0dedb65a /resolv
parent7f8116797fdb967571c00ec1d5b19d9d06813445 (diff)
Tue Jun 25 02:59:11 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>cvs/libc-960625
* malloc/malloc.h: Declare malloc_object_allocated_size, malloc_walk. * malloc/Makefile (dist-routines): Add malloc-size, malloc-walk. * malloc/malloc-size.c: New file. * malloc/malloc-walk.c: New file. * malloc/malloc-find.c (malloc_find_object_address): Return null if PTR is outside the heap. * elf/dl-load.c (_dl_map_object): If the requested name matches the soname of a loaded object, use that object. Mon Jun 24 19:57:01 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * Makefile (subdirs): Add nss. * inet/Makefile (routines): Add getrpcent, getrpcbyname, getrpcbynumber, getrpcent_r, getrpcbyname_r, getrpcbynumber_r. * inet/getrpcbynumber_r.c: New file. * inet/getrpcbynumber.c: New file. * inet/getrpcbyname.c: New file. * inet/getrpcbyname_r.c: New file. * inet/getrpcent_r.c: New file. * inet/getrpcent.c: New file. * nss/rpc-lookup.c: New file. * nss/nss_files/files-rpc.c: New file. * nss/Makefile (routines): Add rpc-lookup. (libnss_files-routines): Add files-rpc. * sunrpc/Makefile (routines): Remove getrpcent. * sunrpc/getrpcent.c: File removed. * nss/getXXent_r.c (REENTRANT_GETNAME): Clear NO_MORE when NIP is non-null on entry. * Makeconfig (rpath-link): Add $(nssobjdir). (nssobjdir): New variable. * Makerules: Move shared library building before objects rules, so versions are known before extra-lib.mk gets included. * extra-lib.mk (lib-noranlib): Depend on the shared object too. * pwd/getpwuid.c: Rewritten using nss. * pwd/getpwnam.c: Likewise. * pwd/getpwent.c: Likewise. * grp/getgrnam.c: Likewise. * grp/getgrgid.c: Likewise. * grp/getgrent.c: Likewise. * pwd/Makefile (routines): Add getpwent_r, getpwnam_r, getpwuid_r. * pwd/getpwent_r.c: New file. * pwd/getpwnam_r.c: New file. * pwd/getpwuid_r.c: New file. * grp/Makefile (routines): Add getgrent_r, getgrgid_r, getgrnam_r. * grp/getgrnam_r.c: New file. * grp/getgrgid_r.c: New file. * grp/getgrent_r.c: New file. * grp/Makefile (routines): Remove grpopen, grpread. * pwd/Makefile (routines): Remove pwdopen, pwdread. * grp/grpopen.c, grp/grpread.c, pwd/pwdopen.c, pwd/pwdread.c: Removed. * pwd/fgetpwent.c: Rewritten using files-parse.c. * grp/fgetgrent.c: Likewise. * nss/Makefile (routines): Add grp-lookup and pwd-lookup. * nss/pwd-lookup.c, nss/grp-lookup.c: New files. * nss/nss_files/files-grp.c: New file. * nss/nss_files/files-pwd.c: New file. * nss/Makefile (subdir-dirs): New variable; use it in vpath. * nss/nss_files/files-parse.c: New file. * nss/nss_files/files-XXX.c: New file. * nss/nss_files/files-hosts.c, nss/nss_files/files-proto.c, nss/nss_files/files-service.c, nss/nss_files/files-network.c: Rewritten using them. * nss/Makefile (libnss_files-routines): Remove files-host. Add files-hosts, files-grp, files-pwd. * nss/nss_dns/dns-network.c: Don't include <pthread.h>. Mon Jun 24 22:39:12 1996 Richard Henderson <rth@tamu.edu> * sysdeps/alpha/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE): A .plt entry now loads the .rela.plt offset directly rather than making us calculate it. Sun Jun 23 15:24:05 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * time/Makefile ($(installed-localtime-file) rule): Do $(make-target-directory) first. * resolv.h: Fix wrapper for resolv/resolv.h. * configure.in (ld --no-whole-archive check): Use AC_TRY_COMMAND. Compile dummy file and pass -nostdlib -nostartfiles so as not to require installed libraries. * shlib-versions (*-*-*): Set libresolv=2, libnss_files=1, libnss_dns=1. Sun Jun 23 19:42:05 1996 Ulrich Drepper <drepper@cygnus.com> * resolv/netdb.h (_PATH_NSSWITCH_CONF): New macro. * inet/herrno.c: New file. * resolv/res_init.c: Remove res_hconf calls. * nss/Makefile, nss/XXX-lookup.c, nss/file-lookup.c, nss/getXXbyYY.c, nss/getXXbyYY_r.c, nss/getXXent.c, nss/getXXent_r.c, nss/host-lookup.c, nss/network-lookup.c, nss/nsswitch.c, nss/nsswitch.h, nss/proto-lookup.c, nss/service-lookup.c: New files. Implementation of name service switch, following the approach in Solaris. Interface specification and general structure inspired by Peter Eriksson <pen@lysator.liu.se>. * nss/nss_files/files-host.c, nss/nss_files/files-network.c, nss/nss_files/files-proto.c, nss/nss_files/files-service.c: Implementation of libnss_files.so module for file based databases in NSS service. * nss/nss_dns/dns-host.c, nss/nss_dns/dns-network.c: Implementation if libnss_dns.so module for DNS name lookup in NSS service. * inet/getproto.c, inet/getprtent.c, inet/getprtname.c, inet/getservent.c, inet/getsrvbynm.c, inet/getsrvbypt.c: Changed to serve as interface to NSS. * inet/gethstbyad.c, inet/gethstbyad_r.c, inet/gethstbynm.c, inet/gethstbynm2.c, inet/gethstbynm2_r.c, inet/gethstbynm_r.c, inet/gethstent.c, inet/gethstent_r.c, inet/getnetbynm.c, inet/getnetbynm_r.c, inet/getnetbypt.c, inet/getnetbypt_r.c, inet/getnetent.c, inet/getnetent_r.c, inet/getproto_r.c, inet/getprtent_r.c, inet/getprtname_r.c, inet/getservent_r.c, inet/getsrvbynm_r.c, inet/getsrvbypt_r.c: New files. Implement interfaces to NSS, including reentrant functions. * resolv/getnetbyaddr.c, resolv/getnetbyname.c, resolv/getnetent.c, resolv/sethostent.c: Removed: Obsoleted by NSS. * resolv/mapv4v6addr.h, resolv/mapv4v6hostent.h: Extracted from gethnamaddr.c. These private functions are now used in more than one file. * resolv/inet_pton.c, resolv/gethnamaddr.c: Updated to bind-4.9.4-T5B. Sat Jun 22 16:49:47 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * rpm/Makefile ($(config)): Make sure the word list in the for loop is syntactically non-empty.
Diffstat (limited to 'resolv')
-rw-r--r--resolv/gethnamaddr.c502
-rw-r--r--resolv/getnetbyaddr.c57
-rw-r--r--resolv/getnetbyname.c64
-rw-r--r--resolv/getnetent.c162
-rw-r--r--resolv/inet_pton.c2
-rw-r--r--resolv/mapv4v6addr.h75
-rw-r--r--resolv/mapv4v6hostent.h90
-rw-r--r--resolv/netdb.h11
-rw-r--r--resolv/res_init.c4
-rw-r--r--resolv/sethostent.c62
10 files changed, 261 insertions, 768 deletions
diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c
index 161060ebd6..d3c45d0446 100644
--- a/resolv/gethnamaddr.c
+++ b/resolv/gethnamaddr.c
@@ -65,16 +65,12 @@ static char rcsid[] = "$Id$";
#include <arpa/nameser.h>
#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <netdb.h>
#include <resolv.h>
#include <ctype.h>
#include <errno.h>
#include <syslog.h>
-#include "res_hconf.h"
-
#ifndef LOG_AUTH
# define LOG_AUTH 0
#endif
@@ -98,7 +94,6 @@ static char rcsid[] = "$Id$";
#define MAXALIASES 35
#define MAXADDRS 35
-#define MAXADDRBUFSIZE 8192
static const char AskedForGot[] =
"gethostby*.getanswer: asked for \"%s\", got \"%s\"";
@@ -108,7 +103,7 @@ static struct hostent *gethostbyname_ipv4 __P((const char *));
static struct hostent host;
static char *host_aliases[MAXALIASES];
-static char hostbuf[MAXADDRBUFSIZE];
+static char hostbuf[8*1024];
static u_char host_addr[16]; /* IPv4 or IPv6 */
static FILE *hostf = NULL;
static int stayopen = 0;
@@ -435,7 +430,7 @@ gethostbyname2(name, af)
querybuf buf;
register const char *cp;
char *bp;
- int i, n, size, type, len;
+ int n, size, type, len;
extern struct hostent *_gethtbyname2();
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
@@ -506,55 +501,13 @@ gethostbyname2(name, af)
break;
}
- h_errno = HOST_NOT_FOUND;
- for (i = 0; i < _res_hconf.num_services; ++i) {
- struct hostent * hp;
- char * cp = (char *) name;
-
- if (_res_hconf.num_trimdomains > 0) {
- size_t name_len = strlen(name);
-
- cp = malloc(name_len + 1);
- memcpy(cp, name, name_len + 1);
- _res_hconf_trim_domain(cp);
- }
-
- hp = NULL;
- switch (_res_hconf.service[i]) {
- case SERVICE_BIND:
- if ((n = res_search(cp, C_IN, type,
- buf.buf, sizeof(buf))) < 0)
- {
- dprintf("res_search failed (%d)\n", n);
- break;
- }
- hp = getanswer(&buf, n, cp, type);
- break;
-
- case SERVICE_HOSTS:
- hp = _gethtbyname2(cp, af);
- break;
-#ifdef HAVE_NYS
- case SERVICE_NIS:
- hp = _getnishost(cp, "hosts.byname");
- break;
-#endif
- default:
- break;
- }
- if (cp != name)
- free(cp);
- if (hp) {
- if ((_res_hconf.flags & HCONF_FLAG_REORDER)
- && hp->h_addr_list[0] && hp->h_addr_list[1])
- _res_hconf_reorder_addrs(hp);
- _res_hconf_trim_domains(hp);
- return hp;
- }
+ if ((n = res_search(name, C_IN, type, buf.buf, sizeof(buf))) < 0) {
+ dprintf("res_search failed (%d)\n", n);
+ if (errno == ECONNREFUSED)
+ return (_gethtbyname2(name, af));
+ return (NULL);
}
- if (h_errno == NETDB_SUCCESS)
- h_errno = HOST_NOT_FOUND;
- return NULL;
+ return (getanswer(&buf, n, name, type));
}
struct hostent *
@@ -569,11 +522,12 @@ gethostbyaddr(addr, len, af)
querybuf buf;
register struct hostent *hp;
char qbuf[MAXDNAME+1], *qp;
+#ifdef SUNSECURITY
register struct hostent *rhp;
char **haddr;
u_long old_options;
char hname2[MAXDNAME+1];
- int i, old_num_trimdomains;
+#endif /*SUNSECURITY*/
extern struct hostent *_gethtbyaddr();
if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
@@ -606,130 +560,79 @@ gethostbyaddr(addr, len, af)
h_errno = NETDB_INTERNAL;
return (NULL);
}
-
- h_errno = NETDB_SUCCESS;
- for (i = 0; i < _res_hconf.num_services; ++i) {
- hp = NULL;
- switch (_res_hconf.service[i]) {
- case SERVICE_BIND:
- switch (af) {
- case AF_INET:
- (void) sprintf(qbuf,
- "%u.%u.%u.%u.in-addr.arpa",
- (uaddr[3] & 0xff),
- (uaddr[2] & 0xff),
- (uaddr[1] & 0xff),
- (uaddr[0] & 0xff));
- break;
- case AF_INET6:
- qp = qbuf;
- for (n = IN6ADDRSZ - 1; n >= 0; n--) {
- qp += SPRINTF((qp, "%x.%x.",
- uaddr[n] & 0xf,
- (uaddr[n] >> 4) & 0xf));
- }
- strcpy(qp, "ip6.int");
- break;
- default:
- abort();
- }
- n = res_query(qbuf, C_IN, T_PTR,
- (u_char *)buf.buf, sizeof buf.buf);
- if (n < 0) {
- dprintf("res_query failed (%d)\n", n);
- break;
- }
- hp = getanswer(&buf, n, qbuf, T_PTR);
- if (!hp)
- break; /* h_errno was set by getanswer() */
- if (af == AF_INET
- && (_res_hconf.flags & HCONF_FLAG_SPOOF)) {
- /*
- * Turn off search as the name should
- * be absolute, 'localhost' should be
- * matched by defnames
- */
- strncpy(hname2, hp->h_name, MAXDNAME);
- hname2[MAXDNAME] = '\0';
- old_options = _res.options;
- /*
- * Also turn off domain trimming to prevent it
- * from causing the name comparison to fail.
- */
- old_num_trimdomains =
- _res_hconf.num_trimdomains;
- _res.options &= ~RES_DNSRCH;
- _res.options |= RES_DEFNAMES;
- rhp = gethostbyname(hname2);
- _res.options = old_options;
- /* There must be an A record and
- the names must match. */
- if (!rhp || strcmp(hname2, rhp->h_name)) {
- syslog(LOG_NOTICE|LOG_AUTH,
- "gethostbyaddr: No A record for"
- " %s (verifying [%s])",
- hname2,
- inet_ntoa(*((struct in_addr *)
- addr)));
- h_errno = HOST_NOT_FOUND;
- break;
- }
- for (haddr = rhp->h_addr_list; *haddr; haddr++)
- if (!memcmp(*haddr, addr, INADDRSZ))
- break;
- if (!*haddr) {
- syslog(LOG_NOTICE|LOG_AUTH,
- "gethostbyaddr: A record of %s"
- " != PTR record [%s]",
- hname2,
- inet_ntoa(*((struct in_addr *)
- addr)));
- h_errno = HOST_NOT_FOUND;
- break;
- }
- }
- hp->h_addrtype = af;
- hp->h_length = len;
- bcopy(addr, host_addr, len);
- h_addr_ptrs[0] = (char *)host_addr;
- h_addr_ptrs[1] = NULL;
- if (af == AF_INET && (_res.options & RES_USE_INET6)) {
- map_v4v6_address((char*)host_addr,
- (char*)host_addr);
- hp->h_addrtype = AF_INET6;
- hp->h_length = IN6ADDRSZ;
- }
- h_errno = NETDB_SUCCESS;
- break;
-
- case SERVICE_HOSTS:
- hp = _gethtbyaddr(addr, len, af);
- break;
-
-#ifdef HAVE_NYS
- case SERVICE_NIS:
- if (af == AF_INET) {
- sprintf(qbuf, "%u.%u.%u.%u",
- (unsigned)addr[0] & 0xff,
- (unsigned)addr[1] & 0xff,
- (unsigned)addr[2] & 0xff,
- (unsigned)addr[3] & 0xff);
- hp = _getnishost(qbuf, "hosts.byaddr");
- }
- break;
-#endif
-
- default:
- break;
- }
- if (hp) {
- _res_hconf_trim_domains(hp);
- return hp;
+ switch (af) {
+ case AF_INET:
+ (void) sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa",
+ (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff),
+ (uaddr[1] & 0xff),
+ (uaddr[0] & 0xff));
+ break;
+ case AF_INET6:
+ qp = qbuf;
+ for (n = IN6ADDRSZ - 1; n >= 0; n--) {
+ qp += SPRINTF((qp, "%x.%x.",
+ uaddr[n] & 0xf,
+ (uaddr[n] >> 4) & 0xf));
}
+ strcpy(qp, "ip6.int");
+ break;
+ default:
+ abort();
+ }
+ n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf);
+ if (n < 0) {
+ dprintf("res_query failed (%d)\n", n);
+ if (errno == ECONNREFUSED)
+ return (_gethtbyaddr(addr, len, af));
+ return (NULL);
}
- if (h_errno == NETDB_SUCCESS)
+ if (!(hp = getanswer(&buf, n, qbuf, T_PTR)))
+ return (NULL); /* h_errno was set by getanswer() */
+#ifdef SUNSECURITY
+ if (af == AF_INET) {
+ /*
+ * turn off search as the name should be absolute,
+ * 'localhost' should be matched by defnames
+ */
+ strncpy(hname2, hp->h_name, MAXDNAME);
+ hname2[MAXDNAME] = '\0';
+ old_options = _res.options;
+ _res.options &= ~RES_DNSRCH;
+ _res.options |= RES_DEFNAMES;
+ if (!(rhp = gethostbyname(hname2))) {
+ syslog(LOG_NOTICE|LOG_AUTH,
+ "gethostbyaddr: No A record for %s (verifying [%s])",
+ hname2, inet_ntoa(*((struct in_addr *)addr)));
+ _res.options = old_options;
+ h_errno = HOST_NOT_FOUND;
+ return (NULL);
+ }
+ _res.options = old_options;
+ for (haddr = rhp->h_addr_list; *haddr; haddr++)
+ if (!memcmp(*haddr, addr, INADDRSZ))
+ break;
+ if (!*haddr) {
+ syslog(LOG_NOTICE|LOG_AUTH,
+ "gethostbyaddr: A record of %s != PTR record [%s]",
+ hname2, inet_ntoa(*((struct in_addr *)addr)));
h_errno = HOST_NOT_FOUND;
- return NULL;
+ return (NULL);
+ }
+ }
+#endif /*SUNSECURITY*/
+ hp->h_addrtype = af;
+ hp->h_length = len;
+ bcopy(addr, host_addr, len);
+ h_addr_ptrs[0] = (char *)host_addr;
+ h_addr_ptrs[1] = NULL;
+ if (af == AF_INET && (_res.options & RES_USE_INET6)) {
+ map_v4v6_address((char*)host_addr, (char*)host_addr);
+ hp->h_addrtype = AF_INET6;
+ hp->h_length = IN6ADDRSZ;
+ }
+ h_errno = NETDB_SUCCESS;
+ return (hp);
}
void
@@ -824,44 +727,6 @@ _gethtent()
return (&host);
}
-struct hstorage {
- char *name; /* canonical name */
- char ** alp; /* address list pointer */
- char * abp; /* address buffer pointer */
- char * addr_list[MAXADDRS + 1]; /* address list storage */
- char addr_buf[MAXADDRBUFSIZE]; /* addresses storage */
-};
-
-static void
-append_addr (struct hstorage * hs, struct hostent *p)
-{
- if (hs->alp < hs->addr_list + MAXADDRS
- && hs->abp + p->h_length < hs->addr_buf + MAXADDRBUFSIZE)
- {
- hs->alp[0] = hs->abp;
- hs->alp[1] = 0;
- memcpy(hs->abp, p->h_addr_list[0], p->h_length);
- hs->abp += p->h_length;
- ++hs->alp;
- }
-}
-
-/*
- * Lookup IP address and aliases for host NAME. If multiaddress mode
- * is enabled, the entire /etc/hosts file is searched and the union of
- * all addresses found for NAME is returned (this may be slow with
- * large /etc/hosts files, but is convenient for smallish sites that
- * don't want to go through the complexity of running named locally).
- * If multiaddress mode is enabled, the address returned in
- * h_addr_list[0] is one that is on the same net as one of the host's
- * local addresses (if such an address exists). For compatibility
- * with the BIND version of gethostbyname(), the alias field is empty
- * unless the name being looked up is an alias itself. In the latter
- * case, the name field contains the canonical name and the alias
- * field the name that is being looked up. A difference from the BIND
- * version is that this is true even if the alias applies only to one
- * of the interfaces on the target host.o
- */
struct hostent *
_gethtbyname(name)
const char *name;
@@ -886,163 +751,14 @@ _gethtbyname2(name, af)
register char **cp;
_sethtent(0);
-
- if (_res_hconf.flags & HCONF_FLAG_MULTI) {
- /*
- * More statics; not pretty, but it would require
- * interface changes to make these functions
- * reentrant.
- */
- static char *aliases[2] = {0};
- static struct hstorage self = {0}, target = {0};
- static size_t self_name_size = 0; /* Allocated in self.name. */
- static struct hostent ht;
- int found;
-
- if (aliases[0])
- free (aliases[0]); /* Malloced in a prev call. */
- aliases[0] = aliases[1] = 0;
-
- /* Get current host name in a large enough buffer. */
- do {
- errno = 0;
-
- if (self.name)
- {
- self_name_size += self_name_size;
- self.name =
- realloc (self.name, self_name_size);
- } else {
- self_name_size = 128; /* Initial guess */
- self.name = malloc (self_name_size);
- }
-
- if (! self.name)
- {
- errno = ENOMEM;
- return 0;
- }
- } while ((gethostname(self.name, self_name_size) == 0
- && !memchr (self.name, '\0', self_name_size))
- || errno == ENAMETOOLONG);
-
- if (errno)
- /* gethostname failed, abort. */
- {
- free (self.name);
- self.name = 0;
- }
-
- self.alp = self.addr_list;
- self.abp = self.addr_buf;
-
- if (target.name)
- free (target.name);
- target.name = strdup (name);
-
- target.alp = target.addr_list;
- target.abp = target.addr_buf;
-
- _sethtent(0);
- while ((p = _gethtent()) != 0) {
- found = 1;
-
- if (p->h_addrtype != af)
- continue;
- if (strcasecmp(p->h_name, name) != 0) {
- found = 0;
- for (cp = p->h_aliases; *cp; ++cp)
- if (strcasecmp(*cp, name) == 0) {
- found = 1;
- if (!aliases[0]) {
- aliases[0] =
- target.name;
- target.name =
- strdup (p->h_name);
- }
- break;
- }
- }
- if (found) {
- /* they better be all the same type and length! */
- ht.h_addrtype = p->h_addrtype;
- ht.h_length = p->h_length;
- append_addr(&target, p);
- /*
- * If the current hostentry is for the target host, we don't
- * check for the local host name. This nicely optimizes the
- * case where NAME is a local name since address ordering
- * doesn't matter in that case.
- */
- continue;
- }
- found = 1;
- if (strcasecmp(p->h_name, self.name) != 0) {
- found = 0;
- for (cp = p->h_aliases; *cp; ++cp)
- if (strcasecmp(*cp, self.name) == 0) {
- found = 1;
- break;
- }
- }
- if (found) {
- append_addr(&self, p);
- }
- }
- _endhtent();
-
- if (target.alp == target.addr_list)
- return NULL; /* found nothing */
-
- ht.h_aliases = aliases;
- ht.h_name = target.name;
- ht.h_addr_list = target.addr_list;
- /*
- * XXX (davidm) Isn't this subsumed by REORDER???
- *
- * Finding the `best' address is necessarily address
- * specific. For now, we do IPv4 addresses only.
- */
- if (af == AF_INET) {
- u_int32_t a1, a2, diff, mindiff = ~0;
- int i, j, bestaddr = 0;
-
- for (i = 0; self.addr_list[i]; ++i) {
- for (j = 0; target.addr_list[j]; ++j) {
- memcpy(&a1, self.addr_list[i], 4);
- memcpy(&a2, target.addr_list[j], 4);
- a1 = ntohl(a1);
- a2 = ntohl(a2);
- diff = a1 ^ a2;
- if (diff < mindiff) {
- bestaddr = j;
- mindiff = diff;
- }
- }
- }
- if (bestaddr > 0) {
- char * tmp;
-
- tmp = target.addr_list[0];
- target.addr_list[0] = target.addr_list[bestaddr];
- target.addr_list[bestaddr] = tmp;
- }
- } else if (af == AF_INET6) {
- /* XXX To do!!! */
- }
- ht.h_addr_list = target.addr_list;
- return &ht;
- } else {
- _sethtent(0);
- while (p = _gethtent()) {
- if (p->h_addrtype != af)
- continue;
- if (strcasecmp(p->h_name, name) == 0)
- break;
- for (cp = p->h_aliases; *cp != 0; cp++)
- if (strcasecmp(*cp, name) == 0)
- goto found;
- }
+ while (p = _gethtent()) {
+ if (p->h_addrtype != af)
+ continue;
+ if (strcasecmp(p->h_name, name) == 0)
+ break;
+ for (cp = p->h_aliases; *cp != 0; cp++)
+ if (strcasecmp(*cp, name) == 0)
+ goto found;
}
found:
_endhtent();
@@ -1191,47 +907,7 @@ ht_gethostbyaddr(addr, len, af)
struct hostent *
gethostent()
{
- struct hostent * hp;
- int i;
-
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
- h_errno = NETDB_INTERNAL;
- return (NULL);
- }
-
- /*
- * This doesn't look quite right. Shouldn't we read one
- * service until it returns 0, then move on to the next
- * service? If so, it requires adding some state and
- * initializing that state in sethostent().
- * (davidm@azstarnet.com)
- */
- for (i = 0; i < _res_hconf.num_services; ++i) {
- hp = NULL;
- switch (_res_hconf.service[i]) {
- case SERVICE_HOSTS:
- hp = _gethtent ();
- break;
-
-#ifdef HAVE_NYS
- case SERVICE_NIS:
- hp = _getnishost (NULL, "hosts.byname");
- break;
-#endif
-
- case SERVICE_BIND:
- default:
- break;
- }
- if (hp) {
- if ((_res_hconf.flags & HCONF_FLAG_REORDER)
- && hp->h_addr_list[0] && hp->h_addr_list[1])
- _res_hconf_reorder_addrs (hp);
- return hp;
- }
- }
- h_errno = HOST_NOT_FOUND;
- return NULL;
+ return (_gethtent());
}
void
diff --git a/resolv/getnetbyaddr.c b/resolv/getnetbyaddr.c
deleted file mode 100644
index 32513cc387..0000000000
--- a/resolv/getnetbyaddr.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetbyaddr.c 1.1 (Coimbra) 93/06/02";
-static char rcsid[] = "$Id$";
-#endif /* LIBC_SCCS and not lint */
-
-#include <netdb.h>
-
-extern int _net_stayopen;
-
-struct netent *
-_getnetbyaddr(net, type)
- register unsigned long net;
- register int type;
-{
- register struct netent *p;
-
- setnetent(_net_stayopen);
- while (p = getnetent())
- if (p->n_addrtype == type && p->n_net == net)
- break;
- if (!_net_stayopen)
- endnetent();
- return (p);
-}
diff --git a/resolv/getnetbyname.c b/resolv/getnetbyname.c
deleted file mode 100644
index cc3f281c5d..0000000000
--- a/resolv/getnetbyname.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetbyname.c 8.1 (Berkeley) 6/4/93";
-static char sccsid_[] = "from getnetbyname.c 1.1 (Coimbra) 93/06/02";
-static char rcsid[] = "$Id$";
-#endif /* LIBC_SCCS and not lint */
-
-#include <netdb.h>
-#include <string.h>
-
-extern int _net_stayopen;
-
-struct netent *
-_getnetbyname(name)
- register const char *name;
-{
- register struct netent *p;
- register char **cp;
-
- setnetent(_net_stayopen);
- while (p = getnetent()) {
- if (strcasecmp(p->n_name, name) == 0)
- break;
- for (cp = p->n_aliases; *cp != 0; cp++)
- if (strcasecmp(*cp, name) == 0)
- goto found;
- }
-found:
- if (!_net_stayopen)
- endnetent();
- return (p);
-}
diff --git a/resolv/getnetent.c b/resolv/getnetent.c
deleted file mode 100644
index 7ec5607781..0000000000
--- a/resolv/getnetent.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* Portions Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
- * Dep. Matematica Universidade de Coimbra, Portugal, Europe
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * from getnetent.c 1.1 (Coimbra) 93/06/02
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93";
-static char rcsid[] = "$Id$";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-#include <stdio.h>
-#include <resolv.h>
-#include <netdb.h>
-#include <string.h>
-
-#ifndef _PATH_NETWORKS
-#define _PATH_NETWORKS "/etc/networks"
-#endif
-
-#define MAXALIASES 35
-
-static FILE *netf;
-static char line[BUFSIZ+1];
-static struct netent net;
-static char *net_aliases[MAXALIASES];
-int _net_stayopen;
-
-void _setnetent __P((int));
-void _endnetent __P((void));
-
-void
-setnetent(stayopen)
- int stayopen;
-{
-
- sethostent(stayopen);
- _setnetent(stayopen);
-}
-
-void
-endnetent()
-{
-
- endhostent();
- _endnetent();
-}
-
-void
-_setnetent(f)
- int f;
-{
-
- if (netf == NULL)
- netf = fopen(_PATH_NETWORKS, "r" );
- else
- rewind(netf);
- _net_stayopen |= f;
-}
-
-void
-_endnetent()
-{
-
- if (netf) {
- fclose(netf);
- netf = NULL;
- }
- _net_stayopen = 0;
-}
-
-struct netent *
-getnetent()
-{
- char *p;
- register char *cp, **q;
-
- if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "r" )) == NULL)
- return (NULL);
-again:
- p = fgets(line, BUFSIZ, netf);
- if (p == NULL)
- return (NULL);
- if (*p == '#')
- goto again;
- cp = strpbrk(p, "#\n");
- if (cp == NULL)
- goto again;
- *cp = '\0';
- net.n_name = p;
- cp = strpbrk(p, " \t");
- if (cp == NULL)
- goto again;
- *cp++ = '\0';
- while (*cp == ' ' || *cp == '\t')
- cp++;
- p = strpbrk(cp, " \t");
- if (p != NULL)
- *p++ = '\0';
- net.n_net = inet_network(cp);
- net.n_addrtype = AF_INET;
- q = net.n_aliases = net_aliases;
- if (p != NULL) {
- cp = p;
- while (cp && *cp) {
- if (*cp == ' ' || *cp == '\t') {
- cp++;
- continue;
- }
- if (q < &net_aliases[MAXALIASES - 1])
- *q++ = cp;
- cp = strpbrk(cp, " \t");
- if (cp != NULL)
- *cp++ = '\0';
- }
- }
- *q = NULL;
- return (&net);
-}
diff --git a/resolv/inet_pton.c b/resolv/inet_pton.c
index cfc069d891..d0d45ae3da 100644
--- a/resolv/inet_pton.c
+++ b/resolv/inet_pton.c
@@ -59,7 +59,7 @@ inet_pton(af, src, dst)
case AF_INET6:
return (inet_pton6(src, dst));
default:
- errno = EINVAL;
+ errno = EAFNOSUPPORT;
return (-1);
}
/* NOTREACHED */
diff --git a/resolv/mapv4v6addr.h b/resolv/mapv4v6addr.h
new file mode 100644
index 0000000000..4295398f45
--- /dev/null
+++ b/resolv/mapv4v6addr.h
@@ -0,0 +1,75 @@
+/*
+ * ++Copyright++ 1985, 1988, 1993
+ * -
+ * Copyright (c) 1985, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * --Copyright--
+ */
+
+#include <string.h>
+#include <arpa/nameser.h>
+
+static void
+map_v4v6_address (const char *src, char *dst)
+{
+ u_char *p = (u_char *) dst;
+ char tmp[INADDRSZ];
+ int i;
+
+ /* Stash a temporary copy so our caller can update in place. */
+ bcopy (src, tmp, INADDRSZ);
+ /* Mark this ipv6 addr as a mapped ipv4. */
+ for (i = 0; i < 10; i++)
+ *p++ = 0x00;
+ *p++ = 0xff;
+ *p++ = 0xff;
+ /* Retrieve the saved copy and we're done. */
+ bcopy (tmp, (void *) p, INADDRSZ);
+}
diff --git a/resolv/mapv4v6hostent.h b/resolv/mapv4v6hostent.h
new file mode 100644
index 0000000000..c3fb8b5c11
--- /dev/null
+++ b/resolv/mapv4v6hostent.h
@@ -0,0 +1,90 @@
+/*
+ * ++Copyright++ 1985, 1988, 1993
+ * -
+ * Copyright (c) 1985, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * --Copyright--
+ */
+
+#include <arpa/nameser.h>
+#include <sys/socket.h>
+
+typedef union {
+ int32_t al;
+ char ac;
+} align;
+
+static void
+map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
+{
+ char **ap;
+
+ if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
+ return;
+ hp->h_addrtype = AF_INET6;
+ hp->h_length = IN6ADDRSZ;
+ for (ap = hp->h_addr_list; *ap; ap++)
+ {
+ int i = sizeof (align) - ((u_long) *bpp % sizeof (align));
+
+ if (*lenp < (i + IN6ADDRSZ))
+ {
+ /* Out of memory. Truncate address list here. XXX */
+ *ap = NULL;
+ return;
+ }
+ *bpp += i;
+ *lenp -= i;
+ map_v4v6_address (*ap, *bpp);
+ *ap = *bpp;
+ *bpp += IN6ADDRSZ;
+ *lenp -= IN6ADDRSZ;
+ }
+}
diff --git a/resolv/netdb.h b/resolv/netdb.h
index fd06e17bb4..38367e324f 100644
--- a/resolv/netdb.h
+++ b/resolv/netdb.h
@@ -67,11 +67,12 @@
#endif
#include <sys/cdefs.h>
-#define _PATH_HEQUIV "/etc/hosts.equiv"
-#define _PATH_HOSTS "/etc/hosts"
-#define _PATH_NETWORKS "/etc/networks"
-#define _PATH_PROTOCOLS "/etc/protocols"
-#define _PATH_SERVICES "/etc/services"
+#define _PATH_HEQUIV "/etc/hosts.equiv"
+#define _PATH_HOSTS "/etc/hosts"
+#define _PATH_NETWORKS "/etc/networks"
+#define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf"
+#define _PATH_PROTOCOLS "/etc/protocols"
+#define _PATH_SERVICES "/etc/services"
extern int h_errno;
diff --git a/resolv/res_init.c b/resolv/res_init.c
index 4e8af680c1..305dabfcaf 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -76,8 +76,6 @@ static char rcsid[] = "$Id$";
# include "../conf/portability.h"
#endif
-#include "res_hconf.h"
-
/*-------------------------------------- info about "sortlist" --------------
* Marc Majka 1994/04/16
* Allan Nathanson 1994/10/29 (BIND 4.9.3.x)
@@ -421,8 +419,6 @@ res_init()
if ((cp = getenv("RES_OPTIONS")) != NULL)
res_setoptions(cp, "env");
_res.options |= RES_INIT;
-
- _res_hconf_init ();
return (0);
}
diff --git a/resolv/sethostent.c b/resolv/sethostent.c
deleted file mode 100644
index e7a59dd75a..0000000000
--- a/resolv/sethostent.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1985, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sethostent.c 8.1 (Berkeley) 6/4/93";
-static char rcsid[] = "$Id$";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/param.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <netdb.h>
-#include <resolv.h>
-
-void _res_close __P((void));
-
-void
-sethostent(stayopen)
- int stayopen;
-{
- if ((_res.options & RES_INIT) == 0 && res_init() == -1)
- return;
- if (stayopen)
- _res.options |= RES_STAYOPEN | RES_USEVC;
-}
-
-void
-endhostent()
-{
- _res.options &= ~(RES_STAYOPEN | RES_USEVC);
- _res_close();
-}