comparison pam-sober/src/lib.rs @ 25:d5c842a50827

Fix pam-sober message (not using HTTP)
author Chris Lee <clee@mg8.org>
date Fri, 13 Apr 2018 17:24:14 -0600
parents 4263c1d83d5b
children ec70822cbdef
comparison
equal deleted inserted replaced
24:f6bde5107e48 25:d5c842a50827
30 pam_hooks!(PamSober); 30 pam_hooks!(PamSober);
31 31
32 impl PamHooks for PamSober { 32 impl PamHooks for PamSober {
33 // This function performs the task of authenticating the user. 33 // This function performs the task of authenticating the user.
34 fn sm_authenticate(pamh: &PamHandle, _args: Vec<&CStr>, _flags: PamFlag) -> PamResultCode { 34 fn sm_authenticate(pamh: &PamHandle, _args: Vec<&CStr>, _flags: PamFlag) -> PamResultCode {
35 println!("Let's auth over HTTP"); 35 println!("Let's make sure you're sober enough to perform basic addition");
36 36
37 /* TODO: use args to change difficulty ;-) 37 /* TODO: use args to change difficulty ;-)
38 let args: HashMap<&str, &str> = args.iter().map(|s| { 38 let args: HashMap<&str, &str> = args.iter().map(|s| {
39 let mut parts = s.splitn(2, "="); 39 let mut parts = s.splitn(2, "=");
40 (parts.next().unwrap(), parts.next().unwrap_or("")) 40 (parts.next().unwrap(), parts.next().unwrap_or(""))