Mercurial > crates > nonstick
diff src/libpam/handle.rs @ 180:a1bb1d013567
Remove `syn` from the dependency tree by implementing our own num_enum.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Wed, 30 Jul 2025 18:22:16 -0400 |
parents | 0730f5f2ee2a |
children | 4f46681b3f54 |
line wrap: on
line diff
--- a/src/libpam/handle.rs Wed Jul 30 18:07:51 2025 -0400 +++ b/src/libpam/handle.rs Wed Jul 30 18:22:16 2025 -0400 @@ -6,11 +6,10 @@ use crate::handle::PamShared; use crate::items::{Items, ItemsMut}; use crate::libpam::environ::{LibPamEnviron, LibPamEnvironMut}; -use crate::libpam::items::{LibPamItems, LibPamItemsMut}; +use crate::libpam::items::{ItemType, LibPamItems, LibPamItemsMut}; use crate::libpam::{items, memory}; use crate::logging::{Level, Location, Logger}; use crate::{AuthnFlags, AuthtokFlags, Conversation, EnvironMap, ModuleClient, Transaction}; -use num_enum::{IntoPrimitive, TryFromPrimitive}; use std::any::TypeId; use std::cell::Cell; use std::ffi::{c_char, c_int, c_void, CString, OsStr, OsString}; @@ -524,40 +523,3 @@ } } -/// Identifies what is being gotten or set with `pam_get_item` -/// or `pam_set_item`. -#[derive(Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] -#[repr(i32)] -#[non_exhaustive] // because C could give us anything! -pub enum ItemType { - /// The PAM service name. - Service = libpam_sys::PAM_SERVICE, - /// The user's login name. - User = libpam_sys::PAM_USER, - /// The TTY name. - Tty = libpam_sys::PAM_TTY, - /// The remote host (if applicable). - RemoteHost = libpam_sys::PAM_RHOST, - /// The conversation struct (not a CStr-based item). - Conversation = libpam_sys::PAM_CONV, - /// The authentication token (password). - AuthTok = libpam_sys::PAM_AUTHTOK, - /// The old authentication token (when changing passwords). - OldAuthTok = libpam_sys::PAM_OLDAUTHTOK, - /// The remote user's name. - RemoteUser = libpam_sys::PAM_RUSER, - /// The prompt shown when requesting a username. - UserPrompt = libpam_sys::PAM_USER_PROMPT, - #[cfg(feature = "linux-pam-ext")] - /// App-supplied function to override failure delays. - FailDelay = libpam_sys::PAM_FAIL_DELAY, - #[cfg(feature = "linux-pam-ext")] - /// X display name. - XDisplay = libpam_sys::PAM_XDISPLAY, - #[cfg(feature = "linux-pam-ext")] - /// X server authentication data. - XAuthData = libpam_sys::PAM_XAUTHDATA, - #[cfg(feature = "linux-pam-ext")] - /// The type of `pam_get_authtok`. - AuthTokType = libpam_sys::PAM_AUTHTOK_TYPE, -}