summaryrefslogtreecommitdiff
path: root/ayafs-core/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'ayafs-core/src/utils')
-rw-r--r--ayafs-core/src/utils/permissions.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/ayafs-core/src/utils/permissions.rs b/ayafs-core/src/utils/permissions.rs
index 53205b5..756ca95 100644
--- a/ayafs-core/src/utils/permissions.rs
+++ b/ayafs-core/src/utils/permissions.rs
@@ -2,7 +2,7 @@ use crate::disk::inode::InodeMode;
use libc::{F_OK, S_ISGID, S_ISUID, S_IXGRP, X_OK};
use std::fs::File;
use std::io::BufRead;
-use log::debug;
+use log::trace;
pub(crate) fn get_groups(pid: u32) -> Vec<u32> {
let file = File::open(format!("/proc/{pid}/task/{pid}/status"))
@@ -37,8 +37,16 @@ pub(crate) fn check_access(
mode: InodeMode,
mut mask: i32,
) -> bool {
- let mask_mem = mask;
- // true
+ trace!(
+ "check_access(incoming_uid: {}, incoming_gid: {}, uid: {}, gid: {}, mode: {:#o}, mask: {:#x})",
+ incoming_uid,
+ incoming_gid,
+ uid,
+ gid,
+ mode.0,
+ mask,
+ );
+
if mask == F_OK {
return true;
}
@@ -51,6 +59,7 @@ pub(crate) fn check_access(
mask -= mask & (perm >> 6);
mask -= mask & (perm >> 3);
mask -= mask & perm;
+ trace!("check_access -> {}", mask == 0);
return mask == 0;
}
@@ -62,16 +71,6 @@ pub(crate) fn check_access(
mask -= mask & perm;
}
- debug!(
- "check_access(incoming_uid: {}, incoming_gid: {}, uid: {}, gid: {}, mode: {:#o}, mask: {:#x}) -> {}",
- incoming_uid,
- incoming_gid,
- uid,
- gid,
- mode.0,
- mask_mem,
- mask == 0,
- );
-
+ trace!("check_access -> {}", mask == 0);
mask == 0
}