[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/ksmserver
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2003-07-30 15:59:13
[Download RAW message or body]

CVS commit by lunakl: 

Try to start remote apps again remotely even for XSMP apps, not only
SAVE_YOURSELF ones (even though I doubt somebody has actually xon
working properly).
Start apps saved under different userid via kdesu.


  M +22 -10    server.cpp   1.114
  M +3 -1      server.h   1.36


--- kdebase/ksmserver/server.cpp  #1.113:1.114
@@ -34,4 +34,5 @@ CONNECTION WITH THE SOFTWARE OR THE USE 
 #endif
 
+#include <pwd.h>
 #include <sys/types.h>
 #include <sys/param.h>
@@ -237,8 +238,22 @@ QString KSMClient::userId() const
  * to restart applications.
  */
-void KSMServer::startApplication( const QStringList& command )
+void KSMServer::startApplication( QStringList command, const QString& clientMachine,
+    const QString& userId )
 {
     if ( command.isEmpty() )
         return;
+    if ( !userId.isEmpty()) {
+        struct passwd* pw = getpwuid( getuid());
+        if( pw != NULL && userId != QString::fromLocal8Bit( pw->pw_name )) {
+            command.prepend( "--" );
+            command.prepend( userId );
+            command.prepend( "-u" );
+            command.prepend( "kdesu" );
+        }
+    }
+    if ( !clientMachine.isEmpty() && clientMachine != "localhost" ) {
+        command.prepend( clientMachine );
+        command.prepend( "xon" );
+    }
     int n = command.count();
     QCString app = command[0].latin1();
@@ -1506,5 +1521,7 @@ void KSMServer::restoreNextInternal()
         if ( wm == config->readEntry( QString("program")+n ) )
             continue;
-        startApplication( restartCommand );
+        startApplication( restartCommand,
+                          config->readEntry( QString("clientMachine")+n ),
+                          config->readEntry( QString("userId")+n ));
         lastIdStarted = config->readEntry( QString("clientId")+n );
         if ( !lastIdStarted.isEmpty() ) {
@@ -1785,12 +1802,7 @@ void KSMServer::restoreLegacySessionInte
         QString n = QString::number(i);
         QStringList wmCommand = config->readListEntry( QString("command")+n, sep );
-        QString wmClientMachine = config->readEntry( QString("clientMachine")+n );
-        if ( !wmCommand.isEmpty() && !wmClientMachine.isEmpty() ) {
-            if ( wmClientMachine != "localhost" ) {
-                wmCommand.prepend( wmClientMachine );
-                wmCommand.prepend( "xon" );
-            }
-        startApplication( wmCommand );
-        }
+        startApplication( wmCommand,
+                          config->readEntry( QString("clientMachine")+n ),
+                          config->readEntry( QString("userId")+n ));
     }
 }

--- kdebase/ksmserver/server.h  #1.35:1.36
@@ -145,5 +145,7 @@ private:
     void endProtection() { protectionTimer.stop(); }
 
-    void startApplication( const QStringList& command );
+    void startApplication( QStringList command,
+        const QString& clientMachine = QString::null,
+        const QString& userId = QString::null );
     void executeCommand( const QStringList& command );
     


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic