Resolve pam services not always having a tty (#3176)

This commit is contained in:
Firstyear 2024-11-05 10:49:33 +10:00 committed by William Brown
parent 770efa80f0
commit 78ced241eb
4 changed files with 6 additions and 5 deletions

View file

@ -106,7 +106,8 @@ pub enum PamAuthRequest {
#[derive(Serialize, Deserialize, Debug)]
pub struct PamServiceInfo {
pub service: String,
pub tty: String,
// Somehow SDDM doesn't set this ...
pub tty: Option<String>,
// Only set if it really is a remote host?
pub rhost: Option<String>,
}
@ -147,7 +148,7 @@ impl ClientRequest {
"PamAuthenticateInit{{ account_id={} tty={} pam_secvice{} rhost={} }}",
account_id,
info.service,
info.tty,
info.tty.as_deref().unwrap_or(""),
info.rhost.as_deref().unwrap_or("")
),
ClientRequest::PamAuthenticateStep(_) => "PamAuthenticateStep".to_string(),

View file

@ -256,7 +256,7 @@ impl PamHandle {
tracing::debug!(?maybe_tty, ?maybe_rhost, ?maybe_service);
match (maybe_tty, maybe_rhost, maybe_service) {
(Some(tty), rhost, Some(service)) => Ok(PamServiceInfo {
(tty, rhost, Some(service)) => Ok(PamServiceInfo {
service,
tty,
rhost,

View file

@ -67,7 +67,7 @@ async fn main() -> ExitCode {
account_id: account_id.clone(),
info: PamServiceInfo {
service: "kanidm-unix".to_string(),
tty: "/dev/null".to_string(),
tty: None,
rhost: None,
},
};

View file

@ -1086,7 +1086,7 @@ impl Resolver {
let pam_info = PamServiceInfo {
service: "kanidm-unix-test".to_string(),
tty: "/dev/null".to_string(),
tty: Some("/dev/null".to_string()),
rhost: None,
};