Re: High UID support for Linux

Jim Bourne (jbourne@affinity-systems.ab.ca)
Thu, 3 Dec 1998 11:58:37 -0700 (MST)


On Thu, 3 Dec 1998, Jason Riedy wrote:

> Once, I actually tried changing HOME to adapt for different architectures
> (export HOME=${HOME}/home-${archos}), but it broke things in non-uniform
> ways.
>
> I've always thought that whatever method the BSDish whoami command uses
> on a particular system was the canonical way to get the current user...
> It uses geteuid on Solaris, Irix, and AIX, at least. I don't have a
> Linux version on hand at the moment. The SysV ``who am i'' command does
> exactly what you describe, or at least all that I've seen. Try ``ssh
> localhost csh -i'' and then ``who am i'' to test it.

whoami uses geteuid to determine who you are, which again would break with
u_int_32 uid_t's in non-compatible libs:

(strace whoami)
...
personality(0 /* PER_??? */) = 0
getpid() = 20402
brk(0) = 0x8049ce8
brk(0x8049d20) = 0x8049d20
brk(0x804a000) = 0x804a000
geteuid() = 500
brk(0x804b000) = 0x804b000
open("/etc/nsswitch.conf", O_RDONLY) = 3
fstat(3, {st_mode=0, st_size=0, ...}) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400b70
...
>
> I tend to use HOME for the home directory of the current user; it's the
> lazy solution. Most things I've written find _other_ users' home
> directories, however, and that variable is meaningless there...

what about the password entry:
nobody:x:499:100:nobody:/dev/null:

the uid, username, etc would not be able to be determined for this user from
the homedir.

Just my opinion mind you, using environment vars to securely determine any
information about a user is a contradiction in terms.

Jim

> Jason

--
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/