annotate libpam-sys/src/ffi.rs @ 189:b2456d274576 default tip

Add line breaks that rustfmt ate back to documentation.
author Paul Fisher <paul@pfish.zone>
date Thu, 31 Jul 2025 15:42:12 -0400
parents 0730f5f2ee2a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
131
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
1 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
2 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
3 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
4
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 117
diff changeset
5 /// 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
6 ///
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 117
diff changeset
7 /// 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
8 #[repr(C)]
148
4b3a5095f68c Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents: 138
diff changeset
9 pub struct pam_handle {
4b3a5095f68c Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents: 138
diff changeset
10 _value: (),
4b3a5095f68c Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents: 138
diff changeset
11 _marker: PhantomData<(PhantomPinned, *mut c_void)>,
4b3a5095f68c Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents: 138
diff changeset
12 }
118
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 117
diff changeset
13
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
14 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
15 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
16 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
17 }
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 117
diff changeset
18 }
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 117
diff changeset
19
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 117
diff changeset
20 /// 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
21 #[repr(C)]
163
a75a66cb4181 Add end-to-end tests; fix issues found by tests.
Paul Fisher <paul@pfish.zone>
parents: 158
diff changeset
22 #[derive(Debug)]
125
2b255c92417b Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents: 119
diff changeset
23 pub struct pam_conv {
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
24 pub conv: unsafe extern "C" fn(
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
25 num_msg: c_int,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
26 msg: *const *const pam_message,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
27 resp: *mut *mut pam_response,
148
4b3a5095f68c Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents: 138
diff changeset
28 appdata: *mut c_void,
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
29 ) -> c_int,
148
4b3a5095f68c Move libpam-sys helpers into their own library.
Paul Fisher <paul@pfish.zone>
parents: 138
diff changeset
30 pub appdata_ptr: *mut 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
31 }
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 117
diff changeset
32
39760dfc9b3b Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents: 117
diff changeset
33 /// 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
34 #[repr(C)]
163
a75a66cb4181 Add end-to-end tests; fix issues found by tests.
Paul Fisher <paul@pfish.zone>
parents: 158
diff changeset
35 #[derive(Debug)]
125
2b255c92417b Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents: 119
diff changeset
36 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
37 pub msg_style: c_int,
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
38 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
39 }
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 /// 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
42 #[repr(C)]
163
a75a66cb4181 Add end-to-end tests; fix issues found by tests.
Paul Fisher <paul@pfish.zone>
parents: 158
diff changeset
43 #[derive(Debug)]
125
2b255c92417b Introduce base PAM functions; use the real X/SSO PAM header for tests.
Paul Fisher <paul@pfish.zone>
parents: 119
diff changeset
44 pub struct pam_response {
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
45 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
46 /// 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
47 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
48 }
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
49
131
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
50 /// 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
51 #[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
52 #[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
53 pub struct pam_xauth_data {
136
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
54 pub namelen: c_int,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
55 pub name: *mut c_char,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
56 pub datalen: c_int,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
57 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
58 }
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
59
134
6c1e1bdb4164 Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents: 133
diff changeset
60 #[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
61 #[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
62 #[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
63 pub struct pam_modutil_privs {
136
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
64 pub grplist: *mut libc::gid_t,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
65 pub number_of_groups: c_int,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
66 pub allocated: c_int,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
67 pub old_gid: libc::gid_t,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
68 pub old_uid: libc::uid_t,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
69 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
70 }
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
71
134
6c1e1bdb4164 Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents: 133
diff changeset
72 #[cfg(pam_impl = "OpenPam")]
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
73 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
74 handle: *mut pam_handle,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
75 flags: c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
76 argc: c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
77 argv: *const *const c_char,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
78 ) -> c_int;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
79
134
6c1e1bdb4164 Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents: 133
diff changeset
80 #[cfg(pam_impl = "OpenPam")]
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
81 #[derive(Debug)]
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
82 #[repr(C)]
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
83 pub struct pam_module {
136
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
84 pub path: *mut c_char,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
85 pub func: [pam_func_t; 6],
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
86 pub dlh: *mut c_void,
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
87 }
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
88
137
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
89 #[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
90 #[derive(Debug)]
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
91 #[repr(C)]
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
92 pub struct pam_repository {
137
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
93 pub type_: *mut c_char,
136
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
94 pub scope: *mut c_void,
efbc235f01d3 Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 134
diff changeset
95 pub scope_len: usize,
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
96 }
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
97
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
98 // These are the functions specified in X/SSO. Everybody exports them.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
99 extern "C" {
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
100 /// Account validation.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
101 pub fn pam_acct_mgmt(pamh: *mut pam_handle, flags: c_int) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
102
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
103 /// Authenticate a user.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
104 pub fn pam_authenticate(pamh: *mut pam_handle, flags: c_int) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
105
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
106 // Nobody implements pam_authenticate_secondary.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
107
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
108 /// Manage authentication tokens.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
109 pub fn pam_chauthtok(pamh: *mut pam_handle, flags: c_int) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
110
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
111 /// Close an opened user session.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
112 pub fn pam_close_session(pamh: *mut pam_handle, flags: c_int) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
113
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
114 /// Ends the PAM transaction.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
115 pub fn pam_end(pamh: *mut pam_handle, flags: c_int) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
116
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
117 /// Gets module-specific data. PAM still owns the data.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
118 pub fn pam_get_data(
153
3036f2e6a022 Add module-specific data support.
Paul Fisher <paul@pfish.zone>
parents: 148
diff changeset
119 pamh: *const pam_handle,
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
120 module_data_name: *const c_char,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
121 data: *mut *const c_void,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
122 ) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
123
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
124 /// 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
125 pub fn pam_getenv(pamh: *const pam_handle, name: *const c_char) -> *mut c_char;
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
126
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
127 /// 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
128 pub fn pam_getenvlist(pamh: *const pam_handle) -> *mut *mut c_char;
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
129
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
130 /// Get information about the transaction.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
131 ///
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
132 /// The item is owned by PAM.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
133 pub fn pam_get_item(
130
80c07e5ab22f Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 129
diff changeset
134 pamh: *const pam_handle,
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
135 item_type: c_int,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
136 item: *mut *const c_void,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
137 ) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
138
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
139 // Nobody implements pam_get_mapped_authtok.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
140 // Nobody implements pam_get_mapped_username.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
141
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
142 /// Get the username. PAM owns it.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
143 pub fn pam_get_user(
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
144 pamh: *mut pam_handle,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
145 user: *mut *const c_char,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
146 prompt: *const c_char,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
147 ) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
148
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
149 /// Opens a user session.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
150 pub fn pam_open_session(pamh: *mut pam_handle, flags: c_int) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
151
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
152 /// Sets the value of an environment variable. `namevalue` is copied.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
153 pub fn pam_putenv(pamh: *mut pam_handle, namevalue: *const c_char) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
154
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
155 /// Update or delete user credentials.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
156 pub fn pam_setcred(pamh: *mut pam_handle, flags: c_int) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
157
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
158 /// Set module-specific data. PAM will call `cleanup` when completed.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
159 pub fn pam_set_data(
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
160 pamh: *mut pam_handle,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
161 module_data_name: *const c_char,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
162 data: *mut c_void,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
163 cleanup: unsafe extern "C" fn(
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
164 pamh: *mut pam_handle,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
165 data: *mut c_void,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
166 pam_end_status: c_int,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
167 ),
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
168 ) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
169
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
170 /// Set information about the transaction. The `item` is copied.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
171 pub fn pam_set_item(pamh: *mut pam_handle, item_type: c_int, item: *const c_void) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
172
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
173 // Nobody implements pam_set_mapped_authtok.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
174 // Nobody implements pam_set_mapped_username.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
175
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
176 // The pam_sm_whatever functions are prototypes for the functions that
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
177 // a PAM module should implement, not symbols provided by PAM.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
178
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
179 /// Starts a PAM transaction. The `conv` may or may not be copied.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
180 pub fn pam_start(
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
181 service: *const c_char,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
182 user: *const c_char,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
183 pam_conv: *mut pam_conv,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
184 pamh: *mut *mut pam_handle,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
185 ) -> c_int;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
186
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
187 /// Gets a statically-allocated error string.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
188 ///
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
189 /// All implementations of PAM known to this library (Linux-PAM, OpenPAM,
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
190 /// and Sun) ignore `pamh` and will accept a null pointer.
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
191 pub fn pam_strerror(pamh: *const pam_handle, error_number: c_int) -> *mut c_char;
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
192 }
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
193
134
6c1e1bdb4164 Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents: 133
diff changeset
194 #[cfg(any(pam_impl = "LinuxPam", pam_impl = "OpenPam"))]
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
195 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
196 /// 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
197 pub fn pam_get_authtok(
80c07e5ab22f Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 129
diff changeset
198 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
199 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
200 authtok: *mut *const c_char,
130
80c07e5ab22f Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 129
diff changeset
201 prompt: *const c_char,
80c07e5ab22f Transfer over (almost) completely to using libpam-sys.
Paul Fisher <paul@pfish.zone>
parents: 129
diff changeset
202 ) -> c_int;
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
203
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
204 pub fn pam_prompt(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
205 pamh: *const pam_handle,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
206 style: c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
207 response: *mut *mut c_char,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
208 fmt: *const c_char,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
209 ...
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
210 ) -> c_int;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
211
127
c77846f3a979 GET CTEST WORKING.
Paul Fisher <paul@pfish.zone>
parents: 125
diff changeset
212 }
131
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
213
134
6c1e1bdb4164 Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents: 133
diff changeset
214 #[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
215 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
216 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
217
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
218 /// 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
219 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
220 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
221 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
222 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
223 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
224 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
225 ) -> 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
226
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
227 // 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
228
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
229 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
230
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
231 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
232 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
233 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
234 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
235 ) -> 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
236
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
237 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
238 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
239 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
240 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
241 ) -> 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
242
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
243 // 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
244
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
245 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
246 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
247 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
248 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
249 ) -> 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
250
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
251 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
252
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
253 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
254
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
255 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
256
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
257 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
258
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
259 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
260
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
261 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
262 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
263 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
264 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
265 ) -> c_int;
158
d5b7b28d754e Add `__TARGET_DEFAULT__` PamImpl and set up for docsrs build.
Paul Fisher <paul@pfish.zone>
parents: 154
diff changeset
266
131
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
267 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
268 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
269 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
270 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
271 ) -> 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
272
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
273 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
274 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
275 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
276 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
277 ) -> 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
278
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
279 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
280 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
281 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
282 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
283 ) -> 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
284
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
285 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
286
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
287 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
288
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
289 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
290
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
291 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
292 pamh: *mut pam_handle,
137
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
293 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
294 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
295 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
296 ) -> 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
297
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
298 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
299 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
300 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
301 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
302 ) -> 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 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
305
a632a8874131 Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents: 130
diff changeset
306 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
307 pamh: *mut pam_handle,
176
0730f5f2ee2a Turn `libpam-sys-consts` back into `libpam-sys-impls`.
Paul Fisher <paul@pfish.zone>
parents: 174
diff changeset
308 redirect_stdin: super::constants::pam_modutil_redirect_fd,
0730f5f2ee2a Turn `libpam-sys-consts` back into `libpam-sys-impls`.
Paul Fisher <paul@pfish.zone>
parents: 174
diff changeset
309 redirect_stdout: super::constants::pam_modutil_redirect_fd,
0730f5f2ee2a Turn `libpam-sys-consts` back into `libpam-sys-impls`.
Paul Fisher <paul@pfish.zone>
parents: 174
diff changeset
310 redirect_stderr: super::constants::pam_modutil_redirect_fd,
131
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 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
314 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
315 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
316 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
317 ) -> *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
318 }
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
319
134
6c1e1bdb4164 Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents: 133
diff changeset
320 #[cfg(pam_impl = "OpenPam")]
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
321 extern "C" {
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
322 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
323
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
324 pub fn openpam_subst(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
325 pamh: *const pam_handle,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
326 buf: *mut c_char,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
327 _bufsize: *mut usize,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
328 _template: *const c_char,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
329 ) -> c_int;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
330
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
331 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
332
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
333 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
334
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
335 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
336
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
337 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
338
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
339 pub fn openpam_set_option(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
340 _pamh: *mut pam_handle,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
341 _option: *const c_char,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
342 _value: *const c_char,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
343 ) -> c_int;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
344
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
345 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
346
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
347 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
348
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
349 pub fn openpam_readline(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
350 _f: *mut libc::FILE,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
351 _lineno: *mut c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
352 _lenp: *mut usize,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
353 ) -> *mut c_char;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
354
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
355 pub fn openpam_readlinev(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
356 _f: *mut libc::FILE,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
357 _lineno: *mut c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
358 _lenp: *mut c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
359 ) -> *mut *mut c_char;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
360
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
361 pub fn openpam_readword(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
362 _f: *mut libc::FILE,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
363 _lineno: *mut c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
364 _lenp: *mut usize,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
365 ) -> *mut c_char;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
366
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
367 pub fn openpam_straddch(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
368 _str: *mut *mut c_char,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
369 _sizep: *mut usize,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
370 _lenp: *mut usize,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
371 ch: c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
372 ) -> c_int;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
373
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
374 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
375
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
376 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
377
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
378 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
379
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
380 /// 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
381 ///
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
382 /// ```no_run
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
383 /// # use std::ffi::CString;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
384 /// # use std::ptr;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
385 /// use libpam_sys::*;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
386 /// # let service = CString::new("whatever").unwrap();
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
387 /// # let user = CString::new("whatever").unwrap();
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
388 /// let mut handle: *mut pam_handle = ptr::null_mut();
174
9e4ce1631bd3 Dramatically expand documentation.
Paul Fisher <paul@pfish.zone>
parents: 163
diff changeset
389 /// let mut conv = pam_conv {
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
390 /// conv: openpam_ttyconv,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
391 /// appdata_ptr: ptr::null_mut(),
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
392 /// };
174
9e4ce1631bd3 Dramatically expand documentation.
Paul Fisher <paul@pfish.zone>
parents: 163
diff changeset
393 /// let result = unsafe { pam_start(service.as_ptr(), user.as_ptr(), &mut conv, &mut handle) };
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
394 /// ```
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
395 pub fn openpam_ttyconv(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
396 n: c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
397 _msg: *const *const pam_message,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
398 _resp: *mut *mut pam_response,
154
f71bfffb6de1 fix remaining AppDatas in libpam-sys
Paul Fisher <paul@pfish.zone>
parents: 153
diff changeset
399 _data: *mut c_void,
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
400 ) -> c_int;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
401
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
402 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
403
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
404 /// A null conversation function.
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
405 ///
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
406 /// ```no_run
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
407 /// # use std::ffi::CString;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
408 /// # use std::ptr;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
409 /// use libpam_sys::*;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
410 /// # let service = CString::new("whatever").unwrap();
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
411 /// # let user = CString::new("whatever").unwrap();
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
412 /// let mut handle: *mut pam_handle = ptr::null_mut();
174
9e4ce1631bd3 Dramatically expand documentation.
Paul Fisher <paul@pfish.zone>
parents: 163
diff changeset
413 /// let mut conv = pam_conv {
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
414 /// conv: openpam_nullconv,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
415 /// appdata_ptr: ptr::null_mut(),
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
416 /// };
174
9e4ce1631bd3 Dramatically expand documentation.
Paul Fisher <paul@pfish.zone>
parents: 163
diff changeset
417 /// let result = unsafe { pam_start(service.as_ptr(), user.as_ptr(), &mut conv, &mut handle) };
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
418 /// ```
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
419 pub fn openpam_nullconv(
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
420 n: c_int,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
421 _msg: *const *const pam_message,
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
422 _resp: *mut *mut pam_response,
154
f71bfffb6de1 fix remaining AppDatas in libpam-sys
Paul Fisher <paul@pfish.zone>
parents: 153
diff changeset
423 _data: *mut c_void,
133
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
424 ) -> c_int;
32b2a545ca3e Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents: 131
diff changeset
425 }
137
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
426
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
427 #[cfg(pam_impl = "Sun")]
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
428 extern "C" {
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
429 pub fn __pam_get_authtok(
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
430 pamh: *mut pam_handle,
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
431 source: c_int,
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
432 type_: c_int,
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
433 prompt: *const c_char,
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
434 authtok: *mut *mut c_char,
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
435 ) -> c_int;
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
436
88627c057709 Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents: 136
diff changeset
437 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
438 }