Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 // Copyright (C) 2016 Raphael Catolino
2
3 //! PAM Service Module wrappers
4 //! # Usage
5 //! For example, here is a time based authentication module :
6 //!
7 //! ```rust,no_run
8 //! #[macro_use] extern crate pamsm;
9 //! extern crate time;
10 //!
11 //! use pamsm::{PamServiceModule, Pam, PamFlags, PamError};
12 //!
13 //! struct PamTime;
14 //!
15 //! impl PamServiceModule for PamTime {
16 //! fn authenticate(pamh: Pam, _: PamFlags, args: Vec<String>) -> PamError {
17 //! let hour = time::OffsetDateTime::now_utc().hour();
18 //! if hour != 4 {
19 //! // Only allow authentication when it's 4 AM
20 //! PamError::SUCCESS
21 //! } else {
22 //! PamError::AUTH_ERR
23 //! }
24 //! }
25 //! }
26 //!
27 //! pam_module!(PamTime);
28 //! ```
29 #[macro_use]
30 extern crate bitflags;
31
32 #[cfg(feature = "libpam")]
33 mod libpam;
34 mod pam;
35 mod pam_types;
36
37 pub use pam::{Pam, PamError, PamFlags, PamSendRef, PamServiceModule};
38
39 #[cfg(feature = "libpam")]
40 pub use libpam::{PamCleanupCb, PamData, PamLibExt, PamResult};
41 #[cfg(feature = "libpam")]
42 pub use pam_types::{LogLvl, PamMsgStyle};