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.
This commit is contained in:
Maximilian Seidler 2024-07-08 14:25:06 +02:00 committed by GitHub
parent e72f601209
commit 3bedae4436
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -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) // 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. // 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; CONVERSATIONSTATE->prompt = PROMPT;
g_pAuth->waitForInput(); g_pAuth->waitForInput();
} }
@ -70,6 +70,8 @@ static void passwordCheckTimerCallback(std::shared_ptr<CTimer> self, void* data)
void CAuth::start() { void CAuth::start() {
std::thread([this]() { std::thread([this]() {
resetConversation(); resetConversation();
m_sConversationState.prompt = "Password: ";
waitForInput();
auth(); auth();
g_pHyprlock->addTimer(std::chrono::milliseconds(1), passwordCheckTimerCallback, nullptr); g_pHyprlock->addTimer(std::chrono::milliseconds(1), passwordCheckTimerCallback, nullptr);