Mercurial > crates > nonstick
comparison src/constants.rs @ 55:676675c3d434
Make PamResultCode implement Error.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Sun, 04 May 2025 00:58:04 -0400 |
| parents | ce47901aab7a |
| children | daa2cde64601 |
comparison
equal
deleted
inserted
replaced
| 54:0f1dcf5607e0 | 55:676675c3d434 |
|---|---|
| 23 pub const PAM_TEXT_INFO: PamMessageStyle = 4; | 23 pub const PAM_TEXT_INFO: PamMessageStyle = 4; |
| 24 /// yes/no/maybe conditionals | 24 /// yes/no/maybe conditionals |
| 25 pub const PAM_RADIO_TYPE: PamMessageStyle = 5; | 25 pub const PAM_RADIO_TYPE: PamMessageStyle = 5; |
| 26 pub const PAM_BINARY_PROMPT: PamMessageStyle = 7; | 26 pub const PAM_BINARY_PROMPT: PamMessageStyle = 7; |
| 27 | 27 |
| 28 // The Linux-PAM return values | 28 /// The Linux-PAM return values. |
| 29 // see /usr/include/security/_pam_types.h | 29 /// For more detailed information, see |
| 30 /// /usr/include/security/_pam_types.h | |
| 30 #[allow(non_camel_case_types, dead_code)] | 31 #[allow(non_camel_case_types, dead_code)] |
| 31 #[derive(Debug, PartialEq)] | 32 #[derive(Debug, PartialEq, thiserror::Error)] |
| 32 #[repr(C)] | 33 #[repr(C)] |
| 33 pub enum PamResultCode { | 34 pub enum PamResultCode { |
| 35 #[error("Not an error")] | |
| 34 PAM_SUCCESS = 0, | 36 PAM_SUCCESS = 0, |
| 37 #[error("dlopen() failure when dynamically loading a service module")] | |
| 35 PAM_OPEN_ERR = 1, | 38 PAM_OPEN_ERR = 1, |
| 39 #[error("symbol not found")] | |
| 36 PAM_SYMBOL_ERR = 2, | 40 PAM_SYMBOL_ERR = 2, |
| 41 #[error("error in service module")] | |
| 37 PAM_SERVICE_ERR = 3, | 42 PAM_SERVICE_ERR = 3, |
| 43 #[error("system error")] | |
| 38 PAM_SYSTEM_ERR = 4, | 44 PAM_SYSTEM_ERR = 4, |
| 45 #[error("memory buffer error")] | |
| 39 PAM_BUF_ERR = 5, | 46 PAM_BUF_ERR = 5, |
| 47 #[error("permission denied")] | |
| 40 PAM_PERM_DENIED = 6, | 48 PAM_PERM_DENIED = 6, |
| 49 #[error("authentication failure")] | |
| 41 PAM_AUTH_ERR = 7, | 50 PAM_AUTH_ERR = 7, |
| 51 #[error("cannot access authentication data due to insufficient credentials")] | |
| 42 PAM_CRED_INSUFFICIENT = 8, | 52 PAM_CRED_INSUFFICIENT = 8, |
| 53 #[error("underlying authentication service cannot retrieve authentication information")] | |
| 43 PAM_AUTHINFO_UNAVAIL = 9, | 54 PAM_AUTHINFO_UNAVAIL = 9, |
| 55 #[error("user not known to the underlying authentication module")] | |
| 44 PAM_USER_UNKNOWN = 10, | 56 PAM_USER_UNKNOWN = 10, |
| 57 #[error("retry limit reached; do not attempt further")] | |
| 45 PAM_MAXTRIES = 11, | 58 PAM_MAXTRIES = 11, |
| 59 #[error("new authentication token required")] | |
| 46 PAM_NEW_AUTHTOK_REQD = 12, | 60 PAM_NEW_AUTHTOK_REQD = 12, |
| 61 #[error("user account has expired")] | |
| 47 PAM_ACCT_EXPIRED = 13, | 62 PAM_ACCT_EXPIRED = 13, |
| 63 #[error("cannot make/remove an entry for the specified session")] | |
| 48 PAM_SESSION_ERR = 14, | 64 PAM_SESSION_ERR = 14, |
| 65 #[error("underlying authentication service cannot retrieve user credentials")] | |
| 49 PAM_CRED_UNAVAIL = 15, | 66 PAM_CRED_UNAVAIL = 15, |
| 67 #[error("user credentials expired")] | |
| 50 PAM_CRED_EXPIRED = 16, | 68 PAM_CRED_EXPIRED = 16, |
| 69 #[error("failure setting user credentials")] | |
| 51 PAM_CRED_ERR = 17, | 70 PAM_CRED_ERR = 17, |
| 71 #[error("no module-specific data is present")] | |
| 52 PAM_NO_MODULE_DATA = 18, | 72 PAM_NO_MODULE_DATA = 18, |
| 73 #[error("conversation error")] | |
| 53 PAM_CONV_ERR = 19, | 74 PAM_CONV_ERR = 19, |
| 75 #[error("authentication token manipulation error")] | |
| 54 PAM_AUTHTOK_ERR = 20, | 76 PAM_AUTHTOK_ERR = 20, |
| 77 #[error("authentication information cannot be recovered")] | |
| 55 PAM_AUTHTOK_RECOVERY_ERR = 21, | 78 PAM_AUTHTOK_RECOVERY_ERR = 21, |
| 79 #[error("authentication token lock busy")] | |
| 56 PAM_AUTHTOK_LOCK_BUSY = 22, | 80 PAM_AUTHTOK_LOCK_BUSY = 22, |
| 81 #[error("authentication token aging disabled")] | |
| 57 PAM_AUTHTOK_DISABLE_AGING = 23, | 82 PAM_AUTHTOK_DISABLE_AGING = 23, |
| 83 #[error("preliminary check by password service")] | |
| 58 PAM_TRY_AGAIN = 24, | 84 PAM_TRY_AGAIN = 24, |
| 85 #[error("ignore underlying account module, regardless of control flag")] | |
| 59 PAM_IGNORE = 25, | 86 PAM_IGNORE = 25, |
| 87 #[error("critical error; this module should fail now")] | |
| 60 PAM_ABORT = 26, | 88 PAM_ABORT = 26, |
| 89 #[error("authentication token has expired")] | |
| 61 PAM_AUTHTOK_EXPIRED = 27, | 90 PAM_AUTHTOK_EXPIRED = 27, |
| 91 #[error("module is not known")] | |
| 62 PAM_MODULE_UNKNOWN = 28, | 92 PAM_MODULE_UNKNOWN = 28, |
| 93 #[error("bad item passed to pam_[whatever]_item")] | |
| 63 PAM_BAD_ITEM = 29, | 94 PAM_BAD_ITEM = 29, |
| 95 #[error("conversation function is event-driven and data is not available yet")] | |
| 64 PAM_CONV_AGAIN = 30, | 96 PAM_CONV_AGAIN = 30, |
| 97 #[error("call this function again to complete authentication stack")] | |
| 65 PAM_INCOMPLETE = 31, | 98 PAM_INCOMPLETE = 31, |
| 66 } | 99 } |
