Browse Source

Fixed bug 925 ("SAK driven secure dialog is not available for use"

message in .xsession-errors even when SAK is disabled).

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/30/head
Michele Calgaro 2 months ago
parent
commit
3c109e3d10
Signed by: Michele Calgaro <michele.calgaro@yahoo.it> GPG Key ID: 2A75B7CA8ADED5CF
1 changed files with 31 additions and 16 deletions
  1. 31
    16
      kdesktop/lockeng.cc

+ 31
- 16
kdesktop/lockeng.cc View File

@@ -139,14 +139,29 @@ SaverEngine::SaverEngine()
139 139
 	connect(&mLockProcess, TQT_SIGNAL(processExited(TDEProcess *)),
140 140
 						TQT_SLOT(lockProcessExited()));
141 141
 
142
-	mSAKProcess = new TDEProcess;
143
-	*mSAKProcess << "tdmtsak";
144
-	connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited()));
145
-
146
-	TQTimer::singleShot( 0, this, TQT_SLOT(handleSecureDialog()) );
147
-
148 142
 	configure();
149 143
 
144
+	// Create SAK process only if SAK is enabled
145
+	KSimpleConfig *config;
146
+  struct stat st;
147
+  if (stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st) == 0) {
148
+    config = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" ));
149
+  }
150
+  else {
151
+    config = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" ));
152
+  }
153
+	config->setGroup("X-:*-Greeter");
154
+	bool useSAKProcess = false;
155
+#ifdef BUILD_TSAK
156
+	useSAKProcess = config->readBoolEntry("UseSAK", false) && KDesktopSettings::useTDESAK();
157
+#endif
158
+	if (useSAKProcess) {
159
+		mSAKProcess = new TDEProcess;
160
+		*mSAKProcess << "tdmtsak";
161
+		connect(mSAKProcess, TQT_SIGNAL(processExited(TDEProcess*)), this, TQT_SLOT(slotSAKProcessExited()));
162
+		TQTimer::singleShot( 0, this, TQT_SLOT(handleSecureDialog()) );
163
+	}
164
+
150 165
 	mLockProcess.clearArguments();
151 166
 	TQString path = TDEStandardDirs::findExe( "kdesktop_lock" );
152 167
 	if( path.isEmpty())
@@ -173,14 +188,6 @@ SaverEngine::SaverEngine()
173 188
 	}
174 189
 
175 190
 	// lock the desktop if required
176
-	KSimpleConfig *config;
177
-  struct stat st;
178
-  if (stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st) == 0) {
179
-    config = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" ));
180
-  }
181
-  else {
182
-    config = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" ));
183
-  }
184 191
   config->setGroup("X-:0-Core");
185 192
   bool autoLoginEnable = config->readBoolEntry("AutoLoginEnable", false);
186 193
   bool autoLoginLocked = config->readBoolEntry("AutoLoginLocked", false);
@@ -454,11 +461,17 @@ void SaverEngine::enableExports()
454 461
 void SaverEngine::handleSecureDialog()
455 462
 {
456 463
 	// Wait for SAK press
457
-	if (!mSAKProcess->isRunning()) mSAKProcess->start();
464
+	if (mSAKProcess && !mSAKProcess->isRunning()) {
465
+		mSAKProcess->start();
466
+	}
458 467
 }
459 468
 
460 469
 void SaverEngine::slotSAKProcessExited()
461 470
 {
471
+	if (!mSAKProcess) {
472
+		printf("[kdesktop] SAK process does not exist. Something went wrong. Ignoring...\n"); fflush(stdout);
473
+		return;
474
+	}
462 475
 	int retcode = mSAKProcess->exitStatus();
463 476
 	if ((retcode != 0) && (mSAKProcess->normalExit())) {
464 477
 		trinity_lockeng_sak_available = FALSE;
@@ -566,7 +579,9 @@ bool SaverEngine::startLockProcess( LockType lock_type )
566 579
 	}
567 580
 
568 581
 	mState = Preparing;
569
-	mSAKProcess->kill(SIGTERM);
582
+	if (mSAKProcess) {
583
+		mSAKProcess->kill(SIGTERM);
584
+	}
570 585
 
571 586
 	enableExports();
572 587
 

Loading…
Cancel
Save