get effective and real user names in a setuid program in linux

From: vimala (vimala_at_ncb.ernet.in)
Date: 07/31/03


Date: 31 Jul 2003 04:42:12 -0700

Hi,
        I have to write a setuid program which is going to check for
accesslogs based on the real user who had invoked the executable.

         I need to get the real and effective user-ids of the system
and based on the real user-id i need to filter logs only for that
user and give it for further activity. My idea was to get the real
userid, groupid and search for a pattern x:userid:groupid in the
/etc/password file. But again that involves fork, exec, write the
result to some file etc.....

           Instead of doing all that is there any other way of getting
all this done???

-kellogy


Quantcast