Skip to main content

LibPamHandle

Struct LibPamHandle 

Source
pub struct LibPamHandle(/* private fields */);
Expand description

An owned variation of a basic PAM handle.

This is the most basic version of a wrapped PAM handle. It’s mostly used as the inside of the LibPamTransaction, but can also be used to “adopt” a PAM handle created by another library.

If Self::end is not called, this will always call pam_end reporting successful completion.

Implementations§

Source§

impl LibPamHandle

Source

pub fn end(&mut self, result: Result<()>)

Source

pub fn end_silent(&mut self, result: Result<()>)

Ends the transaction “quietly”, reporting the given result.

On Linux-PAM only, this sets the PAM_DATA_SILENT flag on the value passed to the cleanup callbacks. This conventionally means that this pam_end call is occurring on a forked process, and that a session may still be open on the parent process, and modules “should not treat the call too seriously”.

§References
Source

pub fn inner(&self) -> &pam_handle

Gets a reference to the inner PAM handle.

Source

pub fn inner_mut(&mut self) -> &mut pam_handle

Gets a mutable reference to the inner PAM handle.

Trait Implementations§

Source§

impl Conversation for LibPamHandle

Source§

fn communicate(&self, messages: &[Exchange<'_>])

Sends messages to the user. Read more
Source§

impl Logger for LibPamHandle

Source§

fn log(&self, level: Level, loc: Location<'_>, entry: Arguments<'_>)

Logs something via this PAM handle. Read more
Source§

impl ModuleClient for LibPamHandle

Source§

fn username(&mut self, prompt: Option<&OsStr>) -> Result<OsString>

Retrieves the name of the user who is authenticating or logging in. Read more
Source§

fn authtok(&mut self, prompt: Option<&OsStr>) -> Result<OsString>

Retrieves the authentication token from the user. Read more
Source§

fn old_authtok(&mut self, prompt: Option<&OsStr>) -> Result<OsString>

Retrieves the user’s old authentication token when changing passwords. Read more
Source§

fn get_module_data<T: 'static>(&self, key: &str) -> Option<&T>

Gets an item of module-specific data stored over the transaction. Read more
Source§

fn set_module_data<T: 'static>(&mut self, key: &str, data: T) -> Result<()>

Sets module-specific data. Read more
Source§

fn authtok_item(&self) -> Result<Option<OsString>>

Gets the user’s authentication token (e.g., password). Read more
Source§

fn old_authtok_item(&self) -> Result<Option<OsString>>

Gets the user’s old authentication token when changing passwords. Read more
Source§

impl PamShared for LibPamHandle

Source§

fn environ(&self) -> impl EnvironMap<'_>

The contents of the environment to set for the logged-in user. Read more
Source§

fn environ_mut(&mut self) -> impl EnvironMapMut<'_>

A writable map of the environment to set for the logged-in user. Read more
Source§

fn items(&self) -> impl Items<'_>

Gets Items, data shared by PAM, the application, and modules. Read more
Source§

fn items_mut(&mut self) -> impl ItemsMut<'_>

Read-write access to PAM Items. Read more
Source§

impl Transaction for LibPamHandle

Source§

fn authenticate(&mut self, flags: AuthnFlags) -> Result<()>

Starts the authentication process for the user. Read more
Source§

fn account_management(&mut self, flags: AuthnFlags) -> Result<()>

Verifies the validity of the user’s account (and other stuff). Read more
Source§

fn change_authtok(&mut self, flags: AuthtokFlags) -> Result<()>

Changes the authentication token. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<C> ConversationAdapter for C
where C: Conversation + ?Sized,

Source§

fn prompt(&self, message: impl AsRef<OsStr>) -> Result<OsString, ErrorCode>

Prompts the user for something.
Source§

fn masked_prompt( &self, message: impl AsRef<OsStr>, ) -> Result<OsString, ErrorCode>

Prompts the user for something, but hides what the user types.
Source§

fn error_msg(&self, message: impl AsRef<OsStr>)

Alerts the user to an error.
Source§

fn info_msg(&self, message: impl AsRef<OsStr>)

Sends an informational message to the user.
Source§

fn radio_prompt( &self, message: impl AsRef<OsStr>, ) -> Result<OsString, ErrorCode>

[Linux extension] Prompts the user for a yes/no/maybe conditional. Read more
Source§

fn binary_prompt(&self, _: (&[u8], u8)) -> Result<BinaryData, ErrorCode>

[Linux extension] Requests binary data from the user. Read more
Source§

fn into_conversation(self) -> Demux<Self>
where Self: Sized,

Lets you use this simple conversation as a full Conversation. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.