This is an automatically generated e-mail. To reply, visit: http://svn.reviewboard.kde.org/r/4460/

On March 6th, 2011, 6:19 p.m., Martin Gräßlin wrote:

I just tried to push the patch, but it does not apply to kwin any more. Could you please post a new patch? Thanks in advance :-)
This reviewboard won't accept the git diff i created, so I'll just post the damned diff here...
This should apply cleanly. Sorry for not keeping up with this, I've had a lot to do.

commit 8ddcbbdcbf1a047d25d60c97926fc87796571b5e
Author: Mikael Gerdin <mikael.gerdin@gmail.com>
Date:   Sat Feb 5 13:25:20 2011 +0100

    Add KAuth support to KWin process killer

diff --git a/kwin/killer/killer.cpp b/kwin/killer/killer.cpp
index 581c60c..d37a654 100644
--- a/kwin/killer/killer.cpp
+++ b/kwin/killer/killer.cpp
@@ -26,11 +26,14 @@ DEALINGS IN THE SOFTWARE.
 #include <kapplication.h>
 #include <kmessagebox.h>
 #include <klocale.h>
+#include <kauth.h>
+#include <kdebug.h>
 #include <unistd.h>
 #include <X11/Xlib.h>
 #include <QX11Info>
 #include <QProcess>
 #include <signal.h>
+#include <errno.h>
 
 int main(int argc, char* argv[])
 {
@@ -75,8 +78,20 @@ int main(int argc, char* argv[])
             QStringList lst;
             lst << hostname << "kill" << QString::number(pid);
             QProcess::startDetached("xon", lst);
-        } else
-            ::kill(pid, SIGKILL);
-        XKillClient(QX11Info::display(), id);
+        } else {
+            if (::kill(pid, SIGKILL) && errno == EPERM) {
+                KAuth::Action killer("org.kde.ksysguard.processlisthelper.sendsignal");
+                killer.setHelperID("org.kde.ksysguard.processlisthelper");
+                killer.addArgument("pid0", pid);
+                killer.addArgument("pidcount", 1);
+                killer.addArgument("signal", SIGKILL);
+                if (killer.isValid()) {
+                    kDebug(1212) << "Using KAuth to kill pid: " << pid;
+                    killer.execute();
+                } else {
+                    kDebug(1212) << "KWin process killer action not valid";
+                }
+            }
+        }
     }
 }

- Mikael


On June 26th, 2010, 3:05 p.m., Mikael Gerdin wrote:

Review request for kwin.
By Mikael Gerdin.

Updated June 26, 2010, 3:05 p.m.

Description

Makes KWin's window killer able to kill processes running as other users.
I just re-used the code used in krunner's (and ksysguard's) process lister
to kill processes using elevated privileges.

As it works now it only tries to use elevated privileges if kill returns EPERM.

Testing

Manual testing by calling the helper app manually and by making a
root-owned X window hang and click the "X" to make kwin try to kill it.
Bugs: 129476

Diffs

  • /trunk/KDE/kdebase/workspace/kwin/killer/killer.cpp (1143106)

View Diff