Path: utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!uupsi!vmp!sonyd1.Broadcast.Sony.COM!blilly.UUCP!balilly.UUCP!bruce From: bruce@balilly.UUCP (Bruce Lilly) Newsgroups: news.software.b Subject: Re: NNTP 1.5.10 / Cnews 15-Dec-1990 / Stupid UNIX exec Message-ID: <1991Jan31.023944.19068@blilly.UUCP> Date: 31 Jan 91 02:39:44 GMT References: <1991Jan30.062800.15853@ecst.csuchico.edu> Sender: news@blilly.UUCP (News Administrator) Organization: Bruce Lilly, Flushing, NY Lines: 69 In article <1991Jan30.062800.15853@ecst.csuchico.edu> warlock@ecst.csuchico.edu (John Kennedy) writes: > > I'm setting up a system with these beasties, and I've run into a hurdle >that someone may have delt with already or have a clever solution to. > > When a remote Pnews batches up an article, it is received by NNTP, tossed >into a temporary file in /usr/tmp, and it forks/execs inews. Fine and dandy, >expect that inews is a shell script and I can't do any sort of an exec() on >anything but a a.out-format file. It seems to be happy by execing ksh and >passing along the arguments to inews for ksh to deal with. (Seemingly solved >-- I only mention it because it isn't stock behavior). I also ran into this, but I don't recall exactly how I solved it. I'll just note in passing that one possible solution is contained in the exec(2) man page -- two members of the exec family will work with scripts (Hint: read the description of the ENOEXEC error return). > Inside inews, our pal anne.jones is called. Anne decides she must call "who >am I" for some reason. (Lack of $USER being set? What should it be set to?) >This is EVIL -- who yacks because the user isn't on a terminal and it can't >find the name. The decent into darkness has begun. > > It makes two other attempts to find a user's name, and probably with no name >to look with, either, since the "who" failed. It looks in /etc/passwd, which >fails because the machine doesn't have user accounts and then ypmatch, which >the machine doesn't have at all. > > Burp, regurgitate, error, nothing posted. > > Now: > (A) What is our little Anne trying to look up? The name that NNTP > runs under, or the user's name? The latter. > (B) Can I just write something to do what "who am i" should? (If so, > I presume it should return the info for (A).) Here's an excerpt from the anne.jones I use (it works for me, but your mileage may vary): # dig up user's name (a simple task, you'd think, but you'd be wrong) case "$LOGNAME" in "") # "who am i" on many Unixes does "ttyname(0)" and "getpwuid(getuid())" # if that fails - it can be confused by empty utmp entries (per jerqs); # "who am i