From nobody Thu Sep 18 22:42:49 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 4cSVyf1w57z688Ph; Thu, 18 Sep 2025 22:42:50 +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 4cSVyd62VZz3q9b; Thu, 18 Sep 2025 22:42:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758235369; 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=Xarth6ENTuwjiznDgQ0TffMCZY6SGjUIGJ/sK2jmcdk=; b=JiOyghU+l43jcswl8wVj3iaOvSZaoucK4S7ASZu+IUmWXnH6DhodXoUTt9fzHf9MhXGG6p KD1fP/ue6DoYH3VhEujIHGxRhoHnpIArThiPbos7F8ST61s1gvmFsHfkBY3Mg+rajCiI/3 lsWUuU6/qTNwe80DvLvpCTvpi/kfBysV+m2t50Nq7q4zIRKVI18SjZSS4qkqbPmcU6p/M+ EmOuWtpFYOhPWeaP6qfT4UrySGIBoDkXbP7eGuCArN7WkZzohzln2bSPbC32rRVCy8hJqo MlhCjvvRTZijNuifn4RwGMncQRGvJr61iIJW/8uXMLc5s/EOSpfVjgeipf+0zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758235369; 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=Xarth6ENTuwjiznDgQ0TffMCZY6SGjUIGJ/sK2jmcdk=; b=DqDHpoWHCsQ8s8UJ8KNBDwf4TM3F4kR4LP7RoWn4uABoRGjmbzQpx8E0kv63acQ/YZ4yPv QhFWgUI5SmtyzJkinyn8Uka9s24tZnLiztSrXhjlP0XBfq8C6dSFwZh/YxfkGGMI7mWIWF WmIm1gYJjVECH9Pf0i8qa7nJhZJRmTZ3XUmymgU2/tOQ0RBAo4KJ0Jr7iUYHvVwt0UN/Pj pnXJgX37SCM3R4G7qE38mxmqYpuGlhHjJX4r64OEjnQnDTRrHGiRbFlLOQEhuGqYDwslPE MLUDBRJbmAD5OMwlXvHCtYx/ckrnvcmi8HjwxvBUNpz2PyKc3b09Euhejw0Oog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758235369; a=rsa-sha256; cv=none; b=lpKe3r9Y0NzLlHMbTdu9AWX/svCWesMW+M7l51dDXpSX950pBfbj4TqYcBafGtqsLFHPMa SX39s6YIz2c5ANIDmXdh99cPbRoSNedkRqPouotW66Chi5UMz/8ZAIcpbOp74q+1W3OzXX IeHU0FbKxLoDprB8HvCQI0c8GnwBJ7FeYEz3LvUfa4JdP2cq0ZKmZQD6YkfG5FxQabqhcW qAfxRCqHJaCn+sXGatgsWgjWJ7QhgkJXJzsdFb/Irsg0BJ9NXaI+jN1fHzT8yDCZ04d9Z0 RcD8GLGKaQrH/fTA5kAQKAVaqjACl2GBnm7+xULhME0MBVt7Hsa6y2j7eeZGjA== 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 4cSVyd5Q0zzVh9; Thu, 18 Sep 2025 22:42:49 +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 58IMgnYl081812; Thu, 18 Sep 2025 22:42:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58IMgnRY081809; Thu, 18 Sep 2025 22:42:49 GMT (envelope-from git) Date: Thu, 18 Sep 2025 22:42:49 GMT Message-Id: <202509182242.58IMgnRY081809@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 41b2a80353e0 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 41b2a80353e0dd04939cc260d5763854a264c158 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=41b2a80353e0dd04939cc260d5763854a264c158 commit 41b2a80353e0dd04939cc260d5763854a264c158 Author: Mark Johnston AuthorDate: 2025-09-18 22:39:11 +0000 Commit: Mark Johnston CommitDate: 2025-09-18 22:39:11 +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 --- 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 = '/'; }