Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jul 2015 16:57:32 +1000
From:      Jan Mikkelsen <janm@transactionware.com>
To:        FreeBSD Stable Mailing List <freebsd-stable@freebsd.org>, bapt@freebsd.org
Subject:   10.2-BETA1: pw(8) does not support "pw useradd name -u 0"
Message-ID:  <00BBEBAC-D7E2-4312-995B-93F7F0EDDD42@transactionware.com>

next in thread | raw e-mail | index | archive | help
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 =3D (uid_t) id;

                if ((pwd =3D GETPWUID(uid)) !=3D 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 >=3D 0) to allow =E2=80=9C-u =
0=E2=80=9D to be passed on the command line.

This change is from r285092 by bapt@. Was this change in behaviour =
intentional?

Regards,

Jan Mikkelsen




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00BBEBAC-D7E2-4312-995B-93F7F0EDDD42>