update to pam 0.7 (renamed from pam-auth)

It now supports custom conversation methods, so instead of
new() we ask for a default authenticator taking a password
via with_password(). Since the password is now handled by
the now separate conversation handler, `set_credentials()`
is now called on the handler we get via `.get_handler()`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-02-15 10:32:14 +01:00
parent d4736445fe
commit 1d77b6cf6b
2 changed files with 3 additions and 3 deletions

View File

@ -38,4 +38,4 @@ walkdir = "2"
md5 = "0.6" md5 = "0.6"
base64 = "0.10" base64 = "0.10"
pam-sys = "0.5" pam-sys = "0.5"
pam-auth = "0.5" pam = "0.7"

View File

@ -13,8 +13,8 @@ use serde_json::{json, Value};
fn authenticate_user(username: &str, password: &str) -> Result<(), Error> { fn authenticate_user(username: &str, password: &str) -> Result<(), Error> {
if username == "root@pam" { if username == "root@pam" {
let mut auth = pam_auth::Authenticator::new("proxmox-backup-auth").unwrap(); let mut auth = pam::Authenticator::with_password("proxmox-backup-auth").unwrap();
auth.set_credentials("root", password); auth.get_handler().set_credentials("root", password);
auth.authenticate()?; auth.authenticate()?;
return Ok(()); return Ok(());
} }