From owner-freebsd-bugs Fri Mar 15 08:40:06 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id IAA10000 for bugs-outgoing; Fri, 15 Mar 1996 08:40:06 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id IAA09982 Fri, 15 Mar 1996 08:40:04 -0800 (PST) Resent-Date: Fri, 15 Mar 1996 08:40:04 -0800 (PST) Resent-Message-Id: <199603151640.IAA09982@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, greg@greg.rim.or.jp Received: from rayearth.rim.or.jp (uucp@rayearth.rim.or.jp [202.247.130.242]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id IAA08488 for ; Fri, 15 Mar 1996 08:30:03 -0800 (PST) Received: (from uucp@localhost) by rayearth.rim.or.jp (8.7.5/3.4W3-uucp1) with UUCP id BAA07525 for FreeBSD-gnats-submit@freebsd.org; Sat, 16 Mar 1996 01:29:53 +0900 (JST) Received: from apollon.greg.rim.or.jp (apollon.greg.rim.or.jp [172.31.1.2]) by atena.greg.rim.or.jp (8.6.12/3.4Wbeta6) with ESMTP id BAA22149 for ; Sat, 16 Mar 1996 01:22:25 +0900 Received: by apollon.greg.rim.or.jp (8.7.4/3.3Wb-uucp-sendmail-slave-Ver-0.1-Beta) id BAA26562; Sat, 16 Mar 1996 01:22:24 +0900 (JST) Message-Id: <199603151622.BAA26562@apollon.greg.rim.or.jp> Date: Sat, 16 Mar 1996 01:22:24 +0900 (JST) From: greg@greg.rim.or.jp Reply-To: greg@greg.rim.or.jp To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: misc/1079: Can not work about get{host|net]byaddr on NIS. Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 1079 >Category: misc >Synopsis: Can not work about get{host|net]byaddr on NIS. >Confidential: yes >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 15 08:40:02 PST 1996 >Last-Modified: >Originator: Kensaku Masuda >Organization: Private domain >Release: FreeBSD 2.2-960303-SNAP i386 >Environment: My /etc/host.conf is # bind # If that doesn't work, then try the /etc/hosts file hosts # If you have YP/NIS configured, uncomment the next line nis >Description: I have two problems. and one of them is fixed, But left is not fixed. At first, If I selected NIS about host/net resolving, can not find symbol name from IP address. Ex) # netstat -r Routing tables Internet: Destination Gateway Flags Refs Use Netif Expire 127.0.0.1 127.0.0.1 UH 0 0 lo0 123.456.789/24 link#2 UC 0 0 MyName 0:0:1:6:39:68 UHLW 11 114467 ep0 278 123.456.789.1 0:20:af:26:a0:87 UHLW 8 95529 lo0 123.456.789.255 link#2 UHLW 1 527 At last, "exit" function in Standard C library has one problem. If some program is using STREAM functions. it will catch a signal at calling "exit" ( BUS ERROR ). But all program is not recving a signal. May be, only using "get{net/host]byaddr". >How-To-Repeat: 1st problem : Use NIS and call get{host/net]byaddr. 2nd problem : run " netstat " >Fix: This patch is fixed 1st problem. diff -ruN net.original/gethostbynis.c net/gethostbynis.c --- net.original/gethostbynis.c Sat Mar 16 00:30:59 1996 +++ net/gethostbynis.c Sat Mar 16 00:26:23 1996 @@ -111,5 +111,10 @@ _gethostbynisaddr(name) char *name; { - return _gethostbynis(name, "hosts.byaddr"); + struct in_addr in; + /* + * Fast Hack + */ + in.s_addr = *((long *)name); + return _gethostbynis(inet_ntoa(in), "hosts.byaddr"); } diff -ruN net.original/getnetbynis.c net/getnetbynis.c --- net.original/getnetbynis.c Sat Mar 16 00:30:56 1996 +++ net/getnetbynis.c Sat Mar 16 00:28:18 1996 @@ -122,8 +122,20 @@ if (type != AF_INET) return (NULL); - in.s_addr = addr; + /* + * The input is host byte oder, But inet_ntoa request network byte oder + */ + in.s_addr = htonl(addr); str = inet_ntoa(in); + /* + * Must checking. if inet_ntoa return NULL string, Will core dumped + */ + if(str == NULL) { + return NULL; + } + if(strlen(str) < 2) { + return NULL; + } cp = str + strlen(str) - 2; while(!strcmp(cp, ".0")) { *cp = '\0'; >Audit-Trail: >Unformatted: