mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
Kernel: Use real UID/GID when checking for file access
This aligns the rest of the system with POSIX, who says that access(2) must check against the real UID and GID, not effective ones.
This commit is contained in:
@@ -530,17 +530,17 @@ ErrorOr<void> VirtualFileSystem::access(Credentials const& credentials, StringVi
|
||||
auto& inode = custody->inode();
|
||||
auto metadata = inode.metadata();
|
||||
if (mode & R_OK) {
|
||||
if (!metadata.may_read(credentials))
|
||||
if (!metadata.may_read(credentials, UseEffectiveIDs::No))
|
||||
return EACCES;
|
||||
}
|
||||
if (mode & W_OK) {
|
||||
if (!metadata.may_write(credentials))
|
||||
if (!metadata.may_write(credentials, UseEffectiveIDs::No))
|
||||
return EACCES;
|
||||
if (custody->is_readonly())
|
||||
return EROFS;
|
||||
}
|
||||
if (mode & X_OK) {
|
||||
if (!metadata.may_execute(credentials))
|
||||
if (!metadata.may_execute(credentials, UseEffectiveIDs::No))
|
||||
return EACCES;
|
||||
}
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user