Mercurial > crates > nonstick
view src/lib.rs @ 141:a508a69c068a
Remove a lot of Results from functions.
Many functions are documented to only return failing Results when given
improper inputs or when there is a memory allocation failure (which
can be verified by looking at the source). In cases where we know our
input is correct, we don't need to check for memory allocation errors
for the same reason that Rust doesn't do so when you, e.g., create a
new Vec.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sat, 05 Jul 2025 17:16:56 -0400 |
parents | a12706e42c9d |
children | 56b559b7ecea |
line wrap: on
line source
//! A safe, nonstick interface to PAM. //! //! This implements a type-safe library to interact with PAM. //! Currently, it implements a subset of PAM useful for implementing a module. //! //! To write a new PAM module using this crate: //! //! 1. Create a `dylib` crate. //! 2. Implement a subset of the functions in the [`PamModule`] trait //! corresponding to what you want your module to do. //! In the simplest case (for a new password-based authenticator), //! this will be the [`PamModule::authenticate`] function. //! 3. Export your PAM module using the [`pam_hooks!`] macro. //! 4. Build and install the dynamic library. //! This usually entails placing it at //! <code>/usr/lib/security/pam_<var>your_module</var>.so</code>, //! or maybe //! <code>/usr/lib/<var>your-architecture</var>/security/pam_<var>your_module</var>.so</code>. //! //! For general information on writing PAM modules, see //! [The Linux-PAM Module Writers' Guide][module-guide] //! //! [module-guide]: https://www.chiark.greenend.org.uk/doc/libpam-doc/html/Linux-PAM_MWG.html // Temporary until everything is fully wired up. #![allow(dead_code)] pub mod constants; pub mod conv; pub mod module; pub mod handle; mod _doc; pub(crate) use _doc::*; mod environ; #[cfg(feature = "link")] mod libpam; pub mod logging; #[cfg(feature = "link")] #[doc(inline)] pub use crate::libpam::{OwnedLibPamHandle, RawPamHandle}; #[doc(inline)] pub use crate::{ constants::{ErrorCode, Flags, Result}, conv::{BinaryData, Conversation, ConversationAdapter}, environ::{EnvironMap, EnvironMapMut}, handle::{PamHandleApplication, PamHandleModule, PamShared}, module::PamModule, };