annotate src/constants.rs @ 14:51b097c12d3c

make PamResultCode an enum
author Anthony Nowell <anthony@algorithmia.com>
date Sat, 23 Sep 2017 14:30:18 -0600
parents 2abd89f31a13
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
1 use libc::{c_int, c_uint};
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
2
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
3 // TODO: Import constants from C header file at compile time.
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
4
8
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
5 pub type PamFlag = c_uint;
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
6 pub type PamItemType = c_int;
1
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
7 pub type PamMessageStyle = c_int;
8
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
8 pub type AlwaysZero = c_int;
1
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
9
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
10 // The Linux-PAM flags
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
11 // see /usr/include/security/_pam_types.h
8
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
12 pub const PAM_SILENT: PamFlag = 0x8000;
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
13 pub const PAM_DISALLOW_NULL_AUTHTOK: PamFlag = 0x0001;
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
14 pub const PAM_ESTABLISH_CRED: PamFlag = 0x0002;
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
15 pub const PAM_DELETE_CRED: PamFlag = 0x0004;
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
16 pub const PAM_REINITIALIZE_CRED: PamFlag = 0x0008;
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
17 pub const PAM_REFRESH_CRED: PamFlag = 0x0010;
1
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
18 pub const PAM_CHANGE_EXPIRED_AUTHTOK: PamFlag = 0x0020;
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
19
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
20 // The Linux-PAM item types
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
21 // see /usr/include/security/_pam_types.h
9
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
22 /// The service name
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
23 pub const PAM_SERVICE: PamItemType = 1;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
24 /// The user name
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
25 pub const PAM_USER: PamItemType = 2;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
26 /// The tty name
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
27 pub const PAM_TTY: PamItemType = 3;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
28 /// The remote host name
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
29 pub const PAM_RHOST: PamItemType = 4;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
30 /// The pam_conv structure
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
31 pub const PAM_CONV: PamItemType = 5;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
32 /// The authentication token (password)
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
33 pub const PAM_AUTHTOK: PamItemType = 6;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
34 /// The old authentication token
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
35 pub const PAM_OLDAUTHTOK: PamItemType = 7;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
36 /// The remote user name
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
37 pub const PAM_RUSER: PamItemType = 8;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
38 /// the prompt for getting a username
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
39 pub const PAM_USER_PROMPT: PamItemType = 9;
1
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
40 /* Linux-PAM :extensionsPamItemType = */
9
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
41 /// app supplied function to override failure delays
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
42 pub const PAM_FAIL_DELAY: PamItemType = 10;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
43 /// X :display name
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
44 pub const PAM_XDISPLAY: PamItemType = 11;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
45 /// X :server authentication data
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
46 pub const PAM_XAUTHDATA: PamItemType = 12;
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
47 /// The type for pam_get_authtok
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
48 pub const PAM_AUTHTOK_TYPE: PamItemType = 13;
1
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
49
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
50 // Message styles
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
51 pub const PAM_PROMPT_ECHO_OFF: PamMessageStyle = 1;
8
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
52 pub const PAM_PROMPT_ECHO_ON: PamMessageStyle = 2;
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
53 pub const PAM_ERROR_MSG: PamMessageStyle = 3;
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
54 pub const PAM_TEXT_INFO: PamMessageStyle = 4;
9
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
55 /// yes/no/maybe conditionals
2abd89f31a13 Make comments actually show up in rust doc in constants module.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 8
diff changeset
56 pub const PAM_RADIO_TYPE: PamMessageStyle = 5;
8
a83c56216e21 Ran everything through rustfmt.
Marc Brinkmann <git@marcbrinkmann.de>
parents: 1
diff changeset
57 pub const PAM_BINARY_PROMPT: PamMessageStyle = 7;
1
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
58
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
59 // The Linux-PAM return values
b195a14058bb initial commit
Jesse Hallett <jesse@galois.com>
parents:
diff changeset
60 // see /usr/include/security/_pam_types.h
14
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
61 #[allow(non_camel_case_types, dead_code)]
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
62 #[derive(Debug, PartialEq)]
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
63 #[repr(C)]
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
64 pub enum PamResultCode {
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
65 PAM_SUCCESS = 0,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
66 PAM_OPEN_ERR = 1,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
67 PAM_SYMBOL_ERR = 2,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
68 PAM_SERVICE_ERR = 3,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
69 PAM_SYSTEM_ERR = 4,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
70 PAM_BUF_ERR = 5,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
71 PAM_PERM_DENIED = 6,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
72 PAM_AUTH_ERR = 7,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
73 PAM_CRED_INSUFFICIENT = 8,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
74 PAM_AUTHINFO_UNAVAIL = 9,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
75 PAM_USER_UNKNOWN = 10,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
76 PAM_MAXTRIES = 11,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
77 PAM_NEW_AUTHTOK_REQD = 12,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
78 PAM_ACCT_EXPIRED = 13,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
79 PAM_SESSION_ERR = 14,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
80 PAM_CRED_UNAVAIL = 15,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
81 PAM_CRED_EXPIRED = 16,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
82 PAM_CRED_ERR = 17,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
83 PAM_NO_MODULE_DATA = 18,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
84 PAM_CONV_ERR = 19,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
85 PAM_AUTHTOK_ERR = 20,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
86 PAM_AUTHTOK_RECOVERY_ERR = 21,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
87 PAM_AUTHTOK_LOCK_BUSY = 22,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
88 PAM_AUTHTOK_DISABLE_AGING = 23,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
89 PAM_TRY_AGAIN = 24,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
90 PAM_IGNORE = 25,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
91 PAM_ABORT = 26,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
92 PAM_AUTHTOK_EXPIRED = 27,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
93 PAM_MODULE_UNKNOWN = 28,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
94 PAM_BAD_ITEM = 29,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
95 PAM_CONV_AGAIN = 30,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
96 PAM_INCOMPLETE = 31,
51b097c12d3c make PamResultCode an enum
Anthony Nowell <anthony@algorithmia.com>
parents: 9
diff changeset
97 }