diff src/libpam/answer.rs @ 80:5aa1a010f1e8

Start using PAM headers; improve owned/borrowed distinction. - Uses bindgen to generate bindings (only if needed). - Gets the story together on owned vs. borrowed handles. - Reduces number of mutable borrows in handle operation (since `PamHandle` is neither `Send` nor `Sync`, we never have to worry about thread safety. - Improves a bunch of macros so we don't have our own special syntax for docs. - Implement question indirection for standard XSSO PAM implementations.
author Paul Fisher <paul@pfish.zone>
date Tue, 10 Jun 2025 01:09:30 -0400
parents 2128123b9406
children 05291b601f0a
line wrap: on
line diff
--- a/src/libpam/answer.rs	Sun Jun 08 04:21:58 2025 -0400
+++ b/src/libpam/answer.rs	Tue Jun 10 01:09:30 2025 -0400
@@ -2,9 +2,10 @@
 
 use crate::libpam::conversation::OwnedMessage;
 use crate::libpam::memory;
-use crate::libpam::memory::{CBinaryData, Immovable};
+use crate::libpam::memory::CBinaryData;
+pub use crate::libpam::pam_ffi::Answer;
 use crate::{ErrorCode, Result};
-use std::ffi::{c_int, c_void, CStr};
+use std::ffi::CStr;
 use std::ops::{Deref, DerefMut};
 use std::{iter, mem, ptr, slice};
 
@@ -195,23 +196,6 @@
     }
 }
 
-/// Generic version of answer data.
-///
-/// This has the same structure as [`BinaryAnswer`]
-/// and [`TextAnswer`].
-#[repr(C)]
-#[derive(Debug)]
-pub struct Answer {
-    /// Pointer to the data returned in an answer.
-    /// For most answers, this will be a [`CStr`], but for answers to
-    /// [`MessageStyle::BinaryPrompt`]s, this will be [`CBinaryData`]
-    /// (a Linux-PAM extension).
-    data: *mut c_void,
-    /// Unused.
-    return_code: c_int,
-    _marker: Immovable,
-}
-
 impl Answer {
     /// Frees the contents of this answer.
     ///