Subject: Re: negative user-ids and interoperability.
To: None <tech-userlevel@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: tech-userlevel
Date: 04/26/1999 17:52:11
[ On Monday, April 26, 1999 at 21:14:11 (+1000), Giles Lean wrote: ]
> Subject: Re: negative user-ids and interoperability.
>
>
> Again, from UNIX 98 (a pretty dodgy standard to want to adhere to, but
> what I've easiest access to):
>
> user ID
>
> A non-negative integer that is used to identify a system
> user. When the identity of a user is associated with a process, a
> user ID value is referred to as a real user ID, an effective user
> ID or a saved set-user-ID.
The Single UNIX Specification, Version 2 (available online at
<URL:http://www.rdg.opengroup.org/onlinepubs/7908799/>) which is a damn
sight better than UNIX 98 as far as industry standards go, simply says
that a "uid_t" is an integer of the "appropriate width". It doesn't
even say if it's signed, or not, though most modern implementations I'm
aware of use unsigned 32-bit integers for ID types these days (and for
about the last decade! ;-).
I don't know what POSIX 1003.1 (which is more "standard" in the sense
that it's been adopted by ISO) says, if anything.
> Now, that's a fine mess, given that "everyone" has always used
> negative user ids for root over NFS, nobody etc etc.
Including NetBSD, by default (from approximately line 1854 of
usr.sbin/mountd.c):
/*
* Set up the unpriviledged user.
*/
cr->cr_ref = 1;
cr->cr_uid = -2;
cr->cr_gid = -2;
cr->cr_ngroups = 0;
Unfortunately, as I've been saying for quite some time now, you can't
put "-2", or its unsigned equivalent, in /etc/master.passwd to match
this usage in mountd -- libc/gen/pw_scan.c enforces the maximum legal
value of UID_MAX (and GID_MAX), which is only 2147483647U.
--
Greg A. Woods
+1 416 218-0098 VE3TCP <gwoods@acm.org> <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>