dscl

Daniel J. Luke dluke at geeklair.net
Fri Sep 18 14:01:57 PDT 2009


On Sep 18, 2009, at 4:46 PM, Scott Haneda wrote:
> Where does adduser/addgroup get the uid and gid to start with so it  
> does not have collisions?

The best way to answer a question like this, is to look at the source:

http://trac.macports.org/browser/trunk/base/src/port1.0/portutil.tcl

proc adduser sets the uid by calling nextuid

nextuid is from Pextlib.c:

http://trac.macports.org/browser/trunk/base/src/pextlib1.0/Pextlib.c

There you can see that nextuid is implemented by NextuidCmd, which  
starts at MIN_USABLE_UID (which is set to 500) and increments until it  
finds an unused uid. (It uses the same algorithm to find an unused gid).

--
Daniel J. Luke
+========================================================+
| *---------------- dluke at geeklair.net ----------------* |
| *-------------- http://www.geeklair.net -------------* |
+========================================================+
|   Opinions expressed are mine and do not necessarily   |
|          reflect the opinions of my employer.          |
+========================================================+





More information about the macports-dev mailing list