Partially handle errors

This commit is contained in:
Jeremy Soller 2023-10-04 11:59:34 -06:00
parent 76b9e8b7bf
commit 3bc299859f
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
2 changed files with 107 additions and 100 deletions

View file

@ -1,4 +1,4 @@
use greetd_ipc::{codec::SyncCodec, AuthMessageType, Request, Response};
use greetd_ipc::{codec::SyncCodec, AuthMessageType, ErrorType, Request, Response};
use std::io;
use tokio::net::UnixListener;
@ -40,7 +40,15 @@ async fn main() {
auth_message_type: AuthMessageType::Secret,
auth_message: "Password:".to_string(),
},
Request::PostAuthMessageResponse { .. } => Response::Success,
Request::PostAuthMessageResponse { response } => {
match response.as_ref().map(|x| x.as_str()) {
Some("password") => Response::Success,
_ => Response::Error {
error_type: ErrorType::AuthError,
description: "pam_authenticate: AUTH_ERR".to_string(),
},
}
}
Request::StartSession { .. } => Response::Success,
_ => {
println!("unhandled request");