Mercurial > crates > nonstick
diff libpam-sys/src/constants.rs @ 108:e97534be35e3
Make some proc macros for doing cfg-like stuff for PAM impls.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 28 Jun 2025 00:34:45 -0400 |
parents | 49d9e2b5c189 |
children | bb465393621f |
line wrap: on
line diff
--- a/libpam-sys/src/constants.rs Thu Jun 26 22:42:32 2025 -0400 +++ b/libpam-sys/src/constants.rs Sat Jun 28 00:34:45 2025 -0400 @@ -1,17 +1,20 @@ //! All the constants. -#![allow(dead_code)] + +// We have to enable these otherwise we get lit up with warnings +// during conditional compilation. +#![allow(dead_code, unused_imports)] /// Macro to make defining a bunch of constants way easier. macro_rules! define { - ($(#[$attr:meta])* $($name:ident = $value:expr);+$(;)?) => { - define!( - @meta { $(#[$attr])* } - $(pub const $name: u32 = $value;)+ - ); - }; - (@meta $m:tt $($i:item)+) => { define!(@expand $($m $i)+); }; - (@expand $({ $(#[$m:meta])* } $i:item)+) => {$($(#[$m])* $i)+}; - } + ($(#[$attr:meta])* $($name:ident = $value:expr);+$(;)?) => { + define!( + @meta { $(#[$attr])* } + $(pub const $name: u32 = $value;)+ + ); + }; + (@meta $m:tt $($i:item)+) => { define!(@expand $($m $i)+); }; + (@expand $({ $(#[$m:meta])* } $i:item)+) => {$($(#[$m])* $i)+}; +} #[cfg(feature = "use-system-headers")] pub use system_headers::*; @@ -55,7 +58,7 @@ pub use super::linux_pam::*; #[cfg(not(pam_impl = "linux-pam"))] - pub use super::shared::*; + pub use super::illumos_openpam::*; #[cfg(pam_impl = "illumos")] pub use super::illumos::*; @@ -66,7 +69,7 @@ /// Constants extracted from PAM header files. mod system_headers { - include!(concat!(env!("OUT_DIR"), "/constants.rs")); + // include!(concat!(env!("OUT_DIR"), "/constants.rs")); } /// Constants used by Linux-PAM. @@ -114,8 +117,13 @@ PAM_ESTABLISH_CRED = 0x0002; PAM_DELETE_CRED = 0x0004; PAM_REINITIALIZE_CRED = 0x0008; + PAM_REFRESH_CRED = 0x0010; PAM_CHANGE_EXPIRED_AUTHTOK = 0x0020; + + PAM_PRELIM_CHECK = 0x4000; + PAM_UPDATE_AUTHTOK = 0x2000; + PAM_DATA_REPLACE = 0x20000000; ); define!( @@ -138,7 +146,7 @@ } /// Constants shared between Illumos and OpenPAM. -mod shared { +mod illumos_openpam { define!( /// An error code. PAM_OPEN_ERR = 1;