From 3bedae44368b1e490ff0d5a9f3fd508a4041d3a5 Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Mon, 8 Jul 2024 14:25:06 +0200 Subject: [PATCH] auth: don't start pam conversation before the initial input happens (#409) After realizing that pam modules sometimes implement a timeout, i think it is not worth starting the convo it right away. Now you won't get the initial PAM_PROMPT any more. Prompt will be initialized to "Password: ", which is most commonly what you get from pam. Subsequent prompts (e.g. 2fa) will be handled however. --- src/core/Auth.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/Auth.cpp b/src/core/Auth.cpp index a4ca2f1..90857c6 100644 --- a/src/core/Auth.cpp +++ b/src/core/Auth.cpp @@ -32,7 +32,7 @@ int conv(int num_msg, const struct pam_message** msg, struct pam_response** resp // Some pam configurations ask for the password twice for whatever reason (Fedora su for example) // When the prompt is the same as the last one, I guess our answer can be the same. - if (initialPrompt || PROMPTCHANGED) { + if (!initialPrompt && PROMPTCHANGED) { CONVERSATIONSTATE->prompt = PROMPT; g_pAuth->waitForInput(); } @@ -70,6 +70,8 @@ static void passwordCheckTimerCallback(std::shared_ptr self, void* data) void CAuth::start() { std::thread([this]() { resetConversation(); + m_sConversationState.prompt = "Password: "; + waitForInput(); auth(); g_pHyprlock->addTimer(std::chrono::milliseconds(1), passwordCheckTimerCallback, nullptr);