comparison src/libpam/pam_ffi.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 5ddbcada30f2
children b87100c5eed4
comparison
equal deleted inserted replaced
96:f3e260f9ddcb 97:efe2f5f8b5b2
74 /// - `appdata` is the `appdata` field of the [`LibPamConversation`]. 74 /// - `appdata` is the `appdata` field of the [`LibPamConversation`].
75 pub type ConversationCallback = unsafe extern "C" fn( 75 pub type ConversationCallback = unsafe extern "C" fn(
76 num_msg: c_int, 76 num_msg: c_int,
77 questions: *const *const Question, 77 questions: *const *const Question,
78 answers: *mut *mut Answer, 78 answers: *mut *mut Answer,
79 appdata: *mut AppData, 79 appdata: *const AppData,
80 ) -> c_int; 80 ) -> c_int;
81 81
82 /// The type used by PAM to call back into a conversation. 82 /// The type used by PAM to call back into a conversation.
83 #[repr(C)] 83 #[repr(C)]
84 pub struct LibPamConversation<'a> { 84 pub struct LibPamConversation<'a> {
85 /// The function that is called to get information from the user. 85 /// The function that is called to get information from the user.
86 pub callback: ConversationCallback, 86 pub callback: ConversationCallback,
87 /// The pointer that will be passed as the last parameter 87 /// The pointer that will be passed as the last parameter
88 /// to the conversation callback. 88 /// to the conversation callback.
89 pub appdata: *mut AppData, 89 pub appdata: *const AppData,
90 pub life: PhantomData<&'a mut ()>, 90 pub life: PhantomData<&'a mut ()>,
91 pub _marker: Immovable, 91 pub _marker: Immovable,
92 } 92 }
93 93
94 /// Gets a string version of an error message. 94 /// Gets a string version of an error message.