Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!munnari.oz.au!mel.dit.csiro.au!yarra!bacchus!david From: david@bacchus.esa.oz.au (David Burren) Newsgroups: comp.unix.questions Subject: Re: who am i? Message-ID: <839@bacchus.esa.oz.au> Date: 28 Nov 90 04:37:56 GMT References: <6358@minyos.xx.rmit.oz.au> Organization: none Lines: 21 In <6358@minyos.xx.rmit.oz.au> s887212@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@bacchus.esa.oz.au Software Development Engineer Phone: +61 3 819 4554 Expert Solutions Australia, Hawthorn, VIC