Jan Mikkelsen
2015-Jul-13 06:57 UTC
10.2-BETA1: pw(8) does not support "pw useradd name -u 0"
Hi, In our system build scripts we have this command: /usr/sbin/pw -V $d useradd toor -u 0 -g 0 -d /root -s /bin/sh -c "Bourne-again Superuser" -g wheel -o After 10.2-BETA1, the toor account is being added with UID 1001 instead of UID 0. This looks like a problem with line 754 in pw_user.c, which has this test: /* * Check the given uid, if any */ if (id > 0) { uid = (uid_t) id; if ((pwd = GETPWUID(uid)) != NULL && conf.checkduplicate) errx(EX_DATAERR, "uid `%u' has already been allocated", pwd->pw_uid); } else { struct bitmap bm; The (id > 0) test should probably be (id >= 0) to allow ?-u 0? to be passed on the command line. This change is from r285092 by bapt at . Was this change in behaviour intentional? Regards, Jan Mikkelsen
Baptiste Daroussin
2015-Jul-13 08:36 UTC
10.2-BETA1: pw(8) does not support "pw useradd name -u 0"
On Mon, Jul 13, 2015 at 04:57:32PM +1000, Jan Mikkelsen wrote:> Hi, > > In our system build scripts we have this command: > > /usr/sbin/pw -V $d useradd toor -u 0 -g 0 -d /root -s /bin/sh -c "Bourne-again Superuser" -g wheel -o > > After 10.2-BETA1, the toor account is being added with UID 1001 instead of UID 0. This looks like a problem with line 754 in pw_user.c, which has this test: > > /* > * Check the given uid, if any > */ > if (id > 0) { > uid = (uid_t) id; > > if ((pwd = GETPWUID(uid)) != NULL && conf.checkduplicate) > errx(EX_DATAERR, "uid `%u' has already been allocated", pwd->pw_uid); > } else { > struct bitmap bm; > > > The (id > 0) test should probably be (id >= 0) to allow ?-u 0? to be passed on the command line. > > This change is from r285092 by bapt at . Was this change in behaviour intentional?Nope, I'll fix asap Thanks for reporting Best regards, Bapt -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 181 bytes Desc: not available URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20150713/4726cc71/attachment.bin>