1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Add geteuid() and getegid().

There's no support for set-uid or set-gid executables yet so these don't
actually do anything. It's just nice to get the boilerplate stuff in.
This commit is contained in:
Andreas Kling 2018-11-05 15:04:19 +01:00
parent 60a8144b68
commit e4611248c4
6 changed files with 38 additions and 3 deletions

View file

@ -303,7 +303,7 @@ int Process::exec(const String& path, Vector<String>&& arguments, Vector<String>
return error;
}
if (!handle->metadata().mayExecute(m_uid, m_gid))
if (!handle->metadata().mayExecute(m_euid, m_egid))
return -EACCES;
auto elfData = handle->readEntireFile();
@ -563,6 +563,8 @@ Process::Process(String&& name, uid_t uid, gid_t gid, pid_t parentPID, RingLevel
, m_pid(next_pid++) // FIXME: RACE: This variable looks racy!
, m_uid(uid)
, m_gid(gid)
, m_euid(uid)
, m_egid(gid)
, m_state(Runnable)
, m_ring(ring)
, m_cwd(move(cwd))
@ -1219,6 +1221,16 @@ gid_t Process::sys$getgid()
return m_gid;
}
uid_t Process::sys$geteuid()
{
return m_euid;
}
gid_t Process::sys$getegid()
{
return m_egid;
}
pid_t Process::sys$getpid()
{
return m_pid;