diff src/libpam/pam_ffi.rs @ 101:94b51fa4f797

Fix memory soundness issues: - Ensure Questions are pinned in memory when sending them through PAM. - Hold on to the PAM conversation struct after we build it. (Linux-PAM is leninent about this and copies the pam_conv structure.)
author Paul Fisher <paul@pfish.zone>
date Tue, 24 Jun 2025 17:54:33 -0400
parents b87100c5eed4
children 94eb11cb1798
line wrap: on
line diff
--- a/src/libpam/pam_ffi.rs	Tue Jun 24 17:08:01 2025 -0400
+++ b/src/libpam/pam_ffi.rs	Tue Jun 24 17:54:33 2025 -0400
@@ -57,7 +57,6 @@
     /// but for requests with style `PAM_BINARY_PROMPT`,
     /// this will be `CBinaryData` (a Linux-PAM extension).
     pub data: Option<CHeapBox<c_void>>,
-    pub _marker: Immovable,
 }
 
 /// The callback that PAM uses to get information in a conversation.
@@ -86,8 +85,9 @@
     /// The pointer that will be passed as the last parameter
     /// to the conversation callback.
     pub appdata: *const AppData,
+    /// Marker to associate the lifetime of this with the conversation
+    /// that was passed in.
     pub life: PhantomData<&'a mut ()>,
-    pub _marker: Immovable,
 }
 
 /// Gets a string version of an error message.