Loading Cargo.lock +1 −0 Original line number Diff line number Diff line Loading @@ -1204,6 +1204,7 @@ dependencies = [ "educe", "libc", "once_cell", "serde", "tempfile", "thiserror", "users", Loading crates/fs-mistrust/Cargo.toml +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ derive_builder = { version = "0.11", package = "derive_builder_fork_arti" } educe = "0.4.6" thiserror = "1" walkdir = { version = "2", optional = true } serde = { version = "1.0.103", features = ["derive"], optional = true } [target.'cfg(unix)'.dependencies] libc = "0.2" Loading crates/fs-mistrust/src/lib.rs +5 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,8 @@ mod user; pub(crate) mod testing; pub mod walk; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::{ fs::DirBuilder, path::{Path, PathBuf}, Loading Loading @@ -315,7 +317,10 @@ pub use user::{TrustedGroup, TrustedUser}; /// * support more kinds of trust configuration, including more trusted users, /// trusted groups, multiple trusted directories, etc? #[derive(Debug, Clone, derive_builder::Builder)] #[cfg_attr(feature = "serde", builder(derive(Debug, Serialize, Deserialize)))] #[cfg_attr(not(feature = "serde"), builder(derive(Debug)))] #[builder(build_fn(error = "Error"))] #[cfg_attr(feature = "serde", builder_struct_attr(serde(default)))] pub struct Mistrust { /// If the user called [`MistrustBuilder::ignore_prefix`], what did they give us? /// Loading crates/fs-mistrust/src/user.rs +10 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ use crate::Error; use once_cell::sync::Lazy; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::{ ffi::{OsStr, OsString}, sync::Mutex, Loading Loading @@ -80,7 +82,12 @@ fn cur_groups() -> Vec<u32> { } /// A user that we can be configured to trust. // // TODO: This thing is quite ugly to serialize and deserialize! Ideally I'd like // something where I can say `33` for a number, `"user"` for a username... and I // don't know what they should say for "Current" or "Nobody". #[derive(Clone, Debug, educe::Educe, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[educe(Default)] #[non_exhaustive] pub enum TrustedUser { Loading Loading @@ -144,7 +151,10 @@ impl TrustedUser { } /// A group that we can be configured to trust. // // TODO: See TODO for User above. #[derive(Clone, Debug, educe::Educe, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[educe(Default)] #[non_exhaustive] pub enum TrustedGroup { Loading Loading
Cargo.lock +1 −0 Original line number Diff line number Diff line Loading @@ -1204,6 +1204,7 @@ dependencies = [ "educe", "libc", "once_cell", "serde", "tempfile", "thiserror", "users", Loading
crates/fs-mistrust/Cargo.toml +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ derive_builder = { version = "0.11", package = "derive_builder_fork_arti" } educe = "0.4.6" thiserror = "1" walkdir = { version = "2", optional = true } serde = { version = "1.0.103", features = ["derive"], optional = true } [target.'cfg(unix)'.dependencies] libc = "0.2" Loading
crates/fs-mistrust/src/lib.rs +5 −0 Original line number Diff line number Diff line Loading @@ -283,6 +283,8 @@ mod user; pub(crate) mod testing; pub mod walk; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::{ fs::DirBuilder, path::{Path, PathBuf}, Loading Loading @@ -315,7 +317,10 @@ pub use user::{TrustedGroup, TrustedUser}; /// * support more kinds of trust configuration, including more trusted users, /// trusted groups, multiple trusted directories, etc? #[derive(Debug, Clone, derive_builder::Builder)] #[cfg_attr(feature = "serde", builder(derive(Debug, Serialize, Deserialize)))] #[cfg_attr(not(feature = "serde"), builder(derive(Debug)))] #[builder(build_fn(error = "Error"))] #[cfg_attr(feature = "serde", builder_struct_attr(serde(default)))] pub struct Mistrust { /// If the user called [`MistrustBuilder::ignore_prefix`], what did they give us? /// Loading
crates/fs-mistrust/src/user.rs +10 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ use crate::Error; use once_cell::sync::Lazy; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use std::{ ffi::{OsStr, OsString}, sync::Mutex, Loading Loading @@ -80,7 +82,12 @@ fn cur_groups() -> Vec<u32> { } /// A user that we can be configured to trust. // // TODO: This thing is quite ugly to serialize and deserialize! Ideally I'd like // something where I can say `33` for a number, `"user"` for a username... and I // don't know what they should say for "Current" or "Nobody". #[derive(Clone, Debug, educe::Educe, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[educe(Default)] #[non_exhaustive] pub enum TrustedUser { Loading Loading @@ -144,7 +151,10 @@ impl TrustedUser { } /// A group that we can be configured to trust. // // TODO: See TODO for User above. #[derive(Clone, Debug, educe::Educe, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[educe(Default)] #[non_exhaustive] pub enum TrustedGroup { Loading