Re: LOGNAME, USER, and get-uid; NIS
Lassi Kortela 13 Aug 2019 09:13 UTC
> We previously removed geteuid and getegid because we didn't want to
> *directly* support setuid root then lower your privileges Scheme
> programming, but if that happens *before* Scheme is called, by all
> means let us return those two, which are completely trivial to
> implement, they take no arguments and can't fail.
Exactly. Getting the user IDs is a whole different ball game than
setting them :)
> None of POSIX, Linux, or OpenBSD have getruid or getrgid, the POSIX
> descriptions of getuid and getgid, and the man pages for Bionic
> Beaver Linux and OpenBSD 6.5 say they return the real ids. So we
> could rename user-uid/-gid to user-real-uid/-gid.
Just so. getuid()/getgid() always get the real UID. Probably the concept
of an effective user ID was added late in the development of Unix so the
real user functions don't have the letter "r" as those were the only IDs
there were.
> Although I note just now using setuid with scsh 0.7 on Bionic Beaver
> that both user-uid and user-effective-uid stay the same before and
> after I do (set-uid 1000), 0 to 1000.... Although there's no trail
> of crumbs in the source from what I take to be the system calls to
> either of the Scheme procedures....
That sounds just weird... If you start off as root, at least the first
set-uid should succeed in changing the UID.