1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:57:35 +00:00

Kernel: Don't include the process GID in the "extra GIDs" table

Process::m_extra_gids is for supplementary GIDs only.
This commit is contained in:
Andreas Kling 2020-01-02 23:45:52 +01:00
parent 0958d826d6
commit fdde5cdf26
3 changed files with 26 additions and 25 deletions

View file

@ -30,35 +30,35 @@ struct InodeMetadata {
bool may_write(Process&) const;
bool may_execute(Process&) const;
bool may_read(uid_t u, const HashTable<gid_t>& g) const
bool may_read(uid_t u, gid_t g, const HashTable<gid_t>& eg) const
{
if (u == 0)
return true;
if (uid == u)
return mode & 0400;
if (g.contains(gid))
if (gid == g || eg.contains(gid))
return mode & 0040;
return mode & 0004;
}
bool may_write(uid_t u, const HashTable<gid_t>& g) const
bool may_write(uid_t u, gid_t g, const HashTable<gid_t>& eg) const
{
if (u == 0)
return true;
if (uid == u)
return mode & 0200;
if (g.contains(gid))
if (gid == g || eg.contains(gid))
return mode & 0020;
return mode & 0002;
}
bool may_execute(uid_t u, const HashTable<gid_t>& g) const
bool may_execute(uid_t u, gid_t g, const HashTable<gid_t>& eg) const
{
if (u == 0)
return true;
if (uid == u)
return mode & 0100;
if (g.contains(gid))
if (gid == g || eg.contains(gid))
return mode & 0010;
return mode & 0001;
}