Mercurial > crates > nonstick
view src/lib.rs @ 56:daa2cde64601
Big big refactor. Probably should have been multiple changes.
- Makes FFI safer by explicitly specifying c_int in calls.
- Uses ToPrimitive/FromPrimitive to make this easier.
- Pulls PamFlag variables into a bitflags! struct.
- Pulls PamMessageStyle variables into an enum.
- Renames ResultCode to ErrorCode.
- Switches from PAM_SUCCESS to using a Result<(), ErrorCode>.
- Uses thiserror to make ErrorCode into an Error.
- Gets rid of pam_try! because now we have Results.
- Expands some names (e.g. Conv to Conversation).
- Adds more doc comments.
- Returns passwords as a SecureString, to avoid unnecessarily
keeping it around in memory.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 04 May 2025 02:56:55 -0400 |
parents | ce47901aab7a |
children | 2a5c83d04b93 |
line wrap: on
line source
//! Interface to the pluggable authentication module framework (PAM). //! //! The goal of this library is to provide a type-safe API that can be used to //! interact with PAM. The library is incomplete - currently it supports //! a subset of functions for use in a pam authentication module. A pam module //! is a shared library that is invoked to authenticate a user, or to perform //! other functions. //! //! 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 //! //! A typical authentication module will define an external function called //! `pam_sm_authenticate()`, which will use functions in this library to //! interrogate the program that requested authentication for more information, //! and to render a result. For a working example that uses this library, see //! [toznyauth-pam][]. //! //! [toznyauth-pam]: https://github.com/tozny/toznyauth-pam //! //! Note that constants that are normally read from pam header files are //! hard-coded in the `constants` module. The values there are taken from //! a Linux system. That means that it might take some work to get this library //! to work on other platforms. extern crate libc; pub mod constants; pub mod conv; pub mod items; #[doc(hidden)] pub mod macros; pub mod module;