From nobody Sat Oct 4 19:35:14 2025 X-Original-To: dev-commits-src-all@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 4cfG2p45Ctz69gB1; Sat, 04 Oct 2025 19:35:14 +0000 (UTC) (envelope-from git@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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cfG2p1nnhz3qsS; Sat, 04 Oct 2025 19:35:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759606514; 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; bh=Wcrt2ecBMnu15/vJNqqGdUdUtErGaVAad0Zsjw3J2ME=; b=Vo7/hBE5uSUYNSMF1dli4vQyiIcuiLrk8gQ/Q8EByhmkahRxhtK+k2ySQUtdZbk5DWUb8u cwillyWCKLc35PON8plpRhhC8DxDs88BEY/kc12s0Gi1ZPQEoJ9uN4q0DbOKztO6SDwiHB W/FQT1AogXDjYFDqDvFSMb6zcJzCKS64xGaUPRSV4pip1jrmABiqGG4FhZ7YwYYARH6HNB kGq7uwubne96RGwJvE9Vr2UWaeAbg4aTV0bZ8B10Dc/TLgZB32ycBxnW3x4fpt7CNUrhxF AR50e6MgVWOgqXs8FLUyT5SqKJ5Toho+myFet748xmGJ4T7N5Tqg/fNVbkAbEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759606514; 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; bh=Wcrt2ecBMnu15/vJNqqGdUdUtErGaVAad0Zsjw3J2ME=; b=iRXQkhDNeCMMNRkMhtp/vjqbztLN4Sc/+u+DRjPRVgxUsSFUr9kPoNTZToX8WKXn6v9QCQ ugUybWvUwJl9l3oIIElfzwHh/tOvNm7xxoNNYXL7t7G5OK1efMlq+5x3iZHkodh3vC63Ka YaSMpqfY9moLeJVB+LVechKbqT8WYMWmC+EbrmwPvTZidzIRcg3JLt0S9/n2G5xjgEyBVj oJ/pAnrWSZPJuWBtdg4zGcfJd+txGD723xT7QDP/uRPleLTYsQcmGopFVSRRR0wLsNSoxO KraBkrlXFX/Yo5xD3kQ6A/dAW0LMDI8EZ8rg9nzPTKZjMzDt9Xif8RJ754qVUA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759606514; a=rsa-sha256; cv=none; b=S0yHsBEFlY5t+fsjvrAVOQ85tSAfIuFMvu7btP+1SbSIm6K3Y/qLH5pbvoNGlhmT+6HOY9 rxr2FOaAyIEwRJ7iJ8GOqOo2rGQonSq4RL+W1AOP/GVU22xpWrdKr0zgaqSPMDsZr6iiFj 1bXpKafNKEdTm7Mp9hwubIR6i1AzO1+GanpM8CjB6V7uvnTxNDQaEGBI2qxwcg16ZFXKGl KzIX30MmUDqiHYhVg3Pg3NeYnVTQHNqpo5AywOktd2n0/Wi0+ou5wPvemdXiwxkVP3yALC 6QExcvn8VLoDoPmCl+Ev4nI/sZSSlndA1c+/pOr1q4Ut2wqq9aszlDLP5Tg0Bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4cfG2p1Lhrzw8w; Sat, 04 Oct 2025 19:35:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 594JZEeV079145; Sat, 4 Oct 2025 19:35:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 594JZEJD079142; Sat, 4 Oct 2025 19:35:14 GMT (envelope-from git) Date: Sat, 4 Oct 2025 19:35:14 GMT Message-Id: <202510041935.594JZEJD079142@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 350784b01cb5 - stable/15 - pw: Add a missing chown() when creating dirs in mkdir_home_parents() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 350784b01cb5f74713c054d6060da75566a88340 Auto-Submitted: auto-generated The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=350784b01cb5f74713c054d6060da75566a88340 commit 350784b01cb5f74713c054d6060da75566a88340 Author: Mark Johnston AuthorDate: 2025-09-18 22:39:11 +0000 Commit: Mark Johnston CommitDate: 2025-10-04 19:34:57 +0000 pw: Add a missing chown() when creating dirs in mkdir_home_parents() mkdir_home_parents() effectively performs a mkdir -p of the root home directory. It chowns the home directory to 0, 0, but doesn't do so for the intermediate directories. Add an explicit chown() call for those too. Fix a long line while here. Reviewed by: bapt MFC after: 1 week Sponsored by: The FreeBSD Foundation Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D52587 (cherry picked from commit 41b2a80353e0dd04939cc260d5763854a264c158) --- usr.sbin/pw/pw_user.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 9f5cfb0f4473..007f750c7d1a 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -115,7 +115,11 @@ mkdir_home_parents(int dfd, const char *dir) *tmp = '\0'; if (fstatat(dfd, dirs, &st, 0) == -1) { if (mkdirat(dfd, dirs, _DEF_DIRMODE) == -1) - err(EX_OSFILE, "'%s' (home parent) is not a directory", dirs); + err(EX_OSFILE, + "'%s' (home parent) is not a directory", + dirs); + if (fchownat(dfd, dirs, 0, 0, 0) != 0) + warn("chown(%s)", dirs); } *tmp = '/'; }