mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
Kernel: Allow uid 0 to read/write/execute any file.
This commit is contained in:
parent
d7d6deaa5c
commit
7c18b86781
1 changed files with 6 additions and 0 deletions
|
@ -26,6 +26,8 @@ struct InodeMetadata {
|
||||||
|
|
||||||
bool may_read(uid_t u, const HashTable<gid_t>& g) const
|
bool may_read(uid_t u, const HashTable<gid_t>& g) const
|
||||||
{
|
{
|
||||||
|
if (u == 0)
|
||||||
|
return true;
|
||||||
if (uid == u)
|
if (uid == u)
|
||||||
return mode & 0400;
|
return mode & 0400;
|
||||||
if (g.contains(gid))
|
if (g.contains(gid))
|
||||||
|
@ -35,6 +37,8 @@ struct InodeMetadata {
|
||||||
|
|
||||||
bool may_write(uid_t u, const HashTable<gid_t>& g) const
|
bool may_write(uid_t u, const HashTable<gid_t>& g) const
|
||||||
{
|
{
|
||||||
|
if (u == 0)
|
||||||
|
return true;
|
||||||
if (uid == u)
|
if (uid == u)
|
||||||
return mode & 0200;
|
return mode & 0200;
|
||||||
if (g.contains(gid))
|
if (g.contains(gid))
|
||||||
|
@ -44,6 +48,8 @@ struct InodeMetadata {
|
||||||
|
|
||||||
bool may_execute(uid_t u, const HashTable<gid_t>& g) const
|
bool may_execute(uid_t u, const HashTable<gid_t>& g) const
|
||||||
{
|
{
|
||||||
|
if (u == 0)
|
||||||
|
return true;
|
||||||
if (uid == u)
|
if (uid == u)
|
||||||
return mode & 0100;
|
return mode & 0100;
|
||||||
if (g.contains(gid))
|
if (g.contains(gid))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue