1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-08-02 20:37:35 +00:00

LoginServer+LibCore: Only create user temp directory from LoginServer

Other programs use Core::Account::login(), notably su(1), which stopped
working due to a missing "cpath" pledge promise.

This patch moves the /tmp/user/ creation logic to a separate function
that LoginServer can call.
This commit is contained in:
Andreas Kling 2022-08-15 14:05:54 +02:00
parent 32642394a9
commit 3f14582b85
3 changed files with 14 additions and 8 deletions

View file

@ -18,6 +18,11 @@
static void child_process(Core::Account const& account)
{
if (auto result = account.create_user_temporary_directory_if_needed(); result.is_error()) {
dbgln("Failed to create temporary directory for user {}: {}", account.username(), result.error());
exit(1);
}
if (!account.login()) {
dbgln("failed to switch users: {}", strerror(errno));
exit(1);