Re: High UID support for Linux

Jim Bourne (jbourne@affinity-systems.ab.ca)
Wed, 2 Dec 1998 10:13:21 -0700 (MST)


On 1 Dec 1998, H. Peter Anvin wrote:

> > And since the problem is to replace getpwent with getenv(HOME), you have to
> > recognize that the output of getpwent is only used to extract the home
> > directory and then patch it up correctly. So much trouble, so little gain.
> >
>
> It's also important to recognize that using getpwent to extract one's
> own home directory is *WRONG*. HOME and USER may point to a different
> place/user than getuid() and getpwuid(getuid()) will give you; this is
> quite common for setuid programs and when using su -m.

I've been following this thread a bit as I'm interested in the problem.

Just a thought, what about using the utmp entry (if the user has a
controlling tty mind you) for getting the userid, then do getpwnam() to pull
the passwd data on them?

Without a controlling tty, it of course wouldn't work, and in an su
situation it would return the real user not the user su'd to... But this
might be a better method then using environment vars.

Regards,
Jim

>
> -hpa
> --
> PGP: 2047/2A960705 BA 03 D3 2C 14 A8 A8 BD 1E DF FE 69 EE 35 BD 74
> See http://www.zytor.com/~hpa/ for web page and full PGP public key
> I am Bahá'í -- ask me about it or see http://www.bahai.org/
> "To love another person is to see the face of God." -- Les Misérables
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/
>

--
James Bourne                    | Email:jbourne@affinity-systems.ab.ca
Affinity Systems Inc.           | WWW:http://www.affinty-systems.ab.ca
Everything Unix                 | Linux-The choice of a GNU generation
----------------------------------------------------------------------
Unix System Administration, System programming, Network Administration

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/