Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:LeChatP/RootAsRole into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
LeChatP committed Jun 10, 2024
2 parents 3859991 + b3892a9 commit c0cbe98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ use tracing::debug;

use crate::{
common::{
dac_override_effective, open_with_privileges, read_effective, util::{toggle_lock_config, ImmutableLock},
dac_override_effective, open_with_privileges, read_effective,
util::{toggle_lock_config, ImmutableLock},
write_json_config,
},
rc_refcell,
Expand Down
8 changes: 5 additions & 3 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ pub enum ImmutableLock {
Unset,
}


/// Set or unset the immutable flag on a file
/// # Arguments
/// * `file` - The file to set the immutable flag on
Expand Down Expand Up @@ -253,7 +252,11 @@ mod test {
.lines()
.find(|line| line.starts_with("CapEff:"))
.expect("Failed to find CapEff line");
let effhex = capeff.split(':').last().expect("Failed to get effective capabilities").trim();
let effhex = capeff
.split(':')
.last()
.expect("Failed to get effective capabilities")
.trim();
let eff = u64::from_str_radix(effhex, 16).expect("Failed to parse effective capabilities");
if eff & ((1 << Cap::LINUX_IMMUTABLE as u8) as u64) != 0 {
assert!(res.is_ok());
Expand All @@ -277,6 +280,5 @@ mod test {
assert!(file.is_ok());
let res = fs::remove_file(&path);
assert!(res.is_ok());

}
}

0 comments on commit c0cbe98

Please sign in to comment.