pub struct PrivDrop {
pub uid: Option<u32>,
pub gid: Option<u32>,
pub chroot: Option<PathBuf>,
}Expand description
A resolved set of privilege-dropping actions: switch to uid/gid and,
optionally, chroot into a directory. Build one with PrivDrop::parse,
then apply it once, after all listeners are bound.
Fields§
§uid: Option<u32>Target user id, if a user was requested.
gid: Option<u32>Target group id, if a group (or a user with a primary group) was requested.
chroot: Option<PathBuf>Directory to chroot into before dropping, if any.
Implementations§
Source§impl PrivDrop
impl PrivDrop
Sourcepub fn parse(user: Option<&str>, chroot: Option<&str>) -> Result<PrivDrop>
pub fn parse(user: Option<&str>, chroot: Option<&str>) -> Result<PrivDrop>
Parse a user spec and an optional chroot path into a PrivDrop.
user accepts NAME, UID, NAME:GROUP, or UID:GID. A non-numeric
NAME is resolved to its uid via getpwnam_r; if no group is given the
user’s primary gid is adopted. A non-numeric GROUP is resolved via
getgrnam_r. Numeric components are used directly.
Trait Implementations§
impl Eq for PrivDrop
impl StructuralPartialEq for PrivDrop
Auto Trait Implementations§
impl Freeze for PrivDrop
impl RefUnwindSafe for PrivDrop
impl Send for PrivDrop
impl Sync for PrivDrop
impl Unpin for PrivDrop
impl UnsafeUnpin for PrivDrop
impl UnwindSafe for PrivDrop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.