Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jan 2003 15:41:13 +0100 (CET)
From:      Hartmut Brandt <brandt@fokus.gmd.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   sparc64/46729: gethostbyname fails for NIS
Message-ID:  <200301031441.h03EfD4t003598@catssrv.fokus.gmd.de>

next in thread | raw e-mail | index | archive | help

>Number:         46729
>Category:       sparc64
>Synopsis:       gethostbyname fails for NIS
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-sparc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 03 06:50:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hartmut Brandt
>Release:        FreeBSD 5.0-CURRENT sparc64
>Organization:
FhI Fokus
>Environment:
System: FreeBSD catssrv.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #20: Fri Jan 3 14:08:11 CET 2003 hbb@catssrv.fokus.gmd.de:/opt/obj/usr/src/sys/CATSSRV sparc64


	
>Description:

/usr/src/lib/libc/net/gethostbynis.c assumes, that an AF_INET address is
the same as an u_long. This is abviously false and leads to the effect, that
all IP addresses obtained via NIS are 0.0.0.0.
	
>How-To-Repeat:

Execute

	ping host-with-name-via-nis

and observe that ping is able to resolve the name, but the printed address is
0.0.0.0.

	
>Fix:

Apply the following patch and recompile and install libc:


Index: gethostbynis.c
===================================================================
RCS file: /usr/ncvs/src/lib/libc/net/gethostbynis.c,v
retrieving revision 1.15
diff -c -r1.15 gethostbynis.c
*** gethostbynis.c	22 Mar 2002 21:52:29 -0000	1.15
--- gethostbynis.c	3 Jan 2003 14:31:16 -0000
***************
*** 67,72 ****
--- 67,73 ----
  	static struct hostent h;
  	static char *domain = (char *)NULL;
  	static char ypbuf[YPMAXRECORD + 2];
+ 	in_addr_t addr;
  
  	switch(af) {
  	case AF_INET:
***************
*** 104,110 ****
  	*cp++ = '\0';
  	h.h_addr_list = host_addrs;
  	h.h_addr = hostaddr;
! 	*((u_long *)h.h_addr) = inet_addr(result);
  	h.h_length = size;
  	h.h_addrtype = AF_INET;
  	while (*cp == ' ' || *cp == '\t')
--- 105,112 ----
  	*cp++ = '\0';
  	h.h_addr_list = host_addrs;
  	h.h_addr = hostaddr;
! 	addr = inet_addr(result);
! 	bcopy((char *)&addr, h.h_addr, size);
  	h.h_length = size;
  	h.h_addrtype = AF_INET;
  	while (*cp == ' ' || *cp == '\t')
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-sparc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301031441.h03EfD4t003598>