comparison src/constants.rs @ 87:05291b601f0a

Well and truly separate the Linux extensions. This separates the Linux extensions on the libpam side, and disables the two enums on the interface side. Users can still call the Linux extensions from non-Linux PAM impls, but they'll get a conversation error back.
author Paul Fisher <paul@pfish.zone>
date Tue, 10 Jun 2025 04:40:01 -0400
parents 23162cd399aa
children
comparison
equal deleted inserted replaced
86:23162cd399aa 87:05291b601f0a
1 //! Constants and enum values from the PAM library. 1 //! Constants and enum values from the PAM library.
2
3 // We have a lot of dumb casts that we just gotta do because of differences
4 // between Linux-PAM and OpenPAM header files.
5 #![allow(clippy::unnecessary_cast)]
2 6
3 #[cfg(feature = "link")] 7 #[cfg(feature = "link")]
4 use crate::libpam::pam_ffi; 8 use crate::libpam::pam_ffi;
5 use bitflags::bitflags; 9 use bitflags::bitflags;
6 use libc::c_int; 10 use libc::c_int;
196 AuthTokExpired = pam_ffi::PAM_AUTHTOK_EXPIRED, 200 AuthTokExpired = pam_ffi::PAM_AUTHTOK_EXPIRED,
197 #[error("module is not known")] 201 #[error("module is not known")]
198 ModuleUnknown = pam_ffi::PAM_MODULE_UNKNOWN, 202 ModuleUnknown = pam_ffi::PAM_MODULE_UNKNOWN,
199 #[error("bad item passed to pam_[whatever]_item")] 203 #[error("bad item passed to pam_[whatever]_item")]
200 BadItem = pam_ffi::PAM_BAD_ITEM, 204 BadItem = pam_ffi::PAM_BAD_ITEM,
205 #[cfg(feature = "linux-pam-extensions")]
201 #[error("conversation function is event-driven and data is not available yet")] 206 #[error("conversation function is event-driven and data is not available yet")]
202 ConversationAgain = pam_ffi::PAM_CONV_AGAIN, 207 ConversationAgain = pam_ffi::PAM_CONV_AGAIN,
208 #[cfg(feature = "linux-pam-extensions")]
203 #[error("call this function again to complete authentication stack")] 209 #[error("call this function again to complete authentication stack")]
204 Incomplete = pam_ffi::PAM_INCOMPLETE, 210 Incomplete = pam_ffi::PAM_INCOMPLETE,
205 } 211 }
206 212
207 /// A PAM-specific Result type with an [ErrorCode] error. 213 /// A PAM-specific Result type with an [ErrorCode] error.