Struct pam_client::Session[][src]

#[must_use]pub struct Session<'a, ConvT> where
    ConvT: ConversationHandler
{ /* fields omitted */ }

An active PAM session or pseudo session

Implementations

impl<'a, ConvT> Session<'a, ConvT> where
    ConvT: ConversationHandler
[src]

pub fn refresh_credentials(&mut self, flags: Flag) -> Result<()>[src]

Extends the lifetime of existing credentials.

Might be called periodically for long running sessions to keep e.g. Kerberos tokens alive.

Relevant flags are Flag::NONE and Flag::SILENT.

Errors

Expected error codes include:

  • ReturnCode::BUF_ERR: Memory allocation error
  • ReturnCode::CRED_ERR: Setting credentials failed
  • ReturnCode::CRED_EXPIRED: Credentials are expired
  • ReturnCode::CRED_UNAVAIL: Failed to retrieve credentials
  • ReturnCode::SYSTEM_ERR: Other system error
  • ReturnCode::USER_UNKNOWN: User not known

pub fn reinitialize_credentials(&mut self, flags: Flag) -> Result<()>[src]

Fully reinitializes the user’s credentials.

Relevant flags are Flag::NONE and Flag::SILENT.

See Context::reinitialize_credentials() for more information.

pub fn leak(self) -> SessionToken[src]

Converts the session into a SessionToken without closing it.

The returned token can be used to resume handling the session with Context::unleak_session().

Please note, that if the session isn’t closed eventually and the established credentials aren’t deleted, security problems might occur.

Depending on the platform it may be possible to close the session from another context than the one that started the session. But as this behaviour cannot be safely relied upon, it is recommended to close the session within the same PAM context.

#[must_use]pub fn getenv<'b>(&'b self, name: &str) -> Option<&'b str>[src]

Returns the value of a PAM environment variable.

See Context::getenv().

pub fn putenv(&mut self, name_value: &str) -> Result<()>[src]

Sets or unsets a PAM environment variable.

See Context::putenv().

#[must_use]pub fn envlist(&self) -> EnvList[src]

Returns a copy of the PAM environment in this context.

See Context::envlist().

pub fn close(self, flags: Flag) -> ExtResult<(), Self>[src]

Manually closes the session

Closes the PAM session and deletes credentials established when opening the session. Session closing happens automatically when dropping the session, so this is not strictly required.

Please note that the application must usually have the same privileges to close as it had to open the session (e.g. have EUID 0).

Relevant flags are Flag::NONE and Flag::SILENT

Errors

Expected error codes include:

  • ReturnCode::ABORT: Generic failure
  • ReturnCode::BUF_ERR: Memory allocation error
  • ReturnCode::SESSION_ERR: Generic session failure
  • ReturnCode::CRED_ERR: Deleting credentials failed
  • ReturnCode::SYSTEM_ERR: Other system error

The ownership of self is passed back in the error payload. On drop the session will once again try to close itself.

Trait Implementations

impl<'a, ConvT> Drop for Session<'a, ConvT> where
    ConvT: ConversationHandler
[src]

Destructor ending the PAM session and deleting established credentials

Auto Trait Implementations

impl<'a, ConvT> !RefUnwindSafe for Session<'a, ConvT>

impl<'a, ConvT> Send for Session<'a, ConvT> where
    ConvT: Send

impl<'a, ConvT> !Sync for Session<'a, ConvT>

impl<'a, ConvT> Unpin for Session<'a, ConvT>

impl<'a, ConvT> !UnwindSafe for Session<'a, ConvT>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.