setclasspriority(): New possible value 'inherit'

It indicates to the login.conf machinery (setusercontext() /
setclasscontext()) to leave priority alone, effectively inheriting it
from the parent process.

PR:                     271749
Reviewed by:            emaste, yuripv
Approved by:            emaste (mentor)
MFC after:              3 days
Relnotes:               yes
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40690
This commit is contained in:
Olivier Certner 2023-06-21 10:53:37 +02:00 committed by Olivier Certner
parent 7b94ec550e
commit d162d7e2ad
No known key found for this signature in database
GPG key ID: 8CA13040971E2627

View file

@ -462,9 +462,15 @@ static void
setclasspriority(login_cap_t * const lc, struct passwd const * const pwd)
{
const rlim_t def_val = LOGIN_DEFPRI, err_val = INT64_MIN;
rlim_t p = login_getcapnum(lc, "priority", def_val, err_val);
rlim_t p;
int rc;
/* If value is "inherit", nothing to change. */
if (login_getcapenum(lc, "priority", inherit_enum) == 0)
return;
p = login_getcapnum(lc, "priority", def_val, err_val);
if (p == err_val) {
/* Invariant: 'lc' != NULL. */
syslog(LOG_WARNING,