]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
setusercontext(): Apply personal settings only on matching effective UID
authorOlivier Certner <olce.freebsd@certner.fr>
Tue, 30 May 2023 16:35:08 +0000 (18:35 +0200)
committerOlivier Certner <olce@FreeBSD.org>
Thu, 21 Dec 2023 13:39:03 +0000 (14:39 +0100)
commit9fcf54d3750e379868e51e4aa7fbf696877ab2ed
treef9d31777b3fc43865e2edaa378c75576fff90377
parent6983b8c39ff36b3a4c1090b5cca97d450dca7b34
setusercontext(): Apply personal settings only on matching effective UID

Commit 35305a8dc114 (r211393) added a check on whether 'uid' was equal
to getuid() before calling setlogincontext().  Doing so still allows
a setuid program to apply resource limits and priorities specified in
a user-controlled configuration file ('~/.login_conf') where
a non-setuid program could not.  Plug the hole by checking instead that
the process' effective UID is the target one (which is likely what was
meant in the initial commit).

PR:                     271750
Reviewed by:            kib, des
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40351

(cherry picked from commit 892654fe9b5a9115815c30a423b8db47185aebbd)

Approved by:    markj (mentor)
lib/libutil/login_class.c