Mercurial > crates > nonstick
diff src/libpam/mod.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 | 002adfb98c5c |
children |
line wrap: on
line diff
--- a/src/libpam/mod.rs Sun Jun 08 04:21:58 2025 -0400 +++ b/src/libpam/mod.rs Tue Jun 10 01:09:30 2025 -0400 @@ -13,52 +13,8 @@ mod handle; mod memory; mod module; +pub(crate) mod pam_ffi; mod question; +#[doc(inline)] pub use handle::{LibPamHandle, OwnedLibPamHandle}; -use std::ffi::{c_char, c_int, c_void}; - -#[link(name = "pam")] -extern "C" { - fn pam_get_data( - pamh: *mut LibPamHandle, - module_data_name: *const c_char, - data: &mut *const c_void, - ) -> c_int; - - fn pam_set_data( - pamh: *mut LibPamHandle, - module_data_name: *const c_char, - data: *const c_void, - cleanup: extern "C" fn(pamh: *const c_void, data: *mut c_void, error_status: c_int), - ) -> c_int; - - fn pam_get_item(pamh: *mut LibPamHandle, item_type: c_int, item: &mut *const c_void) -> c_int; - - fn pam_set_item(pamh: *mut LibPamHandle, item_type: c_int, item: *const c_void) -> c_int; - - fn pam_get_user( - pamh: *mut LibPamHandle, - user: &mut *const c_char, - prompt: *const c_char, - ) -> c_int; - - fn pam_get_authtok( - pamh: *mut LibPamHandle, - item_type: c_int, - data: &mut *const c_char, - prompt: *const c_char, - ) -> c_int; - - fn pam_end(pamh: *mut LibPamHandle, status: c_int) -> c_int; - - // TODO: pam_authenticate - app - // pam_setcred - app - // pam_acct_mgmt - app - // pam_chauthtok - app - // pam_open_session - app - // pam_close_session - app - // pam_putenv - shared - // pam_getenv - shared - // pam_getenvlist - shared -}