comparison src/libpam/answer.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 3f11b8d30f63
children
comparison
equal deleted inserted replaced
100:3f11b8d30f63 101:94b51fa4f797
4 use crate::libpam::memory; 4 use crate::libpam::memory;
5 use crate::libpam::memory::{CBinaryData, CHeapBox, CHeapString}; 5 use crate::libpam::memory::{CBinaryData, CHeapBox, CHeapString};
6 pub use crate::libpam::pam_ffi::Answer; 6 pub use crate::libpam::pam_ffi::Answer;
7 use crate::{ErrorCode, Result}; 7 use crate::{ErrorCode, Result};
8 use std::ffi::CStr; 8 use std::ffi::CStr;
9 use std::mem::ManuallyDrop;
9 use std::ops::{Deref, DerefMut}; 10 use std::ops::{Deref, DerefMut};
10 use std::ptr::NonNull; 11 use std::ptr::NonNull;
11 use std::{iter, mem, ptr, slice}; 12 use std::{iter, ptr, slice};
12 use std::mem::ManuallyDrop;
13 13
14 /// The corridor via which the answer to Messages navigate through PAM. 14 /// The corridor via which the answer to Messages navigate through PAM.
15 #[derive(Debug)] 15 #[derive(Debug)]
16 pub struct Answers { 16 pub struct Answers {
17 /// The actual list of answers. This can't be a [`CHeapBox`] because 17 /// The actual list of answers. This can't be a [`CHeapBox`] because