Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site daemon.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!tektronix!daemon!richl
From: richl@daemon.UUCP (Rick Lindsley)
Newsgroups: net.unix-wizards
Subject: getlogin(3)
Message-ID: <303@daemon.UUCP>
Date: Wed, 16-Jan-85 20:11:52 EST
Article-I.D.: daemon.303
Posted: Wed Jan 16 20:11:52 1985
Date-Received: Sat, 19-Jan-85 00:22:11 EST
Organization: Tektronix, Beaverton OR
Lines: 23

Has anyone addressed the problems that getlogin() has when used from a
pty that is NOT a login pty? Script is one prime example, but a growing
number of other utilities also use ptys.

One possibility is to have getlogin trace parent process ids to arrive
at the TRUE login of a person; but this has the unpleasant side effect
of forcing any program which uses getlogin() to be setgid sys (we've
altered the perms on kmem for security reasons).

Another possibility is to have getlogin do a getuid() and getpwnam() if
it can't get a name out of utmp.

A third possibility is to ask the calling program to perform the above
check. (Getlogin will return a null string).

Before we go and choose an option, I would be interested in determining
if others have chosen a solution to this problem. I will be happy to
summarize to the net if necessary.

Rick Lindsley
Small Systems Support
Tektronix
...!{ihnp4,allegra,decvax}!tektronix!daemon!richl