From bd40a8ffd94de98e6c1d96b5c9abfa126c414fd7 Mon Sep 17 00:00:00 2001 From: Grzegorz Godlewski Date: Thu, 8 Oct 2020 21:19:19 +0200 Subject: [PATCH] Add function for getting cached old authentication token. --- Cargo.toml | 2 +- src/libpam.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b335170..08742ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pamsm" -version = "0.4.1" +version = "0.4.2" description = "Rust wrappers around PAM Service Modules functions" authors = ["Raphael Catolino "] license = "GPL-3.0" diff --git a/src/libpam.rs b/src/libpam.rs index 3c653ac..af993d0 100644 --- a/src/libpam.rs +++ b/src/libpam.rs @@ -61,6 +61,9 @@ pub trait PamLibExt: private::Sealed { /// Get the cached authentication token. fn get_cached_authtok(&self) -> PamResult>; + /// Get the cached old authentication token. + fn get_cached_oldauthtok(&self) -> PamResult>; + /// Get the cached authentication token or prompt the user for one if there isn't any. /// Returns PamError::SERVICE_ERR if the prompt contains any null byte fn get_authtok(&self, prompt: Option<&str>) -> PamResult>; @@ -125,6 +128,10 @@ impl PamLibExt for Pam { self.get_cstr_item(PamItemType::AUTHTOK) } + fn get_cached_oldauthtok(&self) -> PamResult> { + self.get_cstr_item(PamItemType::OLDAUTHTOK) + } + fn get_authtok(&self, prompt: Option<&str>) -> PamResult> { let cprompt = match prompt { None => None, -- 2.51.2