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

List:       kde-commits
Subject:    branches/KDE/3.5
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2007-02-16 16:12:29
Message-ID: 1171642349.281572.10160.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 634204 by lunakl:

$KDE_SESSION_UID with the uid of the user starting KDE desktop.
Needed e.g. to prevent enabling desktop-wide functionality
in kded run via sudo.



 M  +3 -0      kdebase/konqueror/konq_mainwindow.cc  
 M  +7 -0      kdebase/startkde  
 M  +3 -1      kdelibs/kded/kded.cpp  


--- branches/KDE/3.5/kdebase/konqueror/konq_mainwindow.cc #634203:634204
@@ -5759,6 +5759,9 @@
     // not running in full KDE environment?
     if( getenv( "KDE_FULL_SESSION" ) == NULL || getenv( "KDE_FULL_SESSION" )[ 0 ] == \
'\0' )  return false;
+    // not the same user like the one running the session (most likely we're run via \
sudo or something) +    if( getenv( "KDE_SESSION_UID" ) != NULL && uid_t( atoi( \
getenv( "KDE_SESSION_UID" ))) != getuid()) +        return false;
     if( KonqSettings::maxPreloadCount() == 0 )
         return false;
     viewManager()->clear(); // reduce resource usage before checking it
--- branches/KDE/3.5/kdebase/startkde #634203:634204
@@ -327,9 +327,15 @@
 #     xprop -root | grep "^KDE_FULL_SESSION" >/dev/null 2>/dev/null
 #     if test $? -eq 0; then ... whatever
 #
+# Additionally there is (since KDE 3.5.7) $KDE_SESSION_UID with the uid
+# of the user running the KDE session. It should be rarely needed (e.g.
+# after sudo to prevent desktop-wide functionality in the new user's kded).
+#
 KDE_FULL_SESSION=true
 export KDE_FULL_SESSION
 xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
+KDE_SESSION_UID=$UID
+export KDE_SESSION_UID
 
 # We set LD_BIND_NOW to increase the efficiency of kdeinit.
 # kdeinit unsets this variable before loading applications.
@@ -390,5 +396,6 @@
 
 unset KDE_FULL_SESSION
 xprop -root -remove KDE_FULL_SESSION
+unset KDE_SESSION_UID
 
 echo 'startkde: Done.'  1>&2
--- branches/KDE/3.5/kdelibs/kded/kded.cpp #634203:634204
@@ -158,7 +158,9 @@
      m_dontLoad.clear();
      KConfig *config = kapp->config();
      bool kde_running = !( getenv( "KDE_FULL_SESSION" ) == NULL || getenv( \
                "KDE_FULL_SESSION" )[ 0 ] == '\0' );
-
+    // not the same user like the one running the session (most likely we're run via \
sudo or something) +    if( getenv( "KDE_SESSION_UID" ) != NULL && uid_t( atoi( \
getenv( "KDE_SESSION_UID" ))) != getuid()) +        kde_running = false;
      // Preload kded modules.
      KService::List kdedModules = KServiceType::offers("KDEDModule");
      for(KService::List::ConstIterator it = kdedModules.begin(); it != \
kdedModules.end(); ++it)


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

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