comparison src/lib.rs @ 193:5074d8e00560

Doc improvements.
author Paul Fisher <paul@pfish.zone>
date Sat, 02 Aug 2025 19:49:21 -0400
parents 4c39eaa4a5ae
children
comparison
equal deleted inserted replaced
192:4c39eaa4a5ae 193:5074d8e00560
82 //! 82 //!
83 //! PAM modules are implemented as dynamic libraries loaded into 83 //! PAM modules are implemented as dynamic libraries loaded into
84 //! the address space of the calling application. To implement a module, 84 //! the address space of the calling application. To implement a module,
85 //! create a `dylib` crate and implement a [`PamModule`], and export it 85 //! create a `dylib` crate and implement a [`PamModule`], and export it
86 //! using the [`pam_export!`] macro. 86 //! using the [`pam_export!`] macro.
87 //!
87 //! ```toml 88 //! ```toml
88 //! ## Your Cargo.toml 89 //! # Your Cargo.toml
89 //! [package] 90 //! [package]
90 //! name = "example-package" 91 //! name = "samename"
91 //! ## ... 92 //! description = "Checks that username and password are the same"
93 //! # ...
92 //! 94 //!
93 //! [lib] 95 //! [lib]
94 //! crate-type = ["cdylib"] 96 //! crate-type = ["cdylib"]
95 //! ``` 97 //!
98 //! [dependencies]
99 //! nonstick = "0.1"
100 //! # ...
101 //! ```
102 //!
103 //! Once you've set up the dylib crate and added `nonstick` as a dependency,
104 //! you can write the code itself:
105 //!
96 //! ``` 106 //! ```
97 //! // Your lib.rs 107 //! // Your lib.rs
98 //! 108 //!
99 //! use nonstick::{ 109 //! use nonstick::{
100 //! pam_export, AuthnFlags, ErrorCode, ModuleClient, PamModule, Result as PamResult, 110 //! pam_export, AuthnFlags, ErrorCode, ModuleClient, PamModule, Result as PamResult,
125 //! // You can implement other methods of PamModule to provide additional 135 //! // You can implement other methods of PamModule to provide additional
126 //! // features. 136 //! // features.
127 //! } 137 //! }
128 //! ``` 138 //! ```
129 //! 139 //!
130 //! This gets built into a library like `pam_samename.so`. By installing this 140 //! This gets built into a shared object. By installing this into the PAM
131 //! into your PAM library directory and configuring PAM to use it in 141 //! library directory at a place like `pam_samename.so` and configuring PAM
132 //! the authentication stack (beyond the scope of this documentation), it will 142 //! to use it in the authentication stack (beyond the scope of this
133 //! be used to authenticate users. 143 //! documentation), it will be used to authenticate users.
134 //! 144 //!
135 //! # Configuration 145 //! # Configuration
136 //! 146 //!
137 //! There are a few different PAM implementations available. By default, 147 //! There are a few different PAM implementations available. By default,
138 //! nonstick detects which implementation it should use for the current target. 148 //! nonstick detects which implementation it should use for the current target.