Mercurial > crates > nonstick
annotate libpam-sys/src/lib.rs @ 138:999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Build times now fast!
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Thu, 03 Jul 2025 20:55:40 -0400 |
parents | 88627c057709 |
children | 4b3a5095f68c |
rev | line source |
---|---|
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
1 //! `libpam-sys` provides low-level access to `libpam`. |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
2 //! |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
3 //! Everything in here is directly as exported from the `libpam` library or |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
4 //! its header files, with limited exceptions: |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
5 //! |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
6 //! - The [`pam_impl`] submodule (and the [`pam_impl_name!`] macro) contains |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
7 //! tools for detecting the current PAM library. |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
8 //! - [`AppData`] is an opaque pointer newtype. |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
9 //! - [`ConversationCallback`] and [`CleanupCallback`] are aliases for |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
10 //! what are otherwise anonymous function types. |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
11 //! |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
12 #![doc = concat!("This documentation was built for the **", pam_impl_name!(), "** implementation.")] |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
13 //! |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
14 //! You can override this **at build time** by setting the `LIBPAMSYS_IMPL` |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
15 //! environment variable to one of the values of the [`pam_impl::PamImpl`] enum. |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
16 //! |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
17 //! For more information about configuration, see [the README](https://crates.io/crate/libpam-sys). |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
18 #![allow(non_camel_case_types)] |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
19 #![allow(unused_imports)] |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
20 |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
21 #[doc(inline)] |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
22 pub use libpam_sys_helpers::constants::*; |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
23 #[doc(inline)] |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
24 pub use libpam_sys_helpers::{pam_impl, pam_impl_name}; |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
25 use std::ffi::{c_char, c_int, c_uint, c_void}; |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
26 use std::fmt; |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
27 use std::marker::{PhantomData, PhantomPinned}; |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
28 |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
29 /// A marker struct to make whatever it's in `!Sync`, `!Send`, and `!Unpin`. |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
30 #[derive(Default, PartialOrd, PartialEq, Ord, Eq)] |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
31 #[repr(C)] |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
32 struct ExtremelyUnsafe { |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
33 _value: (), |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
34 _marker: PhantomData<(PhantomPinned, *mut c_void)>, |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
35 } |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
36 |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
37 impl fmt::Debug for ExtremelyUnsafe { |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
38 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
39 write!(f, "ExtremelyUnsafe({self:p})") |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
40 } |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
41 } |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
42 |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
43 /// An opaque structure that PAM uses to communicate. |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
44 /// |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
45 /// This is only ever returned in pointer form and cannot be constructed. |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
46 #[repr(C)] |
127 | 47 pub struct pam_handle(ExtremelyUnsafe); |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
48 |
127 | 49 impl fmt::Debug for pam_handle { |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
50 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
51 write!(f, "pam_handle({self:p}") |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
52 } |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
53 } |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
54 |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
55 /// An opaque structure that is passed through PAM in a conversation. |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
56 #[repr(C)] |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
57 pub struct AppData(ExtremelyUnsafe); |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
58 |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
59 impl fmt::Debug for AppData { |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
60 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
61 write!(f, "AppData({self:p}") |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
62 } |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
63 } |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
64 |
127 | 65 /// Just an alias for the type of [`pam_conv::conv`]. |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
66 /// |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
67 /// For important details about the format of `messages`, |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
68 /// see [`libpam_sys_helpers::memory::PtrPtrVec`]. |
127 | 69 /// |
70 /// ```no_run | |
71 /// # use libpam_sys::{ConversationCallback, pam_conv}; | |
72 /// fn convo() -> ConversationCallback { | |
73 /// // ... | |
74 /// # unimplemented!() | |
75 /// } | |
76 /// let conv = pam_conv{conv: convo(), appdata_ptr: std::ptr::null_mut()}; | |
77 /// ``` | |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
78 pub type ConversationCallback = unsafe extern "C" fn( |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
79 num_msg: c_int, |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
80 msg: *const *const pam_message, |
127 | 81 resp: *mut *mut pam_response, |
82 appdata: *mut AppData, | |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
83 ) -> c_int; |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
84 |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
85 /// Alias for the callback to [`pam_set_data`]. |
127 | 86 /// |
87 /// ```no_run | |
88 /// # use std::ffi::CString; | |
89 /// use libpam_sys::{CleanupCallback, pam_set_data}; | |
90 /// # use libpam_sys::pam_handle; | |
91 /// # let handle: *mut pam_handle = std::ptr::null_mut(); | |
92 /// # let mut my_data = 100; | |
93 /// # let data_ptr = &mut my_data as *mut i32; | |
94 /// fn cleanup() -> CleanupCallback { | |
95 /// // ... | |
96 /// # unimplemented!() | |
97 /// } | |
98 /// let name = CString::new("name").unwrap(); | |
99 /// unsafe { | |
100 /// pam_set_data(handle, name.as_ptr().cast_mut(), data_ptr.cast(), cleanup()); | |
101 /// } | |
102 /// ``` | |
130
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
103 pub type CleanupCallback = |
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
104 unsafe extern "C" fn(pamh: *mut pam_handle, data: *mut c_void, pam_end_status: c_int); |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
105 |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
106 /// Used by PAM to communicate between the module and the application. |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
107 #[repr(C)] |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
108 pub struct pam_conv { |
127 | 109 pub conv: unsafe extern "C" fn( |
110 num_msg: c_int, | |
111 msg: *const *const pam_message, | |
112 resp: *mut *mut pam_response, | |
113 appdata: *mut AppData, | |
114 ) -> c_int, | |
115 pub appdata_ptr: *mut AppData, | |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
116 } |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
117 |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
118 /// A message sent into a PAM conversation. |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
119 #[repr(C)] |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
120 pub struct pam_message { |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
121 pub msg_style: c_int, |
127 | 122 pub msg: *const c_char, |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
123 } |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
124 |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
125 /// A response returned from a PAM conversation. |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
126 #[repr(C)] |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
127 pub struct pam_response { |
127 | 128 pub resp: *mut c_char, |
125
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
129 /// Completely unused. |
2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents:
119
diff
changeset
|
130 pub resp_retcode: c_int, |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
117
diff
changeset
|
131 } |
127 | 132 |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
133 /// Definition of the PAM_XAUTHDATA item. Compatible with `xcb_auth_info_t`. |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
134 #[cfg(pam_impl = "LinuxPam")] |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
135 #[repr(C)] |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
136 pub struct pam_xauth_data { |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
137 pub namelen: c_int, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
138 pub name: *mut c_char, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
139 pub datalen: c_int, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
140 pub data: *mut c_char, |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
141 } |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
142 |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
143 #[cfg(pam_impl = "LinuxPam")] |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
144 #[derive(Debug)] |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
145 #[repr(C)] |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
146 pub struct pam_modutil_privs { |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
147 pub grplist: *mut libc::gid_t, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
148 pub number_of_groups: c_int, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
149 pub allocated: c_int, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
150 pub old_gid: libc::gid_t, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
151 pub old_uid: libc::uid_t, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
152 pub is_dropped: c_int, |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
153 } |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
154 |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
155 #[cfg(pam_impl = "OpenPam")] |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
156 pub type pam_func_t = unsafe extern "C" fn( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
157 handle: *mut pam_handle, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
158 flags: c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
159 argc: c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
160 argv: *const *const c_char, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
161 ) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
162 |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
163 #[cfg(pam_impl = "OpenPam")] |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
164 #[derive(Debug)] |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
165 #[repr(C)] |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
166 pub struct pam_module { |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
167 pub path: *mut c_char, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
168 pub func: [pam_func_t; 6], |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
169 pub dlh: *mut c_void, |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
170 } |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
171 |
137
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
172 #[cfg(any(pam_impl = "OpenPam", pam_impl = "Sun"))] |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
173 #[derive(Debug)] |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
174 #[repr(C)] |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
175 pub struct pam_repository { |
137
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
176 pub type_: *mut c_char, |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
177 pub scope: *mut c_void, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
178 pub scope_len: usize, |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
179 } |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
180 |
127 | 181 // These are the functions specified in X/SSO. Everybody exports them. |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
182 #[link(name = "pam")] |
127 | 183 extern "C" { |
184 /// Account validation. | |
185 pub fn pam_acct_mgmt(pamh: *mut pam_handle, flags: c_int) -> c_int; | |
186 | |
187 /// Authenticate a user. | |
188 pub fn pam_authenticate(pamh: *mut pam_handle, flags: c_int) -> c_int; | |
189 | |
190 // Nobody implements pam_authenticate_secondary. | |
191 | |
192 /// Manage authentication tokens. | |
193 pub fn pam_chauthtok(pamh: *mut pam_handle, flags: c_int) -> c_int; | |
194 | |
195 /// Close an opened user session. | |
196 pub fn pam_close_session(pamh: *mut pam_handle, flags: c_int) -> c_int; | |
197 | |
198 /// Ends the PAM transaction. | |
199 pub fn pam_end(pamh: *mut pam_handle, flags: c_int) -> c_int; | |
200 | |
201 /// Gets module-specific data. PAM still owns the data. | |
202 pub fn pam_get_data( | |
203 pamh: *mut pam_handle, | |
204 module_data_name: *const c_char, | |
205 data: *mut *const c_void, | |
206 ) -> c_int; | |
207 | |
208 /// Gets an environment variable. You own the return value. | |
130
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
209 pub fn pam_getenv(pamh: *const pam_handle, name: *const c_char) -> *mut c_char; |
127 | 210 |
211 /// Gets all the environment variables. You own everything it points to. | |
130
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
212 pub fn pam_getenvlist(pamh: *const pam_handle) -> *mut *mut c_char; |
127 | 213 |
214 /// Get information about the transaction. | |
215 /// | |
216 /// The item is owned by PAM. | |
217 pub fn pam_get_item( | |
130
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
218 pamh: *const pam_handle, |
127 | 219 item_type: c_int, |
220 item: *mut *const c_void, | |
221 ) -> c_int; | |
222 | |
223 // Nobody implements pam_get_mapped_authtok. | |
224 // Nobody implements pam_get_mapped_username. | |
225 | |
226 /// Get the username. PAM owns it. | |
227 pub fn pam_get_user( | |
228 pamh: *mut pam_handle, | |
229 user: *mut *const c_char, | |
230 prompt: *const c_char, | |
231 ) -> c_int; | |
232 | |
233 /// Opens a user session. | |
234 pub fn pam_open_session(pamh: *mut pam_handle, flags: c_int) -> c_int; | |
235 | |
236 /// Sets the value of an environment variable. `namevalue` is copied. | |
237 pub fn pam_putenv(pamh: *mut pam_handle, namevalue: *const c_char) -> c_int; | |
238 | |
239 /// Update or delete user credentials. | |
240 pub fn pam_setcred(pamh: *mut pam_handle, flags: c_int) -> c_int; | |
241 | |
242 /// Set module-specific data. PAM will call `cleanup` when completed. | |
243 pub fn pam_set_data( | |
244 pamh: *mut pam_handle, | |
245 module_data_name: *const c_char, | |
246 data: *mut c_void, | |
247 cleanup: unsafe extern "C" fn( | |
248 pamh: *mut pam_handle, | |
249 data: *mut c_void, | |
250 pam_end_status: c_int, | |
251 ), | |
252 ) -> c_int; | |
253 | |
254 /// Set information about the transaction. The `item` is copied. | |
255 pub fn pam_set_item(pamh: *mut pam_handle, item_type: c_int, item: *const c_void) -> c_int; | |
256 | |
257 // Nobody implements pam_set_mapped_authtok. | |
258 // Nobody implements pam_set_mapped_username. | |
259 | |
260 // The pam_sm_whatever functions are prototypes for the functions that | |
261 // a PAM module should implement, not symbols provided by PAM. | |
262 | |
263 // Nobody implements pam_authenticate_secondary. | |
264 | |
265 /// Starts a PAM transaction. The `conv` may or may not be copied. | |
266 pub fn pam_start( | |
267 service: *const c_char, | |
268 user: *const c_char, | |
269 pam_conv: *mut pam_conv, | |
270 pamh: *mut *mut pam_handle, | |
271 ) -> c_int; | |
272 | |
273 /// Gets a statically-allocated error string. | |
274 /// | |
275 /// All implementations of PAM known to this library (Linux-PAM, OpenPAM, | |
276 /// and Sun) ignore `pamh` and will accept a null pointer. | |
277 pub fn pam_strerror(pamh: *const pam_handle, error_number: c_int) -> *mut c_char; | |
278 } | |
279 | |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
280 #[cfg(any(pam_impl = "LinuxPam", pam_impl = "OpenPam"))] |
127 | 281 extern "C" { |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
282 /// Gets `PAM_AUTHTOK`, or asks the user if that is unset. |
130
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
283 pub fn pam_get_authtok( |
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
284 pamh: *mut pam_handle, |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
285 item: c_int, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
286 authtok: *mut *const c_char, |
130
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
287 prompt: *const c_char, |
80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
129
diff
changeset
|
288 ) -> c_int; |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
289 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
290 pub fn pam_prompt( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
291 pamh: *const pam_handle, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
292 style: c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
293 response: *mut *mut c_char, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
294 fmt: *const c_char, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
295 ... |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
296 ) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
297 |
127 | 298 } |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
299 |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
300 #[cfg(pam_impl = "LinuxPam")] |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
301 extern "C" { |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
302 pub fn pam_fail_delay(pamh: *mut pam_handle, musec_delay: c_uint) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
303 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
304 /// Start a PAM transaction based on configuration in the given directory. |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
305 pub fn pam_start_confdir( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
306 service_name: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
307 user: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
308 pam_conversation: *mut pam_conv, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
309 confdir: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
310 pamh: *mut *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
311 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
312 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
313 // We don't export the v-variants of the formatting functions. |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
314 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
315 pub fn pam_syslog(pamh: *const pam_handle, priority: c_int, fmt: *const c_char, ...); |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
316 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
317 pub fn pam_get_authtok_noverify( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
318 pamh: *const pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
319 authtok: *mut *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
320 prompt: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
321 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
322 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
323 pub fn pam_get_authtok_verify( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
324 pamh: *const pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
325 authtok: *mut *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
326 prompt: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
327 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
328 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
329 // pam_modutil also lives in libpam for Linux. |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
330 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
331 pub fn pam_modutil_check_user_in_passwd( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
332 pamh: *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
333 user_name: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
334 file_name: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
335 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
336 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
337 pub fn pam_modutil_getpwnam(pamh: *mut pam_handle, user: *const c_char) -> *mut libc::passwd; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
338 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
339 pub fn pam_modutil_getpwuid(pamh: *mut pam_handle, uid: libc::uid_t) -> *mut libc::passwd; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
340 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
341 pub fn pam_modutil_getgrnam(pamh: *mut pam_handle, group: *const c_char) -> *mut libc::group; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
342 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
343 pub fn pam_modutil_getgrgid(pamh: *mut pam_handle, gid: libc::gid_t) -> *mut libc::group; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
344 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
345 pub fn pam_modutil_getspnam(pamh: *mut pam_handle, user: *const c_char) -> *mut libc::spwd; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
346 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
347 pub fn pam_modutil_user_in_group_nam_nam( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
348 pamh: *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
349 user: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
350 group: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
351 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
352 pub fn pam_modutil_user_in_group_nam_gid( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
353 pamh: *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
354 user: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
355 group: libc::gid_t, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
356 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
357 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
358 pub fn pam_modutil_user_in_group_uid_nam( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
359 pamh: *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
360 user: libc::uid_t, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
361 group: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
362 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
363 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
364 pub fn pam_modutil_user_in_group_uid_gid( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
365 pamh: *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
366 user: libc::uid_t, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
367 group: libc::gid_t, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
368 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
369 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
370 pub fn pam_modutil_getlogin(pamh: *mut pam_handle) -> *const c_char; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
371 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
372 pub fn pam_modutil_read(fd: c_int, buffer: *mut c_char, count: c_int) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
373 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
374 pub fn pam_modutil_write(fd: c_int, buffer: *const c_char, count: c_int) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
375 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
376 pub fn pam_modutil_audit_write( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
377 pamh: *mut pam_handle, |
137
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
378 type_: c_int, |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
379 message: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
380 retval: c_int, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
381 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
382 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
383 pub fn pam_modutil_drop_priv( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
384 pamh: *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
385 p: *mut pam_modutil_privs, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
386 pw: *const libc::passwd, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
387 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
388 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
389 pub fn pam_modutil_regain_priv(pamh: *mut pam_handle, p: *mut pam_modutil_privs) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
390 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
391 pub fn pam_modutil_sanitize_helper_fds( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
392 pamh: *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
393 redirect_stdin: pam_modutil_redirect_fd, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
394 redirect_stdout: pam_modutil_redirect_fd, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
395 redirect_stderr: pam_modutil_redirect_fd, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
396 ) -> c_int; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
397 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
398 pub fn pam_modutil_search_key( |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
399 pamh: *mut pam_handle, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
400 file_name: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
401 key: *const c_char, |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
402 ) -> *mut c_char; |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
130
diff
changeset
|
403 } |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
404 |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
405 #[cfg(pam_impl = "OpenPam")] |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
406 extern "C" { |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
407 pub fn openpam_borrow_cred(pamh: *mut pam_handle, passwd: *const libc::passwd) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
408 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
409 pub fn openpam_subst( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
410 pamh: *const pam_handle, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
411 buf: *mut c_char, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
412 _bufsize: *mut usize, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
413 _template: *const c_char, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
414 ) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
415 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
416 pub fn openpam_free_data(pamh: *mut pam_handle, data: *mut c_void, status: c_int); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
417 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
418 pub fn openpam_free_envlist(_envlist: *mut *mut c_char); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
419 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
420 pub fn openpam_get_option(_pamh: *mut pam_handle, _option: *const c_char) -> *const c_char; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
421 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
422 pub fn openpam_restore_cred(pamh: *mut pam_handle) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
423 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
424 pub fn openpam_set_option( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
425 _pamh: *mut pam_handle, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
426 _option: *const c_char, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
427 _value: *const c_char, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
428 ) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
429 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
430 pub fn pam_error(pamh: *const pam_handle, _fmt: *const c_char, ...) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
431 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
432 pub fn pam_info(_pamh: *const pam_handle, _fmt: *const c_char, ...) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
433 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
434 pub fn openpam_readline( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
435 _f: *mut libc::FILE, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
436 _lineno: *mut c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
437 _lenp: *mut usize, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
438 ) -> *mut c_char; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
439 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
440 pub fn openpam_readlinev( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
441 _f: *mut libc::FILE, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
442 _lineno: *mut c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
443 _lenp: *mut c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
444 ) -> *mut *mut c_char; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
445 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
446 pub fn openpam_readword( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
447 _f: *mut libc::FILE, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
448 _lineno: *mut c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
449 _lenp: *mut usize, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
450 ) -> *mut c_char; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
451 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
452 pub fn openpam_straddch( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
453 _str: *mut *mut c_char, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
454 _sizep: *mut usize, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
455 _lenp: *mut usize, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
456 ch: c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
457 ) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
458 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
459 pub fn openpam_set_feature(_feature: c_int, _onoff: c_int) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
460 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
461 pub fn openpam_get_feature(_feature: c_int, _onoff: *mut c_int) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
462 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
463 pub fn _openpam_log(_level: c_int, _func: *const c_char, _fmt: *const c_char, ...); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
464 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
465 /// A premade conversation function that talks to the TTY. |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
466 /// |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
467 /// ```no_run |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
468 /// # use std::ffi::CString; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
469 /// # use std::ptr; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
470 /// use libpam_sys::*; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
471 /// # let service = CString::new("whatever").unwrap(); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
472 /// # let user = CString::new("whatever").unwrap(); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
473 /// let mut handle: *mut pam_handle = ptr::null_mut(); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
474 /// let mut conv = pam_conv{ |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
475 /// conv: openpam_ttyconv, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
476 /// appdata_ptr: ptr::null_mut(), |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
477 /// }; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
478 /// let result = unsafe { pam_start( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
479 /// service.as_ptr(), user.as_ptr(), &mut conv, &mut handle |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
480 /// ) }; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
481 /// ``` |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
482 pub fn openpam_ttyconv( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
483 n: c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
484 _msg: *const *const pam_message, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
485 _resp: *mut *mut pam_response, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
486 _data: *mut AppData, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
487 ) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
488 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
489 pub static mut openpam_ttyconv_timeout: c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
490 |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
491 /// A null conversation function. |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
492 /// |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
493 /// ```no_run |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
494 /// # use std::ffi::CString; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
495 /// # use std::ptr; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
496 /// use libpam_sys::*; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
497 /// # let service = CString::new("whatever").unwrap(); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
498 /// # let user = CString::new("whatever").unwrap(); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
499 /// let mut handle: *mut pam_handle = ptr::null_mut(); |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
500 /// let mut conv = pam_conv{ |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
501 /// conv: openpam_nullconv, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
502 /// appdata_ptr: ptr::null_mut(), |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
503 /// }; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
504 /// let result = unsafe { pam_start( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
505 /// service.as_ptr(), user.as_ptr(), &mut conv, &mut handle |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
506 /// ) }; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
507 /// ``` |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
508 pub fn openpam_nullconv( |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
509 n: c_int, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
510 _msg: *const *const pam_message, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
511 _resp: *mut *mut pam_response, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
512 _data: *mut AppData, |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
513 ) -> c_int; |
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
514 } |
137
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
515 |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
516 #[cfg(pam_impl = "Sun")] |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
517 extern "C" { |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
518 pub fn __pam_get_authtok( |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
519 pamh: *mut pam_handle, |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
520 source: c_int, |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
521 type_: c_int, |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
522 prompt: *const c_char, |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
523 authtok: *mut *mut c_char, |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
524 ) -> c_int; |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
525 |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
526 pub fn __pam_log(priority: c_int, format: *const c_char, ...); |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
527 } |