HomeFreeBSD

setusercontext(): umask: Set it only once (in the common case)

Description

setusercontext(): umask: Set it only once (in the common case)

Simplify the code and make it more coherent (umask was the only context
setting not modified by setlogincontext() directly).

Preserve the current behavior of not changing the umask if none is
specified in the login class capabilities database, but without the
superfluous umask() dance. (The only exception to this is that
a special value no user is likely to input in the database now stands
for no specification.)

If some user has a 'umask' override in its '~/.login_conf', the umask
will still be set twice as before (as is the case for all other context
settings overriden in '~/.login_conf').

Log a warning in case of an invalid umask specification.

This change makes it apparent that the value of LOGIN_DEFUMASK doesn't
matter. It will be removed in a subsequent commit.

PR: 271747
Reviewed by: emaste, kib (earlier version)
Approved by: emaste
MFC after: 3 days
Sponsored by: Kumacom SAS
Differential Revision: https://reviews.freebsd.org/D40344

Details

Provenance
olceAuthored on May 25 2023, 12:18 PM
Reviewer
emaste
Differential Revision
D40344: setusercontext(): umask: Set it only once (in the common case)
Parents
rGa570fe4d0dd9: open(2): describe *at behavior for dirfd opened without O_SEARCH
Branches
Unknown
Tags
Unknown