diff options
author | Nico Weber <thakis@chromium.org> | 2020-06-17 14:08:14 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-18 23:19:16 +0200 |
commit | dd53e070c5199d54392316f1398296442b578f9d (patch) | |
tree | cc7b540a1440132e41b4269a6e8ca4334cc580ea /Kernel/Process.cpp | |
parent | a38754d9f2e1fc5955de02eb75cd1d4cf853a83a (diff) | |
download | serenity-dd53e070c5199d54392316f1398296442b578f9d.zip |
Kernel+LibC: Remove setreuid() / setregid() again
It looks like they're considered a bad idea, so let's not add
them before we need them. I figured it's good to have them in
git history if we ever do need them though, hence the add/remove
dance.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r-- | Kernel/Process.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index c0a308df4c..f902679548 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -2187,48 +2187,6 @@ int Process::sys$setgid(gid_t gid) return 0; } -int Process::sys$setreuid(uid_t ruid, uid_t euid) -{ - REQUIRE_PROMISE(id); - - // This has FreeBSD semantics. - // Linux and Solaris also allow id == m_suid. - auto ok = [this](uid_t id) { return id == (uid_t)-1 || id == m_uid || id == m_euid; }; - if ((!ok(ruid) || !ok(euid)) && !is_superuser()) - return -EPERM; - - if (ruid != (uid_t)-1) - m_uid = ruid; - if (euid != (uid_t)-1) - m_euid = euid; - - if (ruid != (uid_t)-1 || m_euid != m_uid) - m_suid = m_euid; - - return 0; -} - -int Process::sys$setregid(gid_t rgid, gid_t egid) -{ - REQUIRE_PROMISE(id); - - // This has FreeBSD semantics. - // Linux and Solaris also allow id == m_sgid. - auto ok = [this](gid_t id) { return id == (gid_t)-1 || id == m_gid || id == m_egid; }; - if ((!ok(rgid) || !ok(egid)) && !is_superuser()) - return -EPERM; - - if (rgid != (gid_t)-1) - m_gid = rgid; - if (egid != (gid_t)-1) - m_egid = egid; - - if (rgid != (gid_t)-1 || m_egid != m_gid) - m_sgid = m_egid; - - return 0; -} - int Process::sys$setresuid(uid_t ruid, uid_t euid, uid_t suid) { REQUIRE_PROMISE(id); |