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
commit e1edd620ee
Notes: sideshowbarker 2024-07-17 06:34:33 +09:00

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"));