mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-17 15:02:24 +00:00
SystemServer: Change user only when needed
This commit is contained in:
parent
a13ffffbec
commit
a3b8a9a142
Notes:
sideshowbarker
2024-07-17 08:16:08 +09:00
Author: https://github.com/LucasChollet
Commit: a3b8a9a142
Pull-request: https://github.com/SerenityOS/serenity/pull/14673
Reviewed-by: https://github.com/linusg
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