diff options
author | Roland McGrath <roland@gnu.org> | 1996-06-25 08:56:57 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-06-25 08:56:57 +0000 |
commit | 5f0e6fc702296840d2daa39f83f6cb1e40073d58 (patch) | |
tree | 6e6c29e50f713eac4c87b54a6e5730fa0dedb65a /resolv/gethnamaddr.c | |
parent | 7f8116797fdb967571c00ec1d5b19d9d06813445 (diff) | |
download | glibc-5f0e6fc702296840d2daa39f83f6cb1e40073d58.tar glibc-5f0e6fc702296840d2daa39f83f6cb1e40073d58.tar.gz glibc-5f0e6fc702296840d2daa39f83f6cb1e40073d58.tar.bz2 glibc-5f0e6fc702296840d2daa39f83f6cb1e40073d58.zip |
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/gethnamaddr.c')
-rw-r--r-- | resolv/gethnamaddr.c | 502 |
1 files changed, 89 insertions, 413 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 |