From nobody Thu Feb 01 21:31:11 2024 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 4TQsXb5bqqz58hfK; Thu, 1 Feb 2024 21:31:11 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TQsXb34L9z4bxr; Thu, 1 Feb 2024 21:31:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706823071; 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=l86Nny6ORBOqOhDlI8PjtGkwagvEdQc7fuTdJWfh3/Q=; b=VbWMrKi8JyNM1x9f4uoFpcUyF8XRmiCFFMUXEHliiKJMaEPePIRENVFqOV/61ntTw0kMgY kftaPAyrKicZy2eiTN0S60Bjcxp3IhUOk1StGORtRUQS0hy5EarlHW9jCNmFsg5v0YRyo3 Dq1oNcB4UOf3pqHsNNFvDKlGWdkSSW4AzkY/KavTyQOnK0C6ZeNK6Cl5Ad26rGpz7E+avw 0Oeari7Z+Ts8EMSTTrIWa2c/stMD+H63OzGw3AZxdrxagE/8GYR6uj8+RBbjtnIpsDvSLL zI47KF+oXlXIfSonRlDcAsvlw3BtCyvulgzLjf1+Iasnb6ZZBemPwQAwREjscA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706823071; 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=l86Nny6ORBOqOhDlI8PjtGkwagvEdQc7fuTdJWfh3/Q=; b=Eq8iAS7rxTDm0VKxFSHlaVffrhK9nSGyhWapNqvlglJMqxPmkl33qTBvO3cKFxPvMkLNFg h5CVD7KXDTY2rGTVolK0dd7sUbko8Vs8dH3ALv+W+TaX7Ur+MPV9vGYyriSjtbdEMGgy8c EI9+sHSLpIeqGU7ogePFhA1suIuN/sgODoXdGITWrIVRP2IqyznySStUCZ/1kI0ep3z2fJ omxE+niqWdhaOrw3GLkx8KBpd0OWc8nZxcu8adG6/jtISrehmje8wV8EkLGsaCKx3rF1sA J8a7oPpqWk/vJQgBxdp9aNJ++G5J3CCUSIF4mzxw7GQ1dA3b+/HEGsHI/HSBXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706823071; a=rsa-sha256; cv=none; b=EQmpQkLZ5U8Fw5aXX2/SoeyzsCpNTLCoIJpN+0QCqCX2tXo/lq37oibFzLcsCRZ7haRwBY VsESQywxHMibLMoprmsW+R4X9nqE+BHnXvKULFIB5b3DnwktOHJT02Dito8gUGLOsmjQTH mUGLFGc/OSb1i5DDQVEL6KHM0lPuNCepE/ZlGi2QxQhWCpNQqYHIJi5wsEw3YhvTOuZ9rt TK6lZTQ9jQLcuf1ows23WHNzoO/uG0FBmr3jjlrxjanZzogp1wB8ecI4EFHa7HtODQ6aEh WP7W5aiPP8yFoiBxzcwZnF0nSo2IyUXb6aWgGXvNZ/XVE/qe9gppeRJZTYhp+w== 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 4TQsXb28bqz1J5G; Thu, 1 Feb 2024 21:31:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 411LVB0q080562; Thu, 1 Feb 2024 21:31:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 411LVBkb080559; Thu, 1 Feb 2024 21:31:11 GMT (envelope-from git) Date: Thu, 1 Feb 2024 21:31:11 GMT Message-Id: <202402012131.411LVBkb080559@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: 6f6186e19fe5 - stable/14 - setclassumask(): Accept 'inherit' as a value 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6f6186e19fe5a56af8bc52b7a20ca19f5f5e73c3 Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=6f6186e19fe5a56af8bc52b7a20ca19f5f5e73c3 commit 6f6186e19fe5a56af8bc52b7a20ca19f5f5e73c3 Author: Olivier Certner AuthorDate: 2023-06-20 19:41:04 +0000 Commit: Olivier Certner CommitDate: 2024-02-01 21:28:58 +0000 setclassumask(): Accept 'inherit' as a value 'inherit' explicitly indicates that the umask should not be changed. Reviewed by: emaste Approved by: emaste (mentor) MFC after: 3 days Relnotes: yes Sponsored by: Kumacom SAS Differential Revision: https://reviews.freebsd.org/D40687 (cherry picked from commit c328e6c6ccaa4cdf921c16d68a2f2c5992dd3b72) Approved by: markj (mentor) --- lib/libutil/login_class.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c index 69230db32961..e6485afade43 100644 --- a/lib/libutil/login_class.c +++ b/lib/libutil/login_class.c @@ -381,6 +381,11 @@ setclasscontext(const char *classname, unsigned int flags) } +static const char * const inherit_enum[] = { + "inherit", + NULL +}; + /* * Private function setting umask from the login class. */ @@ -392,7 +397,13 @@ setclassumask(login_cap_t *lc, const struct passwd *pwd) * indicating no specification. */ const rlim_t def_val = INT64_MIN + 1, err_val = INT64_MIN; - const rlim_t val = login_getcapnum(lc, "umask", def_val, err_val); + rlim_t val; + + /* If value is "inherit", nothing to change. */ + if (login_getcapenum(lc, "umask", inherit_enum) == 0) + return; + + val = login_getcapnum(lc, "umask", def_val, err_val); if (val != def_val) { if (val < 0 || val > UINT16_MAX) {