russell@ccu1.aukuni.ac.nz (Russell J Fulton;ccc032u) (02/18/91)
The cuserid() call sometime lies! We have a setuid program that used cuserid to find out who was running the program.( Some users are priviledged.) We soon noticed that cuserid sometimes returned the wrong login name! and we had to swap over to using getpwuid to find the login name of the user. In some cases it is predictably wrong eg. if the program is executed from a shell in Unipress emacs cuserid always returns telnet. But in other cases it seems to pick a random (valid) logname. Is this a known problem ? In any case we are reporting it as a bug. Russell. -- Russell Fulton, Computer Center, University of Auckland, New Zealand. <rj_fulton@aukuni.ac.nz>
HERBER@FNALA.FNAL.GOV ("Randolph J. Herber, CD/DCD/SP, x2966") (02/21/91)
cuserid(3) uses getlogin(3). getlogin(3) uses /etc/utmp to determine userid from control terminal of process. This can be confused by several causes. The /etc/utmp file may be damaged. The control terminal may belong to another user. The process may not have a control terminal. Randy Herber, herber@fnalf.fnal.gov