From a3b8a9a142787b127bc5e47372a808cb1d1974a2 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 24 Jul 2022 13:22:40 +0200 Subject: [PATCH] SystemServer: Change user only when needed --- Userland/Services/SystemServer/Service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Services/SystemServer/Service.cpp b/Userland/Services/SystemServer/Service.cpp index 90d677af18..980ab04ed4 100644 --- a/Userland/Services/SystemServer/Service.cpp +++ b/Userland/Services/SystemServer/Service.cpp @@ -211,7 +211,7 @@ void Service::spawn(int socket_fd) setenv("SOCKET_TAKEOVER", builder.to_string().characters(), true); } - if (m_account.has_value()) { + if (m_account.has_value() && m_account.value().uid() != getuid()) { auto& account = m_account.value(); if (setgid(account.gid()) < 0 || setgroups(account.extra_gids().size(), account.extra_gids().data()) < 0 || setuid(account.uid()) < 0) { dbgln("Failed to drop privileges (GID={}, UID={})\n", account.gid(), account.uid());