Paste P510

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Dec 24 2019, 12:06 AM.
From a39b254c388a82222839f00622f78a2f3daca645 Mon Sep 17 00:00:00 2001
From: David Edmundson <kde@davidedmundson.co.uk>
Date: Mon, 23 Dec 2019 14:32:00 +0000
Subject: [PATCH] Avoid adjusting auth sessions
This is almost certainly a hypothetical, but display and auth are a bit
racey.
Display owns one Auth object. Theme's can request an auth start at any
time.
QProcess does not allow start to be called multiple times, so a second
m_auth->start() no-ops, but by this point we've already set multiple
things. Any signals from the auth (or display's m_reuseSesion ID) are
going to be in a confused state.
---
src/auth/Auth.cpp | 4 ++++
src/auth/Auth.h | 4 ++++
src/daemon/Display.cpp | 5 +++++
3 files changed, 13 insertions(+)
diff --git a/src/auth/Auth.cpp b/src/auth/Auth.cpp
index c1db41a..caca314 100644
--- a/src/auth/Auth.cpp
+++ b/src/auth/Auth.cpp
@@ -286,6 +286,10 @@ namespace SDDM {
return d->request;
}
+ bool Auth::isActive() const {
+ return d->child->state() != QProcess::NotRunning;
+ }
+
void Auth::insertEnvironment(const QProcessEnvironment &env) {
d->environment.insert(env);
}
diff --git a/src/auth/Auth.h b/src/auth/Auth.h
index d6169d9..87f5f44 100644
--- a/src/auth/Auth.h
+++ b/src/auth/Auth.h
@@ -94,6 +94,10 @@ namespace SDDM {
const QString &user() const;
const QString &session() const;
AuthRequest *request();
+ /**
+ * True if an authentication or session is in progress
+ */
+ bool isActive() const;
/**
* If starting a session, you will probably want to provide some basic env variables for the session.
diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
index 42004bc..f168b95 100644
--- a/src/daemon/Display.cpp
+++ b/src/daemon/Display.cpp
@@ -264,6 +264,11 @@ namespace SDDM {
}
void Display::startAuth(const QString &user, const QString &password, const Session &session) {
+
+ if (m_auth->isActive()) {
+ return;
+ }
+
m_passPhrase = password;
// sanity check
--
2.24.1
davidedmundson edited the content of this paste. (Show Details)Dec 24 2019, 12:06 AM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.