Mercurial > crates > nonstick
annotate libpam-sys/libpam-sys-helpers/src/constants.rs @ 141:a508a69c068a
Remove a lot of Results from functions.
Many functions are documented to only return failing Results when given
improper inputs or when there is a memory allocation failure (which
can be verified by looking at the source). In cases where we know our
input is correct, we don't need to check for memory allocation errors
for the same reason that Rust doesn't do so when you, e.g., create a
new Vec.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 05 Jul 2025 17:16:56 -0400 |
parents | 999bf07efbcb |
children |
rev | line source |
---|---|
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
1 //! All of `libpam`'s constants. |
110
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
2 //! |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
3 //! These constants are tested on a per-platform basis by `libpam-sys-test`'s |
2346fd501b7a
Add tests for constants and do other macro niceties.
Paul Fisher <paul@pfish.zone>
parents:
109
diff
changeset
|
4 //! `test_constants.rs`. |
108
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
5 |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
6 #![allow(non_camel_case_types)] |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
7 |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
8 /// Macro to make defining a bunch of constants way easier. |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
9 macro_rules! define { |
108
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
10 ($(#[$attr:meta])* $($name:ident = $value:expr);+$(;)?) => { |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
11 define!( |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
12 @meta { $(#[$attr])* } |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
13 $(pub const $name: i32 = $value;)+ |
108
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
14 ); |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
15 }; |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
16 (@meta $m:tt $($i:item)+) => { define!(@expand $($m $i)+); }; |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
17 (@expand $({ $(#[$m:meta])* } $i:item)+) => {$($(#[$m])* $i)+}; |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
18 } |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
19 |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
20 /// Macro to make defining C-style enums way easier. |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
21 macro_rules! c_enum { |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
22 ($(#[$attr:meta])* $($name:ident $(= $value:expr)?,)*) => { |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
23 c_enum!( |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
24 (0) |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
25 $(#[$attr])* |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
26 $($name $(= $value)?,)* |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
27 ); |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
28 }; |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
29 (($n:expr) $(#[$attr:meta])* $name:ident, $($rest:ident $(= $rv:expr)?,)*) => { |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
30 $(#[$attr])* pub const $name: i32 = $n; |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
31 c_enum!(($n + 1) $(#[$attr])* $($rest $(= $rv)?,)*); |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
32 }; |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
33 (($n:expr) $(#[$attr:meta])* $name:ident = $value:expr, $($rest:ident $(= $rv:expr)?,)*) => { |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
34 $(#[$attr])* pub const $name: i32 = $value; |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
35 c_enum!(($value + 1) $(#[$attr])* $($rest $(= $rv)?,)*); |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
36 }; |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
37 (($n:expr) $(#[$attr:meta])*) => {}; |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
38 } |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
39 |
109 | 40 // There are a few truly universal constants. |
41 // They are defined here directly. | |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
42 /// The successful return code. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
43 pub const PAM_SUCCESS: i32 = 0; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
44 |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
45 c_enum!( |
109 | 46 /// An item type. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
47 PAM_SERVICE = 1, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
48 PAM_USER, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
49 PAM_TTY, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
50 PAM_RHOST, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
51 PAM_CONV, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
52 PAM_AUTHTOK, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
53 PAM_OLDAUTHTOK, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
54 PAM_RUSER, |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
55 PAM_USER_PROMPT, |
109 | 56 ); |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
57 |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
58 c_enum!( |
109 | 59 /// A message style. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
60 PAM_PROMPT_ECHO_OFF = 1, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
61 PAM_PROMPT_ECHO_ON, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
62 PAM_ERROR_MSG, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
63 PAM_TEXT_INFO, |
109 | 64 ); |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
65 |
109 | 66 define!( |
67 /// Maximum size of PAM conversation elements (suggested). | |
68 PAM_MAX_NUM_MSG = 32; | |
69 PAM_MAX_MSG_SIZE = 512; | |
70 PAM_MAX_RESP_SIZE = 512; | |
71 ); | |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
72 |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
73 #[cfg(pam_impl = "LinuxPam")] |
109 | 74 pub use linux_pam::*; |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
75 #[cfg(pam_impl = "LinuxPam")] |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
76 mod linux_pam { |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
77 c_enum!( |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
78 /// An error return code. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
79 PAM_OPEN_ERR = 1, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
80 PAM_SYMBOL_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
81 PAM_SERVICE_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
82 PAM_SYSTEM_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
83 PAM_BUF_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
84 PAM_PERM_DENIED, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
85 PAM_AUTH_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
86 PAM_CRED_INSUFFICIENT, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
87 PAM_AUTHINFO_UNAVAIL, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
88 PAM_USER_UNKNOWN, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
89 PAM_MAXTRIES, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
90 PAM_NEW_AUTHTOK_REQD, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
91 PAM_ACCT_EXPIRED, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
92 PAM_SESSION_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
93 PAM_CRED_UNAVAIL, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
94 PAM_CRED_EXPIRED, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
95 PAM_CRED_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
96 PAM_NO_MODULE_DATA, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
97 PAM_CONV_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
98 PAM_AUTHTOK_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
99 PAM_AUTHTOK_RECOVERY_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
100 PAM_AUTHTOK_LOCK_BUSY, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
101 PAM_AUTHTOK_DISABLE_AGING, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
102 PAM_TRY_AGAIN, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
103 PAM_IGNORE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
104 PAM_ABORT, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
105 PAM_AUTHTOK_EXPIRED, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
106 PAM_MODULE_UNKNOWN, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
107 PAM_BAD_ITEM, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
108 PAM_CONV_AGAIN, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
109 PAM_INCOMPLETE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
110 _PAM_RETURN_VALUES, |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
111 ); |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
112 |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
113 define!( |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
114 /// A flag value. |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
115 PAM_SILENT = 0x8000; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
116 PAM_DISALLOW_NULL_AUTHTOK = 0x0001; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
117 PAM_ESTABLISH_CRED = 0x0002; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
118 PAM_DELETE_CRED = 0x0004; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
119 PAM_REINITIALIZE_CRED = 0x0008; |
108
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
120 PAM_REFRESH_CRED = 0x0010; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
121 |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
122 PAM_CHANGE_EXPIRED_AUTHTOK = 0x0020; |
108
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
123 |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
124 PAM_PRELIM_CHECK = 0x4000; |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
125 PAM_UPDATE_AUTHTOK = 0x2000; |
e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
Paul Fisher <paul@pfish.zone>
parents:
106
diff
changeset
|
126 PAM_DATA_REPLACE = 0x20000000; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
127 ); |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
128 |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
129 c_enum!( |
127 | 130 /// An item type (Linux-only). |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
131 PAM_FAIL_DELAY = 10, |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
132 PAM_XDISPLAY, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
133 PAM_XAUTHDATA, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
134 PAM_AUTHTOK_TYPE, |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
135 ); |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
136 |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
137 /// To suppress messages in the item cleanup function. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
138 pub const PAM_DATA_SILENT: i32 = 0x40000000; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
139 |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
140 // Message styles |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
141 define!( |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
142 /// A message style. |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
143 PAM_RADIO_TYPE = 5; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
144 PAM_BINARY_PROMPT = 7; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
145 ); |
131
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
127
diff
changeset
|
146 |
a632a8874131
Get all the Linux-PAM functions into libpam-sys, and get tests right.
Paul Fisher <paul@pfish.zone>
parents:
127
diff
changeset
|
147 pub const PAM_MODUTIL_NGROUPS: i32 = 64; |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
148 |
138
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
149 #[derive(Copy, Clone, Debug, PartialEq, Eq)] |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
150 #[repr(i32)] |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
151 pub enum pam_modutil_redirect_fd { |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
152 PAM_MODUTIL_IGNORE_FD, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
153 PAM_MODUTIL_PIPE_FD, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
154 PAM_MODUTIL_NULL_FD, |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
155 } |
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
156 |
138
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
157 impl From<pam_modutil_redirect_fd> for i32 { |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
158 fn from(value: pam_modutil_redirect_fd) -> Self { |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
159 value as Self |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
160 } |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
161 } |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
162 |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
163 impl TryFrom<i32> for pam_modutil_redirect_fd { |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
164 type Error = i32; |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
165 fn try_from(value: i32) -> Result<Self, Self::Error> { |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
166 match value { |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
167 0..=2 => Ok(unsafe { *(&value as *const i32).cast() }), |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
168 other => Err(other), |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
169 } |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
170 } |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
171 } |
999bf07efbcb
Get rid of num_enum dependency in `libpam-sys-helpers`.
Paul Fisher <paul@pfish.zone>
parents:
137
diff
changeset
|
172 |
136
efbc235f01d3
Separate libpam-sys-helpers from libpam-sys.
Paul Fisher <paul@pfish.zone>
parents:
134
diff
changeset
|
173 pub use pam_modutil_redirect_fd::*; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
174 } |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
175 |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
176 #[cfg(any(pam_impl = "OpenPam", pam_impl = "Sun", pam_impl = "XSso"))] |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
177 pub use xsso_shared::*; |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
178 #[cfg(any(pam_impl = "OpenPam", pam_impl = "Sun", pam_impl = "XSso"))] |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
179 mod xsso_shared { |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
180 c_enum!( |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
181 /// An error return code. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
182 PAM_OPEN_ERR = 1, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
183 PAM_SYMBOL_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
184 PAM_SERVICE_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
185 PAM_SYSTEM_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
186 PAM_BUF_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
187 PAM_CONV_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
188 PAM_PERM_DENIED, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
189 PAM_MAXTRIES, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
190 PAM_AUTH_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
191 PAM_NEW_AUTHTOK_REQD, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
192 PAM_CRED_INSUFFICIENT, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
193 PAM_AUTHINFO_UNAVAIL, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
194 PAM_USER_UNKNOWN, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
195 PAM_CRED_UNAVAIL, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
196 PAM_CRED_EXPIRED, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
197 PAM_CRED_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
198 PAM_ACCT_EXPIRED, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
199 PAM_AUTHTOK_EXPIRED, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
200 PAM_SESSION_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
201 PAM_AUTHTOK_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
202 PAM_AUTHTOK_RECOVERY_ERR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
203 PAM_AUTHTOK_LOCK_BUSY, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
204 PAM_AUTHTOK_DISABLE_AGING, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
205 PAM_NO_MODULE_DATA, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
206 PAM_IGNORE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
207 PAM_ABORT, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
208 PAM_TRY_AGAIN, |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
209 ); |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
210 // While `PAM_MODULE_UNKNOWN` and `PAM_DOMAIN_UNKNOWN` are in X/SSO, |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
211 // Sun doesn't use them so we're omitting them here. |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
212 |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
213 /// A general flag for PAM operations. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
214 pub const PAM_SILENT: i32 = 0x80000000u32 as i32; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
215 |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
216 /// A flag for `pam_authenticate`. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
217 pub const PAM_DISALLOW_NULL_AUTHTOK: i32 = 0b1; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
218 |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
219 define!( |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
220 /// A flag for `pam_setcred`. |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
221 PAM_ESTABLISH_CRED = 0b0001; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
222 PAM_DELETE_CRED = 0b0010; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
223 PAM_REINITIALIZE_CRED = 0b0100; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
224 PAM_REFRESH_CRED = 0b1000; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
225 ); |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
226 |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
227 define!( |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
228 /// A flag for `pam_sm_chauthtok`. |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
229 PAM_PRELIM_CHECK = 0b0001; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
230 PAM_UPDATE_AUTHTOK = 0b0010; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
231 PAM_CHANGE_EXPIRED_AUTHTOK = 0b0100; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
232 ); |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
233 } |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
234 |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
235 #[cfg(pam_impl = "OpenPam")] |
109 | 236 pub use openpam::*; |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
237 #[cfg(pam_impl = "OpenPam")] |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
238 mod openpam { |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
239 c_enum!( |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
240 /// An error return code. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
241 PAM_MODULE_UNKNOWN = 28, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
242 PAM_DOMAIN_UNKNOWN, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
243 PAM_BAD_HANDLE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
244 PAM_BAD_ITEM, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
245 PAM_BAD_FEATURE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
246 PAM_BAD_CONSTANT, |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
247 ); |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
248 /// The total number of PAM error codes (including success). |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
249 pub const PAM_NUM_ERRORS: i32 = 34; |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
250 |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
251 c_enum!( |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
252 /// An item type. |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
253 PAM_REPOSITORY = 10, |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
254 PAM_AUTHTOK_PROMPT, |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
255 PAM_OLDAUTHTOK_PROMPT, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
256 PAM_HOST, |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
257 ); |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
258 /// The total number of PAM items. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
259 pub const PAM_NUM_ITEMS: i32 = 14; |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
260 |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
261 c_enum!( |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
262 /// An optional OpenPAM feature. |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
263 OPENPAM_RESTRICT_SERVICE_NAME, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
264 OPENPAM_VERIFY_POLICY_FILE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
265 OPENPAM_RESTRICT_MODULE_NAME, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
266 OPENPAM_VERIFY_MODULE_FILE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
267 OPENPAM_FALLBACK_TO_OTHER, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
268 ); |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
269 /// The number of optional OpenPAM features. |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
270 pub const OPENPAM_NUM_FEATURES: i32 = 5; |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
271 |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
272 c_enum!( |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
273 /// Log level. |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
274 PAM_LOG_LIBDEBUG = -1, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
275 PAM_LOG_DEBUG, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
276 PAM_LOG_VERBOSE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
277 PAM_LOG_NOTICE, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
278 PAM_LOG_ERROR, |
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
279 ); |
133
32b2a545ca3e
Add functions and constants from openpam.h.
Paul Fisher <paul@pfish.zone>
parents:
132
diff
changeset
|
280 |
132
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
281 c_enum!( |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
282 /// PAM primitives. |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
283 PAM_SM_AUTHENTICATE, |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
284 PAM_SM_SETCRED, |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
285 PAM_SM_ACCT_MGMT, |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
286 PAM_SM_OPEN_SESSION, |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
287 PAM_SM_CLOSE_SESSION, |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
288 PAM_SM_CHAUTHTOK, |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
289 ); |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
290 /// The number of PAM primitives. |
0b6a17f8c894
Get constant test working again with OpenPAM.
Paul Fisher <paul@pfish.zone>
parents:
131
diff
changeset
|
291 pub const PAM_NUM_PRIMITIVES: i32 = 6; |
106
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
292 } |
49d9e2b5c189
An irresponsible mix of implementing libpam-sys and other stuff.
Paul Fisher <paul@pfish.zone>
parents:
diff
changeset
|
293 |
112
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
294 /// Constants exclusive to Illumos. |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
295 #[cfg(pam_impl = "Sun")] |
112
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
296 pub use sun::*; |
134
6c1e1bdb4164
Use standard #[cfg] directives rather than custom proc macros.
Paul Fisher <paul@pfish.zone>
parents:
133
diff
changeset
|
297 #[cfg(pam_impl = "Sun")] |
112
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
298 mod sun { |
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
299 /// The total number of PAM error codes. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
300 pub const PAM_TOTAL_ERRNUM: i32 = 28; |
112
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
301 |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
302 c_enum!( |
112
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
303 /// An item type. |
118
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
304 PAM_REPOSITORY = 10, |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
305 PAM_RESOURCE, |
39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Paul Fisher <paul@pfish.zone>
parents:
113
diff
changeset
|
306 PAM_AUSER, |
112
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
307 ); |
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
308 |
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
309 /// A flag for `pam_chauthtok`. |
113
178310336596
Fix up more constants, make things i32 rather than u32.
Paul Fisher <paul@pfish.zone>
parents:
112
diff
changeset
|
310 pub const PAM_NO_AUTHTOK_CHECK: i32 = 0b1000; |
137
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
311 |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
312 define!( |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
313 /// A flag for `__pam_get_authtok`. |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
314 PAM_PROMPT = 1; |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
315 PAM_HANDLE = 2; |
88627c057709
Add Sun PAM functions from Illumos headers.
Paul Fisher <paul@pfish.zone>
parents:
136
diff
changeset
|
316 ); |
112
82995b4dccee
Finish renaming "illumos" to "sun".
Paul Fisher <paul@pfish.zone>
parents:
110
diff
changeset
|
317 } |