[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace
From: Oswald Buddenhagen <ossi () kde ! org>
Date: 2010-10-24 12:03:28
Message-ID: 20101024120328.E4F8CAC897 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1189266 by ossi:
less hacky implementation of initial session lock
give kscreenlocker a proper --daemon argument which makes it
properly report startup status and fork itself into the background.
make startkde use it. if the lock fails, immediately kill the
session for security reasons.
M +24 -0 krunner/lock/main.cc
M +4 -4 startkde.cmake
--- trunk/KDE/kdebase/workspace/krunner/lock/main.cc #1189265:1189266
@@ -66,9 +66,29 @@
options.add("dontlock", ki18n("Only start screen saver"));
options.add("blank", ki18n("Only use the blank screen saver"));
options.add("plasmasetup", ki18n("start with plasma unlocked for configuring"));
+ options.add("daemon", ki18n("Fork into the background after starting up"));
KCmdLineArgs::addCmdLineOptions( options );
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ bool daemonize = false;
+ int daemonPipe[2];
+ char daemonBuf;
+ if (args->isSet("daemon")) {
+ daemonize = true;
+ if (pipe(daemonPipe))
+ kFatal() << "pipe() failed";
+ switch (fork()) {
+ case -1:
+ kFatal() << "fork() failed";
+ case 0:
+ break;
+ default:
+ if (read(daemonPipe[0], &daemonBuf, 1) != 1)
+ _exit(1);
+ _exit(0);
+ }
+ }
+
putenv(strdup("SESSION_MANAGER="));
//KApplication::disableAutoDcopRegistration();
@@ -170,6 +190,10 @@
kscreensaver.saverLockReady();
}
args->clear();
+ if (daemonize) {
+ daemonBuf = 0;
+ write(daemonPipe[1], &daemonBuf, 1);
+ }
return app.exec();
}
--- trunk/KDE/kdebase/workspace/startkde.cmake #1189265:1189266
@@ -351,11 +351,11 @@
# If the session should be locked from the start (locked autologin),
# lock now and do the rest of the KDE startup underneath the locker.
if test -n "$dl"; then
- kwrapper4 kscreenlocker --forcelock &
- # Give it some time for starting up. This is somewhat unclean; some
- # notification would be better.
- sleep 1
+ if ! kwrapper4 kscreenlocker --forcelock --daemon; then
+ echo 'startkde: Initial session lock failed. Terminating for security reasons.' 1>&2
+ exit 1
fi
+fi
# finally, give the session control to the session manager
# see kdebase/ksmserver for the description of the rest of the startup sequence
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic