Struct pam_client::Session [−][src]
An active PAM session or pseudo session
Implementations
impl<'a, ConvT> Session<'a, ConvT> where
ConvT: ConversationHandler,
[src]
ConvT: ConversationHandler,
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 errorReturnCode::CRED_ERR
: Setting credentials failedReturnCode::CRED_EXPIRED
: Credentials are expiredReturnCode::CRED_UNAVAIL
: Failed to retrieve credentialsReturnCode::SYSTEM_ERR
: Other system errorReturnCode::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 failureReturnCode::BUF_ERR
: Memory allocation errorReturnCode::SESSION_ERR
: Generic session failureReturnCode::CRED_ERR
: Deleting credentials failedReturnCode::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]
ConvT: ConversationHandler,
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,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,