summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorgallatin <gallatin@FreeBSD.org>1999-01-25 03:26:45 +0000
committergallatin <gallatin@FreeBSD.org>1999-01-25 03:26:45 +0000
commitbd8ffb71c5dc0f7945db6f568d6014e7ab9d3392 (patch)
tree0bde7bfd5764dc8b0addb433404baed1900febb4 /lib
parent389217999ad2493761453e5b16f7308a4c7fb4f6 (diff)
downloadFreeBSD-src-bd8ffb71c5dc0f7945db6f568d6014e7ab9d3392.zip
FreeBSD-src-bd8ffb71c5dc0f7945db6f568d6014e7ab9d3392.tar.gz
gethostbyname2() was broken for lookups via NIS on FreeBSD/alpha
due to _gethostbynis() setting h.h_length to sizeof(u_long), which works out to 8 on alphas. And 8!= NS_INADDRSZ.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/gethostbynis.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c
index 45dbe5a..517cb9c 100644
--- a/lib/libc/net/gethostbynis.c
+++ b/lib/libc/net/gethostbynis.c
@@ -24,14 +24,15 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)$Id$";
-static char rcsid[] = "$Id$";
+static char sccsid[] = "@(#)$Id: gethostbynis.c,v 1.8 1997/02/22 15:00:08 peter Exp $";
+static char rcsid[] = "$Id: gethostbynis.c,v 1.8 1997/02/22 15:00:08 peter Exp $";
#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 <netdb.h>
#include <stdio.h>
#include <stdlib.h>
@@ -62,16 +63,18 @@ _gethostbynis(name, map, af)
#ifdef YP
register char *cp, **q;
char *result;
- int resultlen;
+ int resultlen,size;
static struct hostent h;
static char *domain = (char *)NULL;
static char ypbuf[YPMAXRECORD + 2];
switch(af) {
case AF_INET:
+ size = NS_INADDRSZ;
break;
default:
case AF_INET6:
+ size = NS_IN6ADDRSZ;
errno = EAFNOSUPPORT;
return NULL;
}
@@ -97,7 +100,7 @@ _gethostbynis(name, map, af)
h.h_addr_list = host_addrs;
h.h_addr = hostaddr;
*((u_long *)h.h_addr) = inet_addr(result);
- h.h_length = sizeof(u_long);
+ h.h_length = size;
h.h_addrtype = AF_INET;
while (*cp == ' ' || *cp == '\t')
cp++;
OpenPOWER on IntegriCloud