pamsm 0.3.2

Rust wrappers around PAM Service Modules functions
Documentation

PAM Service Module wrappers

Usage

For example, here is a time based authentication module :

#[macro_use] extern crate pamsm;
extern crate time;

use pamsm::{PamServiceModule, Pam, PamFlag, PamError};

struct PamTime;

impl PamServiceModule for PamTime {
fn authenticate(pamh: Pam, _: PamFlag, args: Vec<String>) -> PamError {
let hour = time::now().tm_hour;
if hour != 4 {
// Only allow authentication when it's 4 AM
PamError::SUCCESS
} else {
PamError::AUTH_ERR
}
}
}

pam_module!(PamTime);