summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-27 12:34:43 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-27 12:34:43 +0100
commitc9d7fc6ec603bf549829983291662649b98e6665 (patch)
tree0b131ba133d305c74df2fe50942f5017d1f7ba95
parent1d2529b4a13a18900d36f9d3b914b1bca68d962f (diff)
downloadserenity-c9d7fc6ec603bf549829983291662649b98e6665.zip
Kernel: chmod() should allow superuser to change mode bits of any file.
-rw-r--r--Kernel/VirtualFileSystem.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/Kernel/VirtualFileSystem.cpp b/Kernel/VirtualFileSystem.cpp
index 21b604159a..45acec8e89 100644
--- a/Kernel/VirtualFileSystem.cpp
+++ b/Kernel/VirtualFileSystem.cpp
@@ -300,8 +300,7 @@ KResult VFS::chmod(const String& path, mode_t mode, Inode& base)
if (inode->fs().is_readonly())
return KResult(-EROFS);
- // FIXME: Superuser should always be allowed to chmod.
- if (current->euid() != inode->metadata().uid)
+ if (current->euid() != inode->metadata().uid && !current->is_superuser())
return KResult(-EPERM);
// Only change the permission bits.