From nobody Thu Jul  6 12:39:52 2023
X-Original-To: bugs@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4QxbhS2jdVz4l6Lb
	for <bugs@mlmmj.nyi.freebsd.org>; Thu,  6 Jul 2023 12:39:52 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4QxbhS008yz47cg
	for <bugs@FreeBSD.org>; Thu,  6 Jul 2023 12:39:51 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1688647192;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=VrNr9w2Uu7187dDXkEa8Knjp7TkrckaeOxmQU737dBw=;
	b=x+x9jdS84oZpoR0AgWaDTy9Q2lvglxVNx0NmPPvHsfLYIVd/4v3l6DV6H43bDgwSefEGnF
	yDzeKHxwB+dl8l/nv8Rjsi6U3Ggnj8xUgSnVFHwTZO6+RyyEFwLDovguol+bBDbZqGQAQ0
	Tdjg09GV+2NBMON5lkLx+oRjCmF/v1Wnipn2Tm0pb1lHW08DOSDrcMVQj2bH6hY8Y1/JTv
	qb5ci21evs9dFFZ7TDm6XYK6DA779ajycS9pAra0ugOCFEaxEpXO0AzblOB4/a1Hf5qdgm
	Eq3ZBpgjiPuUOU3qLH5CybNaisxJEl5PRY9NMRkVQlOJgNiBr4DviTwIPtWf0A==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688647192; a=rsa-sha256; cv=none;
	b=Jh9gpWHsqTcqffF7/O5J7TssrJxH+nUEmR6eLrG7kyp8G6LRCDS4Top1emRUB6VOXczU4R
	YDEvRThkNhHPG1kDydwe2U5OTkFnaRNzwhPD3gRq7nTEs5Z1viVhz+76uELeMa0C0vb8bp
	pm1Vs6Ab6l8anIOloKPciMAd9gGnvXr2C1BJF/Xp8aGBEBkBS5gni3MU+aA5mncmBEAUWP
	gHHaXCYl4p/7ovQrF7mtgDChXmaCYUoqF0xs1UOumOsCEvs1yVHetW0w2LFRv91ADK6/4c
	s0/BFqkKyzG9fBCWYkIUJMuTJ9+R26+OBMo1GaWKowBhuHs6NfeOjqMSMRwyKA==
Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4QxbhR5vmCzwsJ
	for <bugs@FreeBSD.org>; Thu,  6 Jul 2023 12:39:51 +0000 (UTC)
	(envelope-from bugzilla-noreply@freebsd.org)
Received: from kenobi.freebsd.org ([127.0.1.5])
	by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 366CdpgU028239
	for <bugs@FreeBSD.org>; Thu, 6 Jul 2023 12:39:51 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
Received: (from www@localhost)
	by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 366Cdpah028238
	for bugs@FreeBSD.org; Thu, 6 Jul 2023 12:39:51 GMT
	(envelope-from bugzilla-noreply@freebsd.org)
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
From: bugzilla-noreply@freebsd.org
To: bugs@FreeBSD.org
Subject: [Bug 238995] adduser does not check for pre-existing user field
 entries in /etc/group
Date: Thu, 06 Jul 2023 12:39:52 +0000
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: Base System
X-Bugzilla-Component: bin
X-Bugzilla-Version: CURRENT
X-Bugzilla-Keywords: 
X-Bugzilla-Severity: Affects Many People
X-Bugzilla-Who: dclarke@blastwave.org
X-Bugzilla-Status: New
X-Bugzilla-Resolution: 
X-Bugzilla-Priority: ---
X-Bugzilla-Assigned-To: bugs@FreeBSD.org
X-Bugzilla-Flags: 
X-Bugzilla-Changed-Fields: 
Message-ID: <bug-238995-227-fWdKDsYR5l@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-238995-227@https.bugs.freebsd.org/bugzilla/>
References: <bug-238995-227@https.bugs.freebsd.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/
Auto-Submitted: auto-generated
List-Id: Bug reports <freebsd-bugs.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/freebsd-bugs
List-Help: <mailto:freebsd-bugs+help@freebsd.org>
List-Post: <mailto:freebsd-bugs@freebsd.org>
List-Subscribe: <mailto:freebsd-bugs+subscribe@freebsd.org>
List-Unsubscribe: <mailto:freebsd-bugs+unsubscribe@freebsd.org>
Sender: owner-freebsd-bugs@freebsd.org
MIME-Version: 1.0
X-ThisMailContainsUnwantedMimeParts: N

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D238995

--- Comment #3 from Dennis Clarke <dclarke@blastwave.org> ---
Here in middle of 2023 and adduser and groupmod options to pw seem to be
just plain wrong.

pluto# uname -apKU
FreeBSD pluto 13.2-RELEASE-p1 FreeBSD 13.2-RELEASE-p1 GENERIC amd64 amd64
1302001 1302001
pluto#=20

This is a perfectly stable server that does nothing much but serve NFSv3
as well as iSCSI over 10Gbit links. Runs great.

For the sake of experiment I am thinking of planting a QEMU emulation of
a RISC-V instance on that very idle server.

First I create a group :

pluto# pw groupadd -n riscv -g 14142=20

Then add a user :

pluto# adduser
Username: riscv
Full name: qemu rv64imafdc
Uid (Leave empty for default): 14142
Login group [riscv]:=20
Login group is riscv. Invite riscv into other groups? []:=20
Login class [default]:=20
Shell (sh csh tcsh nologin) [sh]:=20
Home directory [/home/riscv]:=20
Home directory permissions (Leave empty for default):=20
Use password-based authentication? [yes]:=20
Use an empty password? (yes/no) [no]:=20
Use a random password? (yes/no) [no]:=20
Enter password:=20
Enter password again:=20
Lock out the account after creation? [no]:=20
Username   : riscv
Password   : *****
Full Name  : qemu rv64imafdc
Uid        : 14142
Class      :=20
Groups     : riscv=20
Home       : /home/riscv
Home Mode  :=20
Shell      : /bin/sh
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (riscv) to the user database.
Add another user? (yes/no): no
Goodbye!
pluto#=20

If I look at that group I see that the user does not exist as a member :

pluto# pw groupshow -n riscv
riscv:*:14142:

I have to manually add in the member myself :

pluto# pw groupmod -n riscv -g 14142 -m riscv

Since I have no reason to trust the pw command I need to verify :

pluto# grep 'riscv' /etc/group
riscv:*:14142:riscv

Seems like broken behavior that is very counterintuitive.=20

related to :=20

    pw(8) usermod: numeric ID (uid) in lieu of name for option -n
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D269193

    pw accepts an "illegal option" but completes the command without error
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263188

      Oh joy! bug 263188 seems to have been fixed!


--=20
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

--=20
You are receiving this mail because:
You are the assignee for the bug.=