pub struct Session<'a, ConvT> where
    ConvT: ConversationHandler
{ /* private fields */ }
Expand description

An active PAM session or pseudo session

Implementations

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

Fully reinitializes the user’s credentials.

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

See Context::reinitialize_credentials() for more information.

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.

Returns the value of a PAM environment variable.

See Context::getenv().

Sets or unsets a PAM environment variable.

See Context::putenv().

Returns a copy of the PAM environment in this context.

See Context::envlist().

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

Destructor ending the PAM session and deleting established credentials

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.