Re: Maximum uid and how to indicate "any user"
Re: Maximum uid and how to indicate "any user"
- Subject: Re: Maximum uid and how to indicate "any user"
- From: Jason Townsend <email@hidden>
- Date: Mon, 11 Jul 2005 09:24:04 -0700
On Jul 10, 2005, at 2:25 PM, Greg Hurrell wrote:
A quick question and a request for a word of advice... Can someone
direct me to a header where I can find the maximum possible uid
under Darwin? The only reference I can find on the net is this old
one:
http://sourceforge.net/mailarchive/message.php?msg_id=1673516
Which in turn makes reference to an Apple document which now 404s...
http://www.apple.com/macosx/server/pdf/UnderstandingUsingNetInfo.pdf
It should be this:
http://www.apple.com/server/pdfs/UnderstandingUsingNetInfo.pdf
That document apparently says that the maximum uid is 2,147,483,647.
The reason I ask is that I am writing some methods which take a
uid_t argument and I want to come up with a safe value that can be
passed to indicate "any user". In "/usr/include/sys/types.h" uid_t
is defined as having type u_int32_t. I notice that on my clean
Tiger install user "nobody" has uid -2, but obviously "nobody" and
"any user" aren't the same thing. So I am wondering if -1 would be
a safe value to use to stand for "any user".
On Jul 11, 2005, at 2:39 AM, Greg Hurrell wrote:
Thanks, Nat. To clarify, do you mean declaring the method like so:
- (void)theMethod:(long long)uid;
And then casting to uid_t inside the method before passing the
parameter to other functions which expect uid_t type parameters?
(And do you think it's likely that Darwin's uid_t will get upsized
from uint32 in the future?)
UIDs are 32 bit signed integers as stored in the user records (as you
saw with the nobody UID of -2). I would recommend against assuming
that any possible 32 bit value means anything special because there
are some cases where larger numbers are mapped onto the 32 bit UID
space (primarily when integrating with Active Directory). The
suggestion of using a long long would be a reasonable approach.
To answer your last question, UIDs are what they are and can't be
changed without breaking binary compatibility. However, there are
already 128 bit GUID/UUIDs present on the system which are now used
in Tiger to support nested groups and ACLs. These are stored in the
standard hex format for UUIDs, which looks like this:
72DD37F9-1B8F-4BEB-BCBF-7958D7314AF8. They are stored in the
GeneratedUID attribute in user and group records (and other record
types as well). These IDs are parallel to the existing UIDs and GIDs.
-Jason
--
Jason Townsend
http://www.opendarwin.org/~jtownsend/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden