Mercurial > crates > nonstick
diff src/libpam/module.rs @ 77:351bdc13005e
Update the libpam module to work with the new structure.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 08 Jun 2025 01:03:46 -0400 |
parents | c30811b4afae |
children | 002adfb98c5c |
line wrap: on
line diff
--- a/src/libpam/module.rs Sat Jun 07 18:55:27 2025 -0400 +++ b/src/libpam/module.rs Sun Jun 08 01:03:46 2025 -0400 @@ -1,5 +1,3 @@ -use std::ffi::CStr; - /// Generates the dynamic library entry points for a [PamModule] implementation. /// /// Calling `pam_hooks!(SomeType)` on a type that implements [PamModule] will @@ -10,8 +8,8 @@ /// /// Here is full example of a PAM module that would authenticate and authorize everybody: /// -/// ``` -/// use nonstick::{Flags, OwnedLibPamHandle, PamModule, PamHandleModule, Result as PamResult, pam_hooks}; +/// ```no_run +/// use nonstick::{Flags, SimpleConversation, OwnedLibPamHandle, PamModule, PamHandleModule, Result as PamResult, pam_hooks}; /// use std::ffi::CStr; /// # fn main() {} /// @@ -21,12 +19,15 @@ /// impl<T: PamHandleModule> PamModule<T> for MyPamModule { /// fn authenticate(handle: &mut T, args: Vec<&CStr>, flags: Flags) -> PamResult<()> { /// let password = handle.get_authtok(Some("what's your password?"))?; -/// handle.info_msg(fmt!("If you say your password is {password:?}, who am I to disagree?")); +/// let response = format!("If you say your password is {password:?}, who am I to disagree?"); +/// handle.info_msg(&response); +/// Ok(()) /// } /// /// fn account_management(handle: &mut T, args: Vec<&CStr>, flags: Flags) -> PamResult<()> { /// let username = handle.get_user(None)?; -/// handle.info_msg(fmt!("Hello {username}! I trust you unconditionally.")) +/// let response = format!("Hello {username}! I trust you unconditionally."); +/// handle.info_msg(&response); /// Ok(()) /// } /// }