mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-04 01:05:58 +03: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: https://github.com/SerenityOS/serenity/commit/a3b8a9a142 Pull-request: https://github.com/SerenityOS/serenity/pull/14673 Reviewed-by: https://github.com/linusg
@ -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…
Reference in New Issue
Block a user