diff src/conv.rs @ 59:3f4a77aa88be

Fix string copyting and improve error situation. This change is too big and includes several things: - Fix copying strings from PAM by fixing const and mut on pam funcs. - Improve error enums by simplifying conversions and removing unnecessary and ambiguous "success" variants. - Make a bunch of casts nicer. - Assorted other cleanup.
author Paul Fisher <paul@pfish.zone>
date Wed, 21 May 2025 00:27:18 -0400
parents daa2cde64601
children 05cc2c27334f
line wrap: on
line diff
--- a/src/conv.rs	Mon May 05 00:16:04 2025 -0400
+++ b/src/conv.rs	Wed May 21 00:27:18 2025 -0400
@@ -2,9 +2,9 @@
 use std::ffi::{CStr, CString};
 use std::ptr;
 
+use crate::constants::ErrorCode;
 use crate::constants::MessageStyle;
 use crate::constants::PamResult;
-use crate::constants::ErrorCode;
 use crate::items::Item;
 
 #[repr(C)]
@@ -60,6 +60,7 @@
             msg_style: style,
             msg: msg_cstr.as_ptr(),
         };
+        // TODO: These need to be freed!
         let ret = (self.0.conv)(1, &&msg, &mut resp_ptr, self.0.appdata_ptr);
         ErrorCode::result_from(ret)?;