Date: Sat, 16 Mar 1996 01:22:24 +0900 (JST) From: greg@greg.rim.or.jp To: FreeBSD-gnats-submit@freebsd.org Subject: misc/1079: Can not work about get{host|net]byaddr on NIS. Message-ID: <199603151622.BAA26562@apollon.greg.rim.or.jp> Resent-Message-ID: <199603151640.IAA09982@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603151622.BAA26562>