who am i?
David Burren
david at bacchus.esa.oz.au
Wed Nov 28 15:37:56 AEST 1990
In <6358 at minyos.xx.rmit.oz.au> s887212 at minyos.xx.rmit.oz.au (Stephen Riehm [Romulis]) writes:
>I am writing a program that needs to know who is running it. at the moment
>I am using getuid() to index into the /etc/passwd file for the details
>needed (like name etc). However I have noticed that it doesn't always
>return the right response after the process table (I assume) gets a bit
>messed up. (Xterms do wonderful things to the process table dont they?! :)
>Is there a GUARANTEED way of getting the information about the user?
>I dont want to rely on environment variables as they can easily be forged
>or not set by the user.
If getuid() does not return the correct value then surely your Unix is dead,
broken, ratshit, ....... _DEAD_?
Are you sure you're not losing it somewhere after the getuid()?
You're not doing a setuid(geteuid()) somewhere from within a suid program?
_____________________________________________________________________________
David Burren [Athos] Email: david at bacchus.esa.oz.au
Software Development Engineer Phone: +61 3 819 4554
Expert Solutions Australia, Hawthorn, VIC
More information about the Comp.unix.questions
mailing list