Browse Source

Fixed use of SAK in lock process when autologin is used in TDM.

This resolves bug 2945.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/30/head
Michele Calgaro 2 months ago
parent
commit
7aa9258f19
Signed by: Michele Calgaro <michele.calgaro@yahoo.it> GPG Key ID: 2A75B7CA8ADED5CF

+ 7
- 12
kcontrol/screensaver/scrnsave.cpp View File

@@ -46,20 +46,9 @@
46 46
 #include <ksimpleconfig.h>
47 47
 
48 48
 #include <X11/Xlib.h>
49
-
50 49
 #include "scrnsave.h"
51
-
52 50
 #include <fixx11h.h>
53 51
 
54
-#define OPEN_TDMCONFIG_AND_SET_GROUP									\
55
-if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) {							\
56
-	mTDMConfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" ));		\
57
-}													\
58
-else {													\
59
-	mTDMConfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" ));		\
60
-}													\
61
-mTDMConfig->setGroup("X-:*-Greeter");
62
-
63 52
 template class TQPtrList<SaverConfig>;
64 53
 
65 54
 const uint widgetEventMask =                 // X event mask
@@ -94,7 +83,13 @@ KScreenSaver::KScreenSaver(TQWidget *parent, const char *name, const TQStringLis
94 83
     mTesting = false;
95 84
 
96 85
     struct stat st;
97
-    OPEN_TDMCONFIG_AND_SET_GROUP
86
+    if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) {
87
+			mTDMConfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" ));
88
+		}
89
+		else {
90
+			mTDMConfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" ));
91
+		}
92
+		mTDMConfig->setGroup("X-:*-Greeter");
98 93
 
99 94
     // Add non-TDE path
100 95
     TDEGlobal::dirs()->addResourceType("scrsav",

+ 7
- 9
kdesktop/lock/main.cc View File

@@ -54,14 +54,6 @@
54 54
 # include <fixx11h.h>
55 55
 #endif
56 56
 
57
-#define OPEN_TDMCONFIG_AND_SET_GROUP									\
58
-if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) {							\
59
-	tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" ));		\
60
-}													\
61
-else {													\
62
-	tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" ));		\
63
-}													\
64
-tdmconfig->setGroup("X-:*-Greeter");
65 57
 
66 58
 TQXLibWindowList trinity_desktop_lock_hidden_window_list;
67 59
 
@@ -376,7 +368,13 @@ int main( int argc, char **argv )
376 368
 
377 369
 		struct stat st;
378 370
 		KSimpleConfig* tdmconfig;
379
-		OPEN_TDMCONFIG_AND_SET_GROUP
371
+		if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) {
372
+			tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmdistrc" ));
373
+		}
374
+		else {
375
+			tdmconfig = new KSimpleConfig( TQString::fromLatin1( KDE_CONFDIR "/tdm/tdmrc" ));
376
+		}
377
+		tdmconfig->setGroup("X-:*-Greeter");
380 378
 
381 379
 		// Create new LockProcess, which also spawns threads inheriting the blocked signal mask
382 380
 		trinity_desktop_lock_process = new LockProcess;

+ 2
- 1
tdm/backend/CMakeLists.txt View File

@@ -15,6 +15,7 @@ include_directories(
15 15
   ${CMAKE_CURRENT_BINARY_DIR}
16 16
   ${CMAKE_BINARY_DIR}
17 17
   ${DBUS_INCLUDE_DIRS}
18
+  ${CMAKE_SOURCE_DIR}/tdm/kfrontend
18 19
 )
19 20
 
20 21
 link_directories(
@@ -27,7 +28,7 @@ add_custom_command( OUTPUT config.ci
27 28
   COMMAND perl -w ${CMAKE_SOURCE_DIR}/tdm/confproc.pl ${CMAKE_SOURCE_DIR}/tdm/config.def config.ci
28 29
   DEPENDS ${CMAKE_SOURCE_DIR}/tdm/confproc.pl ${CMAKE_SOURCE_DIR}/tdm/config.def )
29 30
 
30
-set_property( SOURCE auth.c APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/config.ci )
31
+set_property( SOURCE auth.c session.c APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/config.ci )
31 32
 
32 33
 if( WITH_XDMCP )
33 34
   set( XDMCP_LIBRARIES "Xdmcp" )

+ 2
- 2
tdm/backend/dm.c View File

@@ -576,12 +576,12 @@ StartRemoteLogin( struct display *d )
576 576
 		/* Let's try again with some standard paths */
577 577
 		argv[0] = (char *)realloc(argv[0], strlen("/usr/X11R6/bin/X") + 1);
578 578
 		if (argv[0] != NULL) {
579
-			argv[0] = "/usr/X11R6/bin/X";
579
+			strcpy(argv[0], "/usr/X11R6/bin/X");
580 580
 			Debug( "exec %\"[s\n", argv );
581 581
 			(void)execv( argv[0], argv );
582 582
 			LogError( "X server %\"s cannot be executed\n", argv[0] );
583 583
 		
584
-			argv[0] = "/usr/bin/X"; /* Shorter than the previous file name */
584
+			strcpy(argv[0], "/usr/bin/X"); // Shorter than the previous file name
585 585
 			Debug( "exec %\"[s\n", argv );
586 586
 			(void)execv( argv[0], argv );
587 587
 			LogError( "X server %\"s cannot be executed\n", argv[0] );

+ 25
- 0
tdm/backend/session.c View File

@@ -34,6 +34,8 @@ from the copyright holder.
34 34
  * subdaemon event loop, etc.
35 35
  */
36 36
 
37
+
38
+#include "tdmconfig.h"
37 39
 #include "dm.h"
38 40
 #include "dm_error.h"
39 41
 
@@ -49,6 +51,8 @@ from the copyright holder.
49 51
 #include "consolekit.h"
50 52
 #endif
51 53
 
54
+#define TSAK_FIFO_FILE "/tmp/tdesocket-global/tsak"
55
+
52 56
 struct display *td;
53 57
 const char *td_setup = "auto";
54 58
 
@@ -576,6 +580,27 @@ ManageSession( struct display *d )
576 580
 		goto regreet;
577 581
 	}
578 582
 
583
+	int start_tsak = 0;
584
+#ifdef BUILD_TSAK
585
+  start_tsak = d->useSAK;
586
+#endif
587
+  if (start_tsak) {
588
+		if (system(KDE_BINDIR "/tsak checkdeps") != 0) {
589
+			start_tsak = 0;
590
+		}
591
+	}
592
+  if (start_tsak) {
593
+		int ret_pid = fork();
594
+		if (ret_pid == 0) {
595
+			// Child process
596
+			system(KDE_BINDIR "/tsak");
597
+			exit(0);
598
+		}
599
+	}
600
+	else {
601
+		remove(TSAK_FIFO_FILE);
602
+	}
603
+
579 604
 	tdiff = time( 0 ) - td->hstent->lastExit - td->openDelay;
580 605
 	if (AutoLogon( tdiff )) {
581 606
 		if (!Verify( conv_auto, FALSE ))

+ 2
- 1
tdm/config.def View File

@@ -2011,10 +2011,11 @@ Description:
2011 2011
 Key: UseSAK
2012 2012
 Type: bool
2013 2013
 Default: false
2014
+User: core
2014 2015
 User: greeter
2015 2016
 Instance: #:*/false
2016 2017
 Comment:
2017
- SAK
2018
+ Use SAK
2018 2019
 Description:
2019 2020
  If true then the SAK anti-spoofing dialog will be utilized
2020 2021
 

+ 0
- 22
tdm/kfrontend/kgapp.cpp View File

@@ -67,8 +67,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
67 67
 
68 68
 #include <pwd.h>
69 69
 
70
-#define TSAK_FIFO_FILE "/tmp/tdesocket-global/tsak"
71
-
72 70
 bool argb_visual_available = false;
73 71
 bool has_twin = false;
74 72
 bool is_themed = false;
@@ -217,7 +215,6 @@ kg_main( const char *argv0 )
217 215
 	TDEApplication::disableAutoDcopRegistration();
218 216
 	TDECrash::setSafer( true );
219 217
 
220
-	TDEProcess *tsak = 0;
221 218
 	TDEProcess *kbdl = 0;
222 219
 	TDEProcess *ccsm = 0;
223 220
 	TDEProcess *proc = 0;
@@ -230,25 +227,6 @@ kg_main( const char *argv0 )
230 227
 #else
231 228
 	trinity_desktop_lock_use_sak = false;
232 229
 #endif
233
- 	if (trinity_desktop_lock_use_sak) {
234
-		if (system(KDE_BINDIR "/tsak checkdeps") != 0) {
235
-			trinity_desktop_lock_use_sak = false;
236
-		}
237
-	}
238
-	if (trinity_desktop_lock_use_sak) {
239
-		tsak = new TDEProcess;
240
-		*tsak << TQCString( argv0, strrchr( argv0, '/' ) - argv0 + 2 ) + "tsak";
241
-		tsak->start(TDEProcess::Block, TDEProcess::AllOutput);
242
-	}
243
-	else {
244
-		remove(TSAK_FIFO_FILE);
245
-	}
246
-	if (tsak) {
247
-		tsak->closeStdin();
248
-		tsak->closeStdout();
249
-		tsak->detach();
250
-		delete tsak;
251
-	}
252 230
 
253 231
 	if (trinity_desktop_synchronize_keyboard_lights &&
254 232
 	    TQString(getenv("DISPLAY")).startsWith(":")) {

Loading…
Cancel
Save