From a359fef24e132b22b7a1667f826b0fb1bddf331f Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 3 Jul 2018 20:10:17 +0900 Subject: Fixed session locking at login. This resolves bug 2874. Signed-off-by: Michele Calgaro --- kdesktop/CMakeLists.txt | 2 ++ kdesktop/lockeng.cc | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'kdesktop') diff --git a/kdesktop/CMakeLists.txt b/kdesktop/CMakeLists.txt index 45cc9e9ed..fcb84a66a 100644 --- a/kdesktop/CMakeLists.txt +++ b/kdesktop/CMakeLists.txt @@ -81,6 +81,8 @@ tde_add_executable( kxdglauncher ##### kdesktop (tdeinit) ######################## set( target kdesktop ) +set_source_files_properties( lockeng.cc PROPERTIES COMPILE_FLAGS -DKDE_CONFDIR=\\"${TDE_CONFIG_DIR}\\" ) + set( ${target}_SRCS main.cc krootwm.cc xautolock.cc kdiconview.cc init.cc diff --git a/kdesktop/lockeng.cc b/kdesktop/lockeng.cc index 8aa6bb61c..4683ad495 100644 --- a/kdesktop/lockeng.cc +++ b/kdesktop/lockeng.cc @@ -10,6 +10,7 @@ #include #include +#include #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -165,6 +167,30 @@ SaverEngine::SaverEngine() sigaddset(&mThreadBlockSet, SIGTTIN); pthread_sigmask(SIG_BLOCK, &mThreadBlockSet, NULL); + // Wait for the saver process to signal ready... + if (!waitForLockProcessStart()) { + kdDebug( 1204 ) << "Failed to initialize kdesktop_lock (unexpected termination)!" << endl; + } + + // lock the desktop if required + KSimpleConfig *config; + struct stat st; + if (stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st) == 0) { + config = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" )); + } + else { + config = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" )); + } + config->setGroup("X-:0-Core"); + bool autoLoginEnable = config->readBoolEntry("AutoLoginEnable", false); + bool autoLoginLocked = config->readBoolEntry("AutoLoginLocked", false); + if (autoLoginEnable && autoLoginLocked) { + mLockProcess.kill(SIGTTOU); + mLockProcess.kill(SIGUSR1); + } + delete config; + config = NULL; + // Initialize SmartCard readers TDEGenericDevice *hwdevice; TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices(); -- cgit v1.2.1