aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil
diff options
context:
space:
mode:
authorOlivier Certner <olce.freebsd@certner.fr>2023-06-20 19:41:04 +0000
committerOlivier Certner <olce@FreeBSD.org>2024-02-01 21:28:58 +0000
commit6f6186e19fe5a56af8bc52b7a20ca19f5f5e73c3 (patch)
tree495f9861e27b422a8ba27c04ce6b65c35188640a /lib/libutil
parent787abe7d6eb64cefe0d92a6a9f00324f960bd55e (diff)
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/login_class.c13
1 files changed, 12 insertions, 1 deletions
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) {