pub enum PrivilegeTool {
Sudo,
Doas,
}Expand description
What: Privilege escalation tool supported by Pacsea.
Inputs: None (enum variant selection).
Output: Identifies which privilege tool to invoke.
Details:
Sudouses the standard sudo binary with full feature support (stdin password, credential caching, askpass).Doasuses theOpenDoasbinary with limited feature support (no stdin password, no credential caching).
Variants§
Sudo
Standard sudo — full feature support.
Doas
OpenDoas — limited feature support (no stdin password pipe, no credential caching).
Implementations§
Source§impl PrivilegeTool
impl PrivilegeTool
Sourcepub const fn binary_name(self) -> &'static str
pub const fn binary_name(self) -> &'static str
What: Return the shell binary name for this tool.
Inputs: None.
Output: "sudo" or "doas".
Details: Used in command construction and which lookups.
Sourcepub const fn capabilities(self) -> PrivilegeCapabilities
pub const fn capabilities(self) -> PrivilegeCapabilities
What: Return the capability flags for this tool.
Inputs: None.
Output: PrivilegeCapabilities with tool-specific flags.
Details:
- sudo: all capabilities enabled.
- doas: all capabilities disabled (see module-level docs for rationale).
Sourcepub fn is_available(self) -> bool
pub fn is_available(self) -> bool
What: Check whether this tool’s binary exists on $PATH.
Inputs: None.
Output: true if the binary is found.
Details:
- In integration test context (
PACSEA_INTEGRATION_TEST=1), honorsPACSEA_TEST_PRIVILEGE_AVAILABLE(comma-separated list, or"none"). - Production: delegates to
which::which.
Sourcepub fn check_passwordless(self) -> Result<bool, String>
pub fn check_passwordless(self) -> Result<bool, String>
What: Check whether passwordless privilege escalation is available.
Inputs: None.
Output: Ok(true) if non-interactive execution succeeds, Err if the check itself fails.
§Errors
Returns Err if the tool binary cannot be executed (e.g. not installed).
Details:
- Runs
<tool> -n true(-n= non-interactive,true= no-op command). - Both sudo and doas support the
-nflag. - In integration test context, honors
PACSEA_TEST_SUDO_PASSWORDLESS.
Trait Implementations§
Source§impl Clone for PrivilegeTool
impl Clone for PrivilegeTool
Source§fn clone(&self) -> PrivilegeTool
fn clone(&self) -> PrivilegeTool
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrivilegeTool
impl Debug for PrivilegeTool
Source§impl Display for PrivilegeTool
impl Display for PrivilegeTool
Source§impl PartialEq for PrivilegeTool
impl PartialEq for PrivilegeTool
impl Copy for PrivilegeTool
impl Eq for PrivilegeTool
impl StructuralPartialEq for PrivilegeTool
Auto Trait Implementations§
impl Freeze for PrivilegeTool
impl RefUnwindSafe for PrivilegeTool
impl Send for PrivilegeTool
impl Sync for PrivilegeTool
impl Unpin for PrivilegeTool
impl UnsafeUnpin for PrivilegeTool
impl UnwindSafe for PrivilegeTool
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.