From owner-freebsd-stable@freebsd.org Mon Jul 13 09:10:12 2015 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 066463954 for ; Mon, 13 Jul 2015 09:10:12 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wg0-x22f.google.com (mail-wg0-x22f.google.com [IPv6:2a00:1450:400c:c00::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F736128F for ; Mon, 13 Jul 2015 09:10:11 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by wgkl9 with SMTP id l9so20561646wgk.1 for ; Mon, 13 Jul 2015 02:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=pQtBP8Mj0Bl8PHn9Nj7CjflIXDJkQ5GS/pUlioRVWLY=; b=HirAHrRPUEDW1qQn1Yue6lQqZJTvdsewKnNlY7hV3cOX6KXXjR5VVNP/0kH+ql3L6S cmfYbnKzaxHZy655wOqG/cE/sTdxR5lC0qLknusKEY/3+kM811s8tflaOu+IwEhjL9fo JWcb8XIXuj1MCYh9UT1/1u44QCdCpHjvVWcrLCmm++pe7TjIMG4unUkkBTtQYGy+F+KO ZjPR0PdWVFYfTsGrRSxajV5Pj41HwTMb8WyR3H42kqepOob9+1br9u5pi8Ey31CKtuBo kDgVL5Da+0doCvt8JUGHSZA3CXfie0mtgwc8dS4UpRTf9qI0JCgbOGhhaMDUcFt6o3kx wmLw== X-Received: by 10.180.80.229 with SMTP id u5mr19919860wix.92.1436778610005; Mon, 13 Jul 2015 02:10:10 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id se11sm13446572wic.2.2015.07.13.02.10.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jul 2015 02:10:09 -0700 (PDT) Sender: Baptiste Daroussin Date: Mon, 13 Jul 2015 11:10:06 +0200 From: Baptiste Daroussin To: Jan Mikkelsen Cc: FreeBSD Stable Mailing List Subject: Re: 10.2-BETA1: pw(8) does not support "pw useradd name -u 0" Message-ID: <20150713091006.GB37597@ivaldir.etoilebsd.net> References: <00BBEBAC-D7E2-4312-995B-93F7F0EDDD42@transactionware.com> <20150713083628.GA37597@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cmJC7u66zC7hs+87" Content-Disposition: inline In-Reply-To: <20150713083628.GA37597@ivaldir.etoilebsd.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2015 09:10:12 -0000 --cmJC7u66zC7hs+87 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 13, 2015 at 10:36:28AM +0200, Baptiste Daroussin wrote: > On Mon, Jul 13, 2015 at 04:57:32PM +1000, Jan Mikkelsen wrote: > > Hi, > >=20 > > In our system build scripts we have this command: > >=20 > > /usr/sbin/pw -V $d useradd toor -u 0 -g 0 -d /root -s /bin/sh -c "Bourn= e-again Superuser" -g wheel -o > >=20 > > 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: > >=20 > > /* > > * Check the given uid, if any > > */ > > if (id > 0) { > > uid =3D (uid_t) id; > >=20 > > if ((pwd =3D GETPWUID(uid)) !=3D NULL && conf.checkdupl= icate) > > errx(EX_DATAERR, "uid `%u' has already been all= ocated", pwd->pw_uid); > > } else { > > struct bitmap bm; > >=20 > >=20 > > 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. > >=20 > > This change is from r285092 by bapt@. Was this change in behaviour inte= ntional? >=20 > Nope, I'll fix asap >=20 > Thanks for reporting >=20 > Best regards, > Bapt Fixed in head, will be merged soon in stable, I also added a regression test about this. Please note that you do add -g 0 and -g wheel in your command line, this is buggy, only one should be specified. Best regards, bapt --cmJC7u66zC7hs+87 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlWjgG4ACgkQ8kTtMUmk6ExNyACgklnoPm+5qkmd76pKfOmV2Ilk TrQAoIZrnDBlsat4/q+nmkow1hcPVs2N =PS3S -----END PGP SIGNATURE----- --cmJC7u66zC7hs+87--