macro_rules! pam_hooks {
    ($ident:ident) => { ... };
}
Expand description

Macro to generate the extern "C" entrypoint bindings needed by PAM

You can call pam_hooks!(SomeType); for any type that implements PamHooks

Examples:

Here is full example of a PAM module that would authenticate and authorize everybody:

#[macro_use] extern crate pam;

use pam::module::{PamHooks, PamHandle};
use pam::constants::{PamResultCode, PamFlag};
use std::ffi::CStr;

struct MyPamModule;
pam_hooks!(MyPamModule);

impl PamHooks for MyPamModule {
   fn sm_authenticate(pamh: &PamHandle, args: Vec<&CStr>, flags: PamFlag) -> PamResultCode {
       println!("Everybody is authenticated!");
       PamResultCode::PAM_SUCCESS
   }

   fn acct_mgmt(pamh: &PamHandle, args: Vec<&CStr>, flags: PamFlag) -> PamResultCode {
       println!("Everybody is authorized!");
       PamResultCode::PAM_SUCCESS
   }
}