comparison src/constants.rs @ 85:5e14bb093851

fix more openpam compat stuff
author Paul Fisher <paul@pfish.zone>
date Tue, 10 Jun 2025 02:42:29 -0400
parents a638a45e5f1f
children 23162cd399aa
comparison
equal deleted inserted replaced
84:a638a45e5f1f 85:5e14bb093851
12 /// 12 ///
13 /// **The values of these constants are deliberately selected _not_ to match 13 /// **The values of these constants are deliberately selected _not_ to match
14 /// any PAM implementations. Applications should always use the symbolic value 14 /// any PAM implementations. Applications should always use the symbolic value
15 /// and not a magic number.** 15 /// and not a magic number.**
16 #[cfg(not(feature = "link"))] 16 #[cfg(not(feature = "link"))]
17 mod ffi { 17 mod pam_ffi {
18 macro_rules! define { 18 macro_rules! define {
19 ($(#[$attr:meta])* $($name:ident = $value:expr),+) => { 19 ($(#[$attr:meta])* $($name:ident = $value:expr),+) => {
20 define!( 20 define!(
21 @meta { $(#[$attr])* } 21 @meta { $(#[$attr])* }
22 $(pub const $name: u32 = $value;)+ 22 $(pub const $name: u32 = $value;)+
82 /// See `/usr/include/security/pam_modules.h` for more details. 82 /// See `/usr/include/security/pam_modules.h` for more details.
83 #[derive(Debug, PartialEq)] 83 #[derive(Debug, PartialEq)]
84 #[repr(transparent)] 84 #[repr(transparent)]
85 pub struct Flags: c_uint { 85 pub struct Flags: c_uint {
86 /// The module should not generate any messages. 86 /// The module should not generate any messages.
87 const SILENT = pam_ffi::PAM_SILENT; 87 const SILENT = pam_ffi::PAM_SILENT as u32;
88 88
89 /// The module should return [ErrorCode::AuthError] 89 /// The module should return [ErrorCode::AuthError]
90 /// if the user has an empty authentication token 90 /// if the user has an empty authentication token
91 /// rather than immediately accepting them. 91 /// rather than immediately accepting them.
92 const DISALLOW_NULL_AUTHTOK = pam_ffi::PAM_DISALLOW_NULL_AUTHTOK; 92 const DISALLOW_NULL_AUTHTOK = pam_ffi::PAM_DISALLOW_NULL_AUTHTOK as u32;
93 93
94 // Flag used for `set_credentials`. 94 // Flag used for `set_credentials`.
95 95
96 /// Set user credentials for an authentication service. 96 /// Set user credentials for an authentication service.
97 const ESTABLISH_CREDENTIALS = pam_ffi::PAM_ESTABLISH_CRED; 97 const ESTABLISH_CREDENTIALS = pam_ffi::PAM_ESTABLISH_CRED as u32;
98 /// Delete user credentials associated with 98 /// Delete user credentials associated with
99 /// an authentication service. 99 /// an authentication service.
100 const DELETE_CREDENTIALS = pam_ffi::PAM_DELETE_CRED; 100 const DELETE_CREDENTIALS = pam_ffi::PAM_DELETE_CRED as u32;
101 /// Reinitialize user credentials. 101 /// Reinitialize user credentials.
102 const REINITIALIZE_CREDENTIALS = pam_ffi::PAM_REINITIALIZE_CRED; 102 const REINITIALIZE_CREDENTIALS = pam_ffi::PAM_REINITIALIZE_CRED as u32;
103 /// Extend the lifetime of user credentials. 103 /// Extend the lifetime of user credentials.
104 const REFRESH_CREDENTIALS = pam_ffi::PAM_REFRESH_CRED; 104 const REFRESH_CREDENTIALS = pam_ffi::PAM_REFRESH_CRED as u32;
105 105
106 // Flags used for password changing. 106 // Flags used for password changing.
107 107
108 /// The password service should only update those passwords 108 /// The password service should only update those passwords
109 /// that have aged. If this flag is _not_ passed, 109 /// that have aged. If this flag is _not_ passed,