comparison 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
comparison
equal deleted inserted replaced
59:3f4a77aa88be 60:05cc2c27334f
1 //! Functions exported by the PAM FFI.
2
3 use libc::c_char;
4 use std::ffi::c_int;
5
6 #[link(name = "pam")]
7 extern "C" {
8 pub fn pam_get_data(
9 pamh: *const libc::c_void,
10 module_data_name: *const c_char,
11 data: &mut *const libc::c_void,
12 ) -> c_int;
13
14 pub fn pam_set_data(
15 pamh: *mut libc::c_void,
16 module_data_name: *const c_char,
17 data: *const libc::c_void,
18 cleanup: extern "C" fn(
19 pamh: *const libc::c_void,
20 data: *mut libc::c_void,
21 error_status: c_int,
22 ),
23 ) -> c_int;
24
25 pub fn pam_get_item(
26 pamh: *const libc::c_void,
27 item_type: c_int,
28 item: &mut *const libc::c_void,
29 ) -> c_int;
30
31 pub fn pam_set_item(
32 pamh: *mut libc::c_void,
33 item_type: c_int,
34 item: *const libc::c_void,
35 ) -> c_int;
36
37 pub fn pam_get_user(
38 pamh: *const libc::c_void,
39 user: &mut *const c_char,
40 prompt: *const c_char,
41 ) -> c_int;
42
43 pub fn pam_get_authtok(
44 pamh: *const libc::c_void,
45 item_type: c_int,
46 data: &mut *const c_char,
47 prompt: *const c_char,
48 ) -> c_int;
49 }