Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Mar 2000 12:13:19 +1100
From:      Peter Jeremy <peter.jeremy@alcatel.com.au>
To:        Paul Richards <paul@originative.co.uk>
Cc:        current@FreeBSD.ORG
Subject:   Re: MAX_UID ?
Message-ID:  <00Mar13.121319est.115208@border.alcanet.com.au>
In-Reply-To: <38CC3D6F.73152D6D@originative.co.uk>; from paul@originative.co.uk on Mon, Mar 13, 2000 at 12:01:03PM %2B1100
References:  <38CAD957.3C839375@originative.co.uk> <200003120430.UAA49807@vashon.polstra.com> <38CB322D.D12ED0B0@originative.co.uk> <20000313015009.A5653@hades.hell.gr> <38CC30FB.FC417909@originative.co.uk> <200003130018.TAA32652@khavrinen.lcs.mit.edu> <38CC3D6F.73152D6D@originative.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2000-Mar-13 12:01:03 +1100, Paul Richards <paul@originative.co.uk> wrote:
>id = strtoul(p, (char **)NULL, 10);
>    if ((errno == ERANGE) || (id >= UID_MAX)) {
>        warnx("%s > max uid value (%lu)", p, UID_MAX);
>        return (0);
>}

You can do this now.  Just add the following:
	pid_t	UID_MAX = ~0;
somewhere before the code.

>When you see it written out like that the latter is a lot more
>informative. It also provides the flexibility to limit the parameters
>max value even if the type allows it to be larger. This is of particular
>significance to UIDs which are currently limited to a far smaller value
>than would fit in a uid_t.

AFAIK, there's no real hard limit.  adduser(8) limits uids to 32000
to prevent portability problems with systems using a signed 16-bit
uid_t (whilst allowing for a few `special' uids near the top of the
range).  Other potential limits are ~65000 (16-bit unsigned) and
99999 (5 decimal digits).

It would be nice if there was a system-wide constant that could be
used for this, but it's not obvious where this should be located.
(And note that adduser(8) is a perl script, so it can't use a C
header file without some contortions).

Peter


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00Mar13.121319est.115208>