comparison src/constants.rs @ 45:ce47901aab7a

Rename to “nonstick”, move to root, update docs and license. - Renames the crate to “nonstick”. - Moves the main library to the root of the repository. - Removes the example PAM modules. - Updates copyright information in LICENSE file. - Updates the README.
author Paul Fisher <paul@pfish.zone>
date Tue, 15 Apr 2025 00:50:23 -0400
parents pam/src/constants.rs@ec70822cbdef
children
comparison
equal deleted inserted replaced
44:50371046c61a 45:ce47901aab7a
1 use libc::{c_int, c_uint};
2
3 // TODO: Import constants from C header file at compile time.
4
5 pub type PamFlag = c_uint;
6 pub type PamItemType = c_int;
7 pub type PamMessageStyle = c_int;
8
9 // The Linux-PAM flags
10 // see /usr/include/security/_pam_types.h
11 pub const PAM_SILENT: PamFlag = 0x8000;
12 pub const PAM_DISALLOW_NULL_AUTHTOK: PamFlag = 0x0001;
13 pub const PAM_ESTABLISH_CRED: PamFlag = 0x0002;
14 pub const PAM_DELETE_CRED: PamFlag = 0x0004;
15 pub const PAM_REINITIALIZE_CRED: PamFlag = 0x0008;
16 pub const PAM_REFRESH_CRED: PamFlag = 0x0010;
17 pub const PAM_CHANGE_EXPIRED_AUTHTOK: PamFlag = 0x0020;
18
19 // Message styles
20 pub const PAM_PROMPT_ECHO_OFF: PamMessageStyle = 1;
21 pub const PAM_PROMPT_ECHO_ON: PamMessageStyle = 2;
22 pub const PAM_ERROR_MSG: PamMessageStyle = 3;
23 pub const PAM_TEXT_INFO: PamMessageStyle = 4;
24 /// yes/no/maybe conditionals
25 pub const PAM_RADIO_TYPE: PamMessageStyle = 5;
26 pub const PAM_BINARY_PROMPT: PamMessageStyle = 7;
27
28 // The Linux-PAM return values
29 // see /usr/include/security/_pam_types.h
30 #[allow(non_camel_case_types, dead_code)]
31 #[derive(Debug, PartialEq)]
32 #[repr(C)]
33 pub enum PamResultCode {
34 PAM_SUCCESS = 0,
35 PAM_OPEN_ERR = 1,
36 PAM_SYMBOL_ERR = 2,
37 PAM_SERVICE_ERR = 3,
38 PAM_SYSTEM_ERR = 4,
39 PAM_BUF_ERR = 5,
40 PAM_PERM_DENIED = 6,
41 PAM_AUTH_ERR = 7,
42 PAM_CRED_INSUFFICIENT = 8,
43 PAM_AUTHINFO_UNAVAIL = 9,
44 PAM_USER_UNKNOWN = 10,
45 PAM_MAXTRIES = 11,
46 PAM_NEW_AUTHTOK_REQD = 12,
47 PAM_ACCT_EXPIRED = 13,
48 PAM_SESSION_ERR = 14,
49 PAM_CRED_UNAVAIL = 15,
50 PAM_CRED_EXPIRED = 16,
51 PAM_CRED_ERR = 17,
52 PAM_NO_MODULE_DATA = 18,
53 PAM_CONV_ERR = 19,
54 PAM_AUTHTOK_ERR = 20,
55 PAM_AUTHTOK_RECOVERY_ERR = 21,
56 PAM_AUTHTOK_LOCK_BUSY = 22,
57 PAM_AUTHTOK_DISABLE_AGING = 23,
58 PAM_TRY_AGAIN = 24,
59 PAM_IGNORE = 25,
60 PAM_ABORT = 26,
61 PAM_AUTHTOK_EXPIRED = 27,
62 PAM_MODULE_UNKNOWN = 28,
63 PAM_BAD_ITEM = 29,
64 PAM_CONV_AGAIN = 30,
65 PAM_INCOMPLETE = 31,
66 }