From 37d12d8d467da6e869e33fce21adea1cd85af166 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 21 Aug 2024 15:43:13 -0500 Subject: Fix kdesktop lock process hang / denial of service Under specific circumstances, kdesktop_lock may fail to engage the screen lock when requested. When this occurs, the user is typically present to observe and attempt relock, however the kdesktop_lock process may not respond once the lock has failed to engage and the process has not been restarted. Add a fallback handler for SIGHUP (lock engage) to the kdesktop_lock startup application thread. This ensures the process will always respond to a lock request regardless of lock process state. Signed-off-by: Timothy Pearson --- kdesktop/lock/lockprocess.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'kdesktop/lock/lockprocess.cpp') diff --git a/kdesktop/lock/lockprocess.cpp b/kdesktop/lock/lockprocess.cpp index 0a343d88e..234327001 100644 --- a/kdesktop/lock/lockprocess.cpp +++ b/kdesktop/lock/lockprocess.cpp @@ -4,7 +4,7 @@ // // Copyright (c) 1999 Martin R. Jones // Copyright (c) 2003 Oswald Buddenhagen -// Copyright (c) 2010 - 2015 Timothy Pearson +// Copyright (c) 2010 - 2024 Timothy Pearson // //kdesktop keeps running and checks user inactivity @@ -193,6 +193,9 @@ mHackDelayStartupTimer->stop(); // LockProcess::LockProcess() : TQWidget(0L, "saver window", ((WFlags)(WStyle_StaysOnTop|WStyle_Customize|WStyle_NoBorder))), + mInitialized(FALSE), + mLockPending(FALSE), + mLocked(FALSE), mOpenGLVisual(0), mParent(0), mShowLockDateTime(false), @@ -438,6 +441,8 @@ void LockProcess::init(bool child, bool useBlankOnly) TQObject::connect(mControlPipeHandler, TQ_SIGNAL(processCommand(TQString)), this, TQ_SLOT(processInputPipeCommand(TQString))); TQTimer::singleShot(0, mControlPipeHandler, TQ_SLOT(run())); mControlPipeHandlerThread->start(); + + mInitialized = TRUE; } static int signal_pipe[2]; @@ -1477,6 +1482,13 @@ i18n("kcheckpass is unable to operate. Possibly it is not SetUID root."); // bool LockProcess::startLock() { + mLockPending = TRUE; + + if (!mInitialized) { + // Don't hang if we're not even initialized yet -- startLock() was triggered prematurely + return false; + } + for (TQStringList::ConstIterator it = mPlugins.begin(); it != mPlugins.end(); ++it) { GreeterPluginHandle plugin; TQString path = KLibLoader::self()->findLibrary( ((*it)[0] == '/' ? *it : "kgreet_" + *it ).latin1() ); @@ -1507,6 +1519,7 @@ bool LockProcess::startLock() kdDebug(KDESKTOP_DEBUG_ID) << "GreeterPlugin " << *it << " (" << plugin.info->method << ", " << plugin.info->name << ") loaded" << endl; greetPlugin = plugin; mLocked = true; + mLockPending = FALSE; DM().setLock( true ); return true; } @@ -1973,6 +1986,11 @@ static void fakeFocusIn( WId window ) XSendEvent( tqt_xdisplay(), window, False, NoEventMask, &ev ); } +bool LockProcess::lockPending() +{ + return mLockPending; +} + void LockProcess::resumeUnforced() { resume( false ); -- cgit v1.2.1