Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!oberon!cit-vax!ucla-cs!zen!ucbcad!ames!hc!beta!cmcl2!phri!roy From: roy@phri.UUCP (Roy Smith) Newsgroups: comp.unix.wizards Subject: Re: trouble with getpwuid(3) on SunOS-3.2 (mystery solved) Message-ID: <2782@phri.UUCP> Date: Fri, 10-Jul-87 23:20:45 EDT Article-I.D.: phri.2782 Posted: Fri Jul 10 23:20:45 1987 Date-Received: Sun, 12-Jul-87 15:45:04 EDT References: <2761@phri.UUCP> Reply-To: roy@phri.UUCP (Roy Smith) Distribution: world Organization: Public Health Research Institute, NYC, NY Lines: 40 Keywords: /etc/hosts About a week ago, I posted a somewhat confused query about problems we were having with getpwuid() on SunOS-3.2 when running a 3.0 binary, namely that when handed a valid uid, getpwuid would return NULL. I now know what was wrong. The key to the puzzle was supplied by Mark Plotnick (allegra!mp) who reported that on some of his SunOS-3.2 machines, bind(2) would fail, reproducably, in certain situations. I passed this off as not being our problem until I noticed that talk (straight off the 3.2 distribution tape) didn't work, failing in a bind(2) call which should have worked. I'm not sure of all the details, but the problem was that /etc/hosts on that machine was totally bogus. When I put a proper hosts file in place and rebooted, everything worked. What I still can't figure out is why things failed as they did. YP was clearly working because lots of things that depend on it worked (ls -l, for example). If YP is up, it shouldn't make any difference what's in (or not in) the local hosts file. But, in the getpwuid() example, if I used a uid which was in the local /etc/passwd file, it worked fine, but one in the YP passwd file failed. In the case of talk, the bind that was failing gave the local host's address (not "localhost", but the real local internet address). That address wasn't in the local /etc/hosts but was in the YP /etc/hosts. On the other hand, lots of applications which involved host lookups using YP (rlogin, sendmail, rcp, NFS) worked fine. Well, as Andy Shore said, "I couldn't imagine the getuid or getpwuid might fail, but in the YP world, you never know!" Roy Smith, {allegra,cmcl2,philabs}!phri!roy System Administrator, Public Health Research Institute 455 First Avenue, New York, NY 10016 Don't adjust the horizontal. Don't adjust the vertical. Your system's not broken, you've simply entered the Yellow Pages! -- Roy Smith, {allegra,cmcl2,philabs}!phri!roy System Administrator, Public Health Research Institute 455 First Avenue, New York, NY 10016