comparison src/lib.rs @ 171:e27c5c667a5a

Create full new types for return code and flags, separate end to end. This plumbs the ReturnCode and RawFlags types through the places where we call into or are called from PAM. Also adds Sun documentation to the project.
author Paul Fisher <paul@pfish.zone>
date Fri, 25 Jul 2025 20:52:14 -0400
parents 2f5913131295
children 46e8ce5cd5d1
comparison
equal deleted inserted replaced
170:f052e2417195 171:e27c5c667a5a
20 //! For general information on writing PAM modules, see 20 //! For general information on writing PAM modules, see
21 //! [The Linux-PAM Module Writers' Guide][module-guide] 21 //! [The Linux-PAM Module Writers' Guide][module-guide]
22 //! 22 //!
23 //! [module-guide]: https://www.chiark.greenend.org.uk/doc/libpam-doc/html/Linux-PAM_MWG.html 23 //! [module-guide]: https://www.chiark.greenend.org.uk/doc/libpam-doc/html/Linux-PAM_MWG.html
24 24
25 // Temporary until everything is fully wired up. 25 #[cfg(feature = "link")]
26 #![allow(dead_code)] 26 mod _compat_checker {
27 macro_rules! feature_check {
28 ($feature:literal, pam_impl = ($($pimpl:literal),*)) => {
29 #[cfg(all(feature = $feature, not(any($(pam_impl = $pimpl),*))))]
30 compile_error!(
31 concat!(
32 "The feature '", $feature, "' is only available ",
33 "with these PAM implementations:\n",
34 $("- ", $pimpl, "\n"),*,
35 "The current PAM implementation is:\n\n",
36 " ", libpam_sys::pam_impl_name!(), "\n\n",
37 "Set the 'LIBPAMSYS_IMPL' environment variable to one of ",
38 "the above PAM implementation names to build ",
39 "for that implementation of PAM."
40 )
41 );
42 }
43 }
44 feature_check!("linux-pam-ext", pam_impl = ("LinuxPam"));
45 feature_check!("basic-ext", pam_impl = ("LinuxPam", "OpenPam"));
46 feature_check!("openpam-ext", pam_impl = ("OpenPam"));
47 feature_check!("sun-ext", pam_impl = ("Sun"));
48 }
27 49
28 pub mod constants; 50 pub mod constants;
29 pub mod conv; 51 pub mod conv;
30 pub mod module; 52 pub mod module;
31 53
37 #[cfg(feature = "link")] 59 #[cfg(feature = "link")]
38 pub mod libpam; 60 pub mod libpam;
39 pub mod logging; 61 pub mod logging;
40 62
41 #[cfg(feature = "link")] 63 #[cfg(feature = "link")]
64 #[doc(hidden)]
65 pub use crate::libpam::ModuleExporter;
66 #[cfg(feature = "link")]
42 #[doc(inline)] 67 #[doc(inline)]
43 pub use crate::libpam::{LibPamHandle, LibPamTransaction}; 68 pub use crate::libpam::{LibPamHandle, LibPamTransaction, TransactionBuilder};
44 #[doc(inline)] 69 #[doc(inline)]
45 pub use crate::{ 70 pub use crate::{
46 constants::{ 71 constants::{
47 AuthnFlags, AuthtokAction, AuthtokFlags, BaseFlags, CredAction, ErrorCode, Result, 72 AuthnFlags, AuthtokAction, AuthtokFlags, BaseFlags, CredAction, ErrorCode, Result,
48 }, 73 },