1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

Kernel: Add sid and pgid to Credentials

There are places in the kernel that would like to have access
to `pgid` credentials in certain circumstances.

I haven't found any use cases for `sid` yet, but `sid` and `pgid` are
both changed with `sys$setpgid`, so it seemed sensical to add it.

In Linux, `man 7 credentials` also mentions both the session id and
process group id, so this isn't unprecedented.
This commit is contained in:
yyny 2022-12-19 21:21:51 +01:00 committed by Andreas Kling
parent 456a8436b5
commit 9ca979846c
6 changed files with 62 additions and 18 deletions

View file

@ -10,13 +10,13 @@
namespace Kernel {
ErrorOr<NonnullRefPtr<Credentials>> Credentials::create(UserID uid, GroupID gid, UserID euid, GroupID egid, UserID suid, GroupID sgid, Span<GroupID const> extra_gids)
ErrorOr<NonnullRefPtr<Credentials>> Credentials::create(UserID uid, GroupID gid, UserID euid, GroupID egid, UserID suid, GroupID sgid, Span<GroupID const> extra_gids, SessionID sid, ProcessGroupID pgid)
{
auto extra_gids_array = TRY(FixedArray<GroupID>::try_create(extra_gids));
return adopt_nonnull_ref_or_enomem(new (nothrow) Credentials(uid, gid, euid, egid, suid, sgid, move(extra_gids_array)));
return adopt_nonnull_ref_or_enomem(new (nothrow) Credentials(uid, gid, euid, egid, suid, sgid, move(extra_gids_array), sid, pgid));
}
Credentials::Credentials(UserID uid, GroupID gid, UserID euid, GroupID egid, UserID suid, GroupID sgid, FixedArray<GroupID> extra_gids)
Credentials::Credentials(UserID uid, GroupID gid, UserID euid, GroupID egid, UserID suid, GroupID sgid, FixedArray<GroupID> extra_gids, SessionID sid, ProcessGroupID pgid)
: m_uid(uid)
, m_gid(gid)
, m_euid(euid)
@ -24,6 +24,8 @@ Credentials::Credentials(UserID uid, GroupID gid, UserID euid, GroupID egid, Use
, m_suid(suid)
, m_sgid(sgid)
, m_extra_gids(move(extra_gids))
, m_sid(sid)
, m_pgid(pgid)
{
}