Commit 84b2cf3c authored by David Edmundson's avatar David Edmundson
Browse files

Guard double authenticate calls

Whilst authenticating we emit signals and expect callbacks to prompts.
The pam worker is inside pam_authenticate in the nested event loop.

It is not expected for GUI clients to call authenticate twice without a
cancel inbetween, but we should still guard against it as it causes a
mess.
parent 0d19ff05
Pipeline #174766 passed with stage
in 2 minutes and 29 seconds
......@@ -53,6 +53,7 @@ private:
pam_handle_t *m_handle = nullptr; //< the actual PAM handle
struct pam_conv m_conv;
bool m_inAuthenticate = false;
int m_result;
};
......@@ -143,6 +144,10 @@ PamWorker::~PamWorker()
void PamWorker::authenticate()
{
if (m_inAuthenticate) {
return;
}
m_inAuthenticate = true;
qCDebug(KSCREENLOCKER_GREET) << "Start auth";
int rc = pam_authenticate(m_handle, 0); // PAM_SILENT);
qCDebug(KSCREENLOCKER_GREET) << "Auth done RC" << rc;
......@@ -152,6 +157,7 @@ void PamWorker::authenticate()
} else {
Q_EMIT failed();
}
m_inAuthenticate = false;
}
static void fail_delay(int retval, unsigned usec_delay, void *appdata_ptr)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment