Date: Thu, 1 Feb 2024 21:31:11 GMT From: Olivier Certner <olce@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 6f6186e19fe5 - stable/14 - setclassumask(): Accept 'inherit' as a value Message-ID: <202402012131.411LVBkb080559@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=6f6186e19fe5a56af8bc52b7a20ca19f5f5e73c3 commit 6f6186e19fe5a56af8bc52b7a20ca19f5f5e73c3 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2023-06-20 19:41:04 +0000 Commit: Olivier Certner <olce@FreeBSD.org> 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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402012131.411LVBkb080559>