Pārlūkot izejas kodu

Kernel: Allow uid 0 to read/write/execute any file.

Andreas Kling 6 gadi atpakaļ
vecāks
revīzija
7c18b86781
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. 6 0
      Kernel/InodeMetadata.h

+ 6 - 0
Kernel/InodeMetadata.h

@@ -26,6 +26,8 @@ struct InodeMetadata {
 
     bool may_read(uid_t u, const HashTable<gid_t>& g) const
     {
+        if (u == 0)
+            return true;
         if (uid == u)
             return mode & 0400;
         if (g.contains(gid))
@@ -35,6 +37,8 @@ struct InodeMetadata {
 
     bool may_write(uid_t u, const HashTable<gid_t>& g) const
     {
+        if (u == 0)
+            return true;
         if (uid == u)
             return mode & 0200;
         if (g.contains(gid))
@@ -44,6 +48,8 @@ struct InodeMetadata {
 
     bool may_execute(uid_t u, const HashTable<gid_t>& g) const
     {
+        if (u == 0)
+            return true;
         if (uid == u)
             return mode & 0100;
         if (g.contains(gid))