comparison src/libpam/conversation.rs @ 171:e27c5c667a5a

Create full new types for return code and flags, separate end to end. This plumbs the ReturnCode and RawFlags types through the places where we call into or are called from PAM. Also adds Sun documentation to the project.
author Paul Fisher <paul@pfish.zone>
date Fri, 25 Jul 2025 20:52:14 -0400
parents a75a66cb4181
children 6727cbe56f4a
comparison
equal deleted inserted replaced
170:f052e2417195 171:e27c5c667a5a
9 use libpam_sys_helpers::PtrPtrVec; 9 use libpam_sys_helpers::PtrPtrVec;
10 use std::ffi::{c_int, c_void}; 10 use std::ffi::{c_int, c_void};
11 use std::iter; 11 use std::iter;
12 use std::ptr::NonNull; 12 use std::ptr::NonNull;
13 use std::result::Result as StdResult; 13 use std::result::Result as StdResult;
14 use crate::constants::ReturnCode;
14 15
15 /// The type used by PAM to call back into a conversation. 16 /// The type used by PAM to call back into a conversation.
16 /// 17 ///
17 /// This has the same structure as a [`libpam_sys::pam_conv`]. 18 /// This has the same structure as a [`libpam_sys::pam_conv`].
18 #[derive(Debug)] 19 #[derive(Debug)]
62 // Send our answers back. 63 // Send our answers back.
63 let owned = Answers::build(messages)?; 64 let owned = Answers::build(messages)?;
64 *answers_ptr = owned.into_ptr(); 65 *answers_ptr = owned.into_ptr();
65 Ok(()) 66 Ok(())
66 }; 67 };
67 ErrorCode::result_to_c(internal()) 68 ReturnCode::from(internal()).into()
68 } 69 }
69 } 70 }
70 71
71 /// A conversation owned by a PAM handle and lent to us. 72 /// A conversation owned by a PAM handle and lent to us.
72 #[derive(Debug)] 73 #[derive(Debug)]