mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
SystemServer: Change user only when needed
This commit is contained in:
parent
a13ffffbec
commit
a3b8a9a142
1 changed files with 1 additions and 1 deletions
|
@ -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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue