From owner-freebsd-current Sun Mar 12 17:12:33 2000 Delivered-To: freebsd-current@freebsd.org Received: from alcanet.com.au (mail.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (Postfix) with ESMTP id 5243A37B5AB for ; Sun, 12 Mar 2000 17:12:28 -0800 (PST) (envelope-from jeremyp@gsmx07.alcatel.com.au) Received: by border.alcanet.com.au id <115208>; Mon, 13 Mar 2000 12:13:19 +1100 Content-return: prohibited From: Peter Jeremy Subject: Re: MAX_UID ? In-reply-to: <38CC3D6F.73152D6D@originative.co.uk>; from paul@originative.co.uk on Mon, Mar 13, 2000 at 12:01:03PM +1100 To: Paul Richards Cc: current@FreeBSD.ORG Message-Id: <00Mar13.121319est.115208@border.alcanet.com.au> MIME-version: 1.0 X-Mailer: Mutt 1.0i Content-type: text/plain; charset=us-ascii 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> Date: Mon, 13 Mar 2000 12:13:19 +1100 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 2000-Mar-13 12:01:03 +1100, Paul Richards 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