Article View: comp.bugs.2bsd
Article #245Re: Cuserid() is a security hole
From: Stephen J. Friedl
Date: Wed, 31 May 1989 03:38
Date: Wed, 31 May 1989 03:38
26 lines
1620 bytes
1620 bytes
In article <289@levels.sait.edu.au>, ccdn@levels.sait.edu.au (DAVID NEWALL) writes:
> According to the manual, cuserid(3) is supposed to "return the character
> login name of the user". I interpret this as meaning it will return the
> login name of the invoker. This is _not_ what cuserid() does.
> [...]
> So people, do not, absolutely do not, rely on these functions to identify
> the user. Use getuid() or geteuid() instead.
Here is an alternate method that may be a little bit more
flexible (for Sys V, at least). First get the $LOGNAME
environment variable and look up the password entry for it. If
the uid here matches getuid (or geteuid, depending on your
application), go ahead and believe $LOGNAME. If it doesn't
match, forgery is going on and you have to use the getuid entry.
This technique allows multiple accounts sharing the same uid
to distinguish between them. Presumably, the accounts only share
if fraud between them is not a big deal.
Steve
--
Stephen J. Friedl / V-Systems, Inc. / Santa Ana, CA / +1 714 545 6442
3B2-kind-of-guy / friedl@vsi.com / {attmail, uunet, etc}!vsi!friedl
You can't have everything: where you would put it?
Technical Details
Message-ID:
<1125@vsi.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!vsi!friedlReferences:
<289@levels.sait.edu.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!vsi!friedl From: friedl@vsi.COM (Stephen J. Friedl) Newsgroups: comp.bugs.2bsd,comp.bugs.4bsd,comp.bugs.sys5,comp.unix.wizards Subject: Re: Cuserid() is a security hole Message-ID: <1125@vsi.COM> Date: 31 May 89 03:38:44 GMT References: <289@levels.sait.edu.au> Organization: V-Systems, Inc. -- Santa Ana, CA Lines: 26