comparison pam/src/constants.rs @ 15:27730595f1ea

Adding pam-http module
author Anthony Nowell <anthony@algorithmia.com>
date Sun, 24 Sep 2017 00:22:29 -0600
parents
children ec70822cbdef
comparison
equal deleted inserted replaced
14:51b097c12d3c 15:27730595f1ea
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 pub type AlwaysZero = c_int;
9
10 // The Linux-PAM flags
11 // see /usr/include/security/_pam_types.h
12 pub const PAM_SILENT: PamFlag = 0x8000;
13 pub const PAM_DISALLOW_NULL_AUTHTOK: PamFlag = 0x0001;
14 pub const PAM_ESTABLISH_CRED: PamFlag = 0x0002;
15 pub const PAM_DELETE_CRED: PamFlag = 0x0004;
16 pub const PAM_REINITIALIZE_CRED: PamFlag = 0x0008;
17 pub const PAM_REFRESH_CRED: PamFlag = 0x0010;
18 pub const PAM_CHANGE_EXPIRED_AUTHTOK: PamFlag = 0x0020;
19
20 // The Linux-PAM item types
21 // see /usr/include/security/_pam_types.h
22 /// The service name
23 pub const PAM_SERVICE: PamItemType = 1;
24 /// The user name
25 pub const PAM_USER: PamItemType = 2;
26 /// The tty name
27 pub const PAM_TTY: PamItemType = 3;
28 /// The remote host name
29 pub const PAM_RHOST: PamItemType = 4;
30 /// The pam_conv structure
31 pub const PAM_CONV: PamItemType = 5;
32 /// The authentication token (password)
33 pub const PAM_AUTHTOK: PamItemType = 6;
34 /// The old authentication token
35 pub const PAM_OLDAUTHTOK: PamItemType = 7;
36 /// The remote user name
37 pub const PAM_RUSER: PamItemType = 8;
38 /// the prompt for getting a username
39 pub const PAM_USER_PROMPT: PamItemType = 9;
40 /* Linux-PAM :extensionsPamItemType = */
41 /// app supplied function to override failure delays
42 pub const PAM_FAIL_DELAY: PamItemType = 10;
43 /// X :display name
44 pub const PAM_XDISPLAY: PamItemType = 11;
45 /// X :server authentication data
46 pub const PAM_XAUTHDATA: PamItemType = 12;
47 /// The type for pam_get_authtok
48 pub const PAM_AUTHTOK_TYPE: PamItemType = 13;
49
50 // Message styles
51 pub const PAM_PROMPT_ECHO_OFF: PamMessageStyle = 1;
52 pub const PAM_PROMPT_ECHO_ON: PamMessageStyle = 2;
53 pub const PAM_ERROR_MSG: PamMessageStyle = 3;
54 pub const PAM_TEXT_INFO: PamMessageStyle = 4;
55 /// yes/no/maybe conditionals
56 pub const PAM_RADIO_TYPE: PamMessageStyle = 5;
57 pub const PAM_BINARY_PROMPT: PamMessageStyle = 7;
58
59 // The Linux-PAM return values
60 // see /usr/include/security/_pam_types.h
61 #[allow(non_camel_case_types, dead_code)]
62 #[derive(Debug, PartialEq)]
63 #[repr(C)]
64 pub enum PamResultCode {
65 PAM_SUCCESS = 0,
66 PAM_OPEN_ERR = 1,
67 PAM_SYMBOL_ERR = 2,
68 PAM_SERVICE_ERR = 3,
69 PAM_SYSTEM_ERR = 4,
70 PAM_BUF_ERR = 5,
71 PAM_PERM_DENIED = 6,
72 PAM_AUTH_ERR = 7,
73 PAM_CRED_INSUFFICIENT = 8,
74 PAM_AUTHINFO_UNAVAIL = 9,
75 PAM_USER_UNKNOWN = 10,
76 PAM_MAXTRIES = 11,
77 PAM_NEW_AUTHTOK_REQD = 12,
78 PAM_ACCT_EXPIRED = 13,
79 PAM_SESSION_ERR = 14,
80 PAM_CRED_UNAVAIL = 15,
81 PAM_CRED_EXPIRED = 16,
82 PAM_CRED_ERR = 17,
83 PAM_NO_MODULE_DATA = 18,
84 PAM_CONV_ERR = 19,
85 PAM_AUTHTOK_ERR = 20,
86 PAM_AUTHTOK_RECOVERY_ERR = 21,
87 PAM_AUTHTOK_LOCK_BUSY = 22,
88 PAM_AUTHTOK_DISABLE_AGING = 23,
89 PAM_TRY_AGAIN = 24,
90 PAM_IGNORE = 25,
91 PAM_ABORT = 26,
92 PAM_AUTHTOK_EXPIRED = 27,
93 PAM_MODULE_UNKNOWN = 28,
94 PAM_BAD_ITEM = 29,
95 PAM_CONV_AGAIN = 30,
96 PAM_INCOMPLETE = 31,
97 }