Mercurial > crates > nonstick
diff src/libpam/conversation.rs @ 97:efe2f5f8b5b2
Implement "stateless" application-side PAM calls.
This introduces `authenticate`, `account_management`, and `change_authtok`.
These are the three PAM operations that are stateless (i.e., they don't start
a session or modify global credentials).
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Mon, 23 Jun 2025 19:10:34 -0400 |
parents | f3e260f9ddcb |
children | b87100c5eed4 |
line wrap: on
line diff
--- a/src/libpam/conversation.rs Mon Jun 23 14:26:34 2025 -0400 +++ b/src/libpam/conversation.rs Mon Jun 23 19:10:34 2025 -0400 @@ -15,10 +15,10 @@ use std::result::Result as StdResult; impl LibPamConversation<'_> { - fn wrap<C: Conversation>(conv: &mut C) -> Self { + pub fn wrap<C: Conversation>(conv: &C) -> Self { Self { callback: Self::wrapper_callback::<C>, - appdata: (conv as *mut C).cast(), + appdata: (conv as *const C).cast(), life: PhantomData, _marker: Immovable(PhantomData), } @@ -31,13 +31,13 @@ count: c_int, questions: *const *const Question, answers: *mut *mut Answer, - me: *mut AppData, + me: *const AppData, ) -> c_int { let internal = || { // Collect all our pointers let conv = me .cast::<C>() - .as_mut() + .as_ref() .ok_or(ErrorCode::ConversationError)?; let indirect = Questions::borrow_ptr(questions, count as usize); let answers_ptr = answers.as_mut().ok_or(ErrorCode::ConversationError)?;