1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

pls: Use LibCore::Account::login() instead of manually setting the uid

In addition to changing the uid, the method also changes the gid and
properly sets groups. So this patch will also mitigate the security
issue of `pls`.
This commit is contained in:
Lucas CHOLLET 2022-08-14 21:19:05 +02:00 committed by Sam Atkins
parent 8fabe9a3ad
commit e1edd620ee

View file

@ -42,8 +42,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath exec id"));
TRY(Core::System::setgid(0));
TRY(Core::System::setuid(as_user_uid));
TRY(as_user.login());
TRY(Core::System::pledge("stdio rpath exec"));