Add support for group-based permission checking in ext2

This commit is contained in:
anbo225
2024-12-12 16:59:16 +08:00
committed by Tate, Hongliang Tian
parent 6cea8d2a8c
commit e75b6320ad
16 changed files with 153 additions and 42 deletions

View File

@ -12,6 +12,7 @@ use crate::{
fs::{
fs_resolver::{FsPath, FsResolver, AT_FDCWD},
path::Dentry,
utils::Permission,
},
prelude::*,
};
@ -77,7 +78,11 @@ pub fn check_executable_file(dentry: &Dentry) -> Result<()> {
return_errno_with_message!(Errno::EACCES, "the dentry is not a regular file");
}
if !dentry.mode()?.is_executable() {
if dentry
.inode()
.check_permission(Permission::MAY_EXEC)
.is_err()
{
return_errno_with_message!(Errno::EACCES, "the dentry is not executable");
}