Mercurial > crates > nonstick
diff src/pam_ffi.rs @ 60:05cc2c27334f
The Big Refactor: clean up docs and exports.
- Brings the most important symbols in the library to the root
with `pub use` statements.
- Expands and updates documentation.
- Rearranges things extensively to make the external interface nicer
and make the structure easier to understand.
- Renames a few things (e.g. `Result`).
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Wed, 21 May 2025 19:00:51 -0400 |
parents | |
children | bbe84835d6db |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pam_ffi.rs Wed May 21 19:00:51 2025 -0400 @@ -0,0 +1,49 @@ +//! Functions exported by the PAM FFI. + +use libc::c_char; +use std::ffi::c_int; + +#[link(name = "pam")] +extern "C" { + pub fn pam_get_data( + pamh: *const libc::c_void, + module_data_name: *const c_char, + data: &mut *const libc::c_void, + ) -> c_int; + + pub fn pam_set_data( + pamh: *mut libc::c_void, + module_data_name: *const c_char, + data: *const libc::c_void, + cleanup: extern "C" fn( + pamh: *const libc::c_void, + data: *mut libc::c_void, + error_status: c_int, + ), + ) -> c_int; + + pub fn pam_get_item( + pamh: *const libc::c_void, + item_type: c_int, + item: &mut *const libc::c_void, + ) -> c_int; + + pub fn pam_set_item( + pamh: *mut libc::c_void, + item_type: c_int, + item: *const libc::c_void, + ) -> c_int; + + pub fn pam_get_user( + pamh: *const libc::c_void, + user: &mut *const c_char, + prompt: *const c_char, + ) -> c_int; + + pub fn pam_get_authtok( + pamh: *const libc::c_void, + item_type: c_int, + data: &mut *const c_char, + prompt: *const c_char, + ) -> c_int; +}