Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
1ab23ae085 | |||
367678b804 |
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "posix-acl"
|
name = "posix-acl"
|
||||||
version = "0.1.5"
|
version = "0.1.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
40
src/lib.rs
40
src/lib.rs
@ -176,6 +176,46 @@ impl PosixACL {
|
|||||||
entries.push(ACLEntry(qual, permset));
|
entries.push(ACLEntry(qual, permset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// There should be at leas a UserObj, GroupObj, Other and Mask on the non default ACL entries. If they dont exist, create them
|
||||||
|
|
||||||
|
if !default {
|
||||||
|
let mut found_user = false;
|
||||||
|
let mut found_group = false;
|
||||||
|
let mut found_other = false;
|
||||||
|
let mut found_mask: Option<PermSet> = None;
|
||||||
|
|
||||||
|
for ent in entries.iter() {
|
||||||
|
match ent.0 {
|
||||||
|
Qualifier::UserObj => {
|
||||||
|
found_user = true;
|
||||||
|
}
|
||||||
|
Qualifier::GroupObj => {
|
||||||
|
found_group = true;
|
||||||
|
}
|
||||||
|
Qualifier::Other => {
|
||||||
|
found_other = true;
|
||||||
|
}
|
||||||
|
Qualifier::Mask => found_mask = Some(ent.1),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let def_perm = found_mask.unwrap_or(ACL_RWX);
|
||||||
|
|
||||||
|
if !found_user {
|
||||||
|
entries.push(ACLEntry(Qualifier::UserObj, def_perm.clone()));
|
||||||
|
}
|
||||||
|
if !found_group {
|
||||||
|
entries.push(ACLEntry(Qualifier::GroupObj, def_perm.clone()));
|
||||||
|
}
|
||||||
|
if !found_other {
|
||||||
|
entries.push(ACLEntry(Qualifier::Other, def_perm.clone()));
|
||||||
|
}
|
||||||
|
if found_mask.is_none() {
|
||||||
|
entries.push(ACLEntry(Qualifier::Mask, def_perm.clone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(PosixACL { entries })
|
Ok(PosixACL { entries })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user