This commit is contained in:
parent
f0a681601b
commit
19db6a8278
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:03b4d0eaeb3ba9721393a4fec02fa96e0991de880a34d6fdaf4ab7011c36946d
|
||||
size 550408
|
3
libksysguard-5.0.1.tar.xz
Normal file
3
libksysguard-5.0.1.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a9310053daebf26faa22d47bbe7b0736dfff206ac20220c4d34037607627db4f
|
||||
size 550820
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 11 20:58:27 UTC 2014 - hrvoje.senjan@gmail.com
|
||||
|
||||
- Update to 5.0.1
|
||||
* Bugfix release
|
||||
- Added libksysguard_kauth.diff: re-enables KAuth usage within
|
||||
(lib)ksysguard (e.g. process killing, niceness, etc)
|
||||
- Create helper subpackage
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 14 22:19:38 UTC 2014 - hrvoje.senjan@gmail.com
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
Name: libksysguard5
|
||||
Version: 5.0.0
|
||||
Version: 5.0.1
|
||||
Release: 0
|
||||
Summary: Task management and system monitoring library
|
||||
License: GPL-2.0+
|
||||
@ -25,6 +25,8 @@ Group: Development/Libraries/C and C++
|
||||
Url: http://www.kde.org
|
||||
Source: http://download.kde.org/stable/plasma/%{version}/libksysguard-%{version}.tar.xz
|
||||
Source1: baselibs.conf
|
||||
# PATCH-FIX-UPSTREAM libksysguard_kauth.diff -- re-enables KAuth usage within (lib)ksysguard (e.g. process killing, niceness, etc)
|
||||
Patch0: libksysguard_kauth.diff
|
||||
BuildRequires: extra-cmake-modules >= 0.0.9
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: kconfig-devel
|
||||
@ -61,8 +63,18 @@ Conflicts: kdebase4-workspace-devel
|
||||
Task management and system monitoring library. This package contains development
|
||||
files.
|
||||
|
||||
%package helper
|
||||
Summary: Task management and system monitoring library -- helper files
|
||||
Group: Development/Libraries/C and C++
|
||||
Conflicts: kdebase4-workspace
|
||||
|
||||
%description helper
|
||||
Task management and system monitoring library. This package contains helper files
|
||||
for actions that require elevated privileges.
|
||||
|
||||
%prep
|
||||
%setup -q -n libksysguard-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%cmake_kf5 -d build -- -DBUILD_po=OFF
|
||||
@ -85,6 +97,14 @@ files.
|
||||
%{_kf5_libdir}/libprocessui.so.*
|
||||
%{_kf5_sharedir}/ksysguard/
|
||||
|
||||
%files helper
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING*
|
||||
%{_kf5_sysconfdir}/dbus-1/system.d/org.kde.ksysguard.processlisthelper.conf
|
||||
%{_kf5_libdir}/libexec/
|
||||
%{_kf5_sharedir}/dbus-1/system-services/org.kde.ksysguard.processlisthelper.service
|
||||
%{_kf5_sharedir}/polkit-1/actions/org.kde.ksysguard.processlisthelper.policy
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%doc COPYING*
|
||||
|
339
libksysguard_kauth.diff
Normal file
339
libksysguard_kauth.diff
Normal file
@ -0,0 +1,339 @@
|
||||
diff --git a/processcore/CMakeLists.txt b/processcore/CMakeLists.txt
|
||||
index 9fef4ec..939d055 100644
|
||||
--- a/processcore/CMakeLists.txt
|
||||
+++ b/processcore/CMakeLists.txt
|
||||
@@ -41,18 +41,18 @@ install( FILES processes.h process.h DESTINATION ${INCLUDE_INSTALL_DIR}/ksysguar
|
||||
#------ KAuth stuff
|
||||
|
||||
# Auth example helper
|
||||
-# set(ksysguardprocesslist_helper_srcs
|
||||
-# helper.cpp
|
||||
-# process.cpp
|
||||
-# processes_local_p.cpp
|
||||
-# processes_base_p.cpp)
|
||||
-#
|
||||
-# add_executable(ksysguardprocesslist_helper ${ksysguardprocesslist_helper_srcs})
|
||||
-# target_link_libraries(ksysguardprocesslist_helper )
|
||||
-# install(TARGETS ksysguardprocesslist_helper DESTINATION ${LIBEXEC_INSTALL_DIR})
|
||||
-#
|
||||
-# kauth_install_helper_files(ksysguardprocesslist_helper org.kde.ksysguard.processlisthelper root)
|
||||
-# kauth_install_actions(org.kde.ksysguard.processlisthelper actions.actions)
|
||||
-#
|
||||
-# set_target_properties(ksysguardprocesslist_helper PROPERTIES COMPILE_FLAGS "-Wall -ggdb")
|
||||
+set(ksysguardprocesslist_helper_srcs
|
||||
+ helper.cpp
|
||||
+ process.cpp
|
||||
+ processes_local_p.cpp
|
||||
+ processes_base_p.cpp)
|
||||
+
|
||||
+add_executable(ksysguardprocesslist_helper ${ksysguardprocesslist_helper_srcs})
|
||||
+target_link_libraries(ksysguardprocesslist_helper Qt5::Core KF5::Auth KF5::I18n)
|
||||
+install(TARGETS ksysguardprocesslist_helper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
|
||||
+
|
||||
+kauth_install_helper_files(ksysguardprocesslist_helper org.kde.ksysguard.processlisthelper root)
|
||||
+kauth_install_actions(org.kde.ksysguard.processlisthelper actions.actions)
|
||||
+
|
||||
+set_target_properties(ksysguardprocesslist_helper PROPERTIES COMPILE_FLAGS "-Wall -ggdb")
|
||||
|
||||
diff --git a/processcore/helper.cpp b/processcore/helper.cpp
|
||||
index 6c1f570..c34ab1e 100644
|
||||
--- a/processcore/helper.cpp
|
||||
+++ b/processcore/helper.cpp
|
||||
@@ -23,24 +23,26 @@
|
||||
#include "helper.h"
|
||||
#include "processes_local_p.h"
|
||||
|
||||
+using namespace KAuth;
|
||||
+
|
||||
KSysGuardProcessListHelper::KSysGuardProcessListHelper()
|
||||
{
|
||||
qRegisterMetaType<QList<long long> >();
|
||||
}
|
||||
|
||||
/* The functions here run as ROOT. So be careful. DO NOT TRUST THE INPUTS TO BE SANE. */
|
||||
-#define GET_PID(i) parameters.value(QString("pid%1").arg(i), -1).toULongLong(); if(pid < 0) return KAuth::ActionReply::HelperErrorReply;
|
||||
-KAuth::ActionReply KSysGuardProcessListHelper::sendsignal(QVariantMap parameters) {
|
||||
- KAuth::ActionReply errorReply(KAuth::ActionReply::HelperError);
|
||||
+#define GET_PID(i) parameters.value(QString("pid%1").arg(i), -1).toULongLong(); if(pid < 0) return ActionReply(ActionReply::HelperErrorType);
|
||||
+ActionReply KSysGuardProcessListHelper::sendsignal(QVariantMap parameters) {
|
||||
+ ActionReply reply(ActionReply::HelperErrorType);
|
||||
if(!parameters.contains("signal")) {
|
||||
- errorReply.setErrorDescription("Internal error - no signal parameter was passed to the helper");
|
||||
- errorReply.setErrorCode(1);
|
||||
- return errorReply;
|
||||
+ reply.setErrorDescription("Internal error - no signal parameter was passed to the helper");
|
||||
+ reply.setErrorCode(static_cast<ActionReply::Error>(1));
|
||||
+ return reply;
|
||||
}
|
||||
if(!parameters.contains("pidcount")) {
|
||||
- errorReply.setErrorDescription("Internal error - no pidcount parameter was passed to the helper");
|
||||
- errorReply.setErrorCode(2);
|
||||
- return errorReply;
|
||||
+ reply.setErrorDescription("Internal error - no pidcount parameter was passed to the helper");
|
||||
+ reply.setErrorCode(static_cast<ActionReply::Error>(2));
|
||||
+ return reply;
|
||||
}
|
||||
|
||||
KSysGuard::ProcessesLocal processes;
|
||||
@@ -56,17 +58,17 @@ KAuth::ActionReply KSysGuardProcessListHelper::sendsignal(QVariantMap parameters
|
||||
success = successForThisPid && success;
|
||||
}
|
||||
if(success) {
|
||||
- return KAuth::ActionReply::SuccessReply;
|
||||
+ return ActionReply::SuccessReply();
|
||||
} else {
|
||||
- errorReply.setErrorDescription(QString("Could not send signal to: ") + errorList.join(", "));
|
||||
- errorReply.setErrorCode(0);
|
||||
- return errorReply;
|
||||
+ reply.setErrorDescription(QString("Could not send signal to: ") + errorList.join(", "));
|
||||
+ reply.setErrorCode(static_cast<ActionReply::Error>(0));
|
||||
+ return reply;
|
||||
}
|
||||
}
|
||||
|
||||
-KAuth::ActionReply KSysGuardProcessListHelper::renice(QVariantMap parameters) {
|
||||
+ActionReply KSysGuardProcessListHelper::renice(QVariantMap parameters) {
|
||||
if(!parameters.contains("nicevalue") || !parameters.contains("pidcount"))
|
||||
- return KAuth::ActionReply::HelperErrorReply;
|
||||
+ return ActionReply(ActionReply::HelperErrorType);
|
||||
|
||||
KSysGuard::ProcessesLocal processes;
|
||||
int niceValue = qvariant_cast<int>(parameters.value("nicevalue"));
|
||||
@@ -77,14 +79,14 @@ KAuth::ActionReply KSysGuardProcessListHelper::renice(QVariantMap parameters) {
|
||||
success = processes.setNiceness(pid, niceValue) && success;
|
||||
}
|
||||
if(success)
|
||||
- return KAuth::ActionReply::SuccessReply;
|
||||
+ return ActionReply::SuccessReply();
|
||||
else
|
||||
- return KAuth::ActionReply::HelperErrorReply;
|
||||
+ return ActionReply(ActionReply::HelperErrorType);
|
||||
}
|
||||
|
||||
-KAuth::ActionReply KSysGuardProcessListHelper::changeioscheduler(QVariantMap parameters) {
|
||||
+ActionReply KSysGuardProcessListHelper::changeioscheduler(QVariantMap parameters) {
|
||||
if(!parameters.contains("ioScheduler") || !parameters.contains("ioSchedulerPriority") || !parameters.contains("pidcount"))
|
||||
- return KAuth::ActionReply::HelperErrorReply;
|
||||
+ return ActionReply(ActionReply::HelperErrorType);
|
||||
|
||||
KSysGuard::ProcessesLocal processes;
|
||||
int ioScheduler = qvariant_cast<int>(parameters.value("ioScheduler"));
|
||||
@@ -96,14 +98,14 @@ KAuth::ActionReply KSysGuardProcessListHelper::changeioscheduler(QVariantMap par
|
||||
success = processes.setIoNiceness(pid, ioScheduler, ioSchedulerPriority) && success;
|
||||
}
|
||||
if(success)
|
||||
- return KAuth::ActionReply::SuccessReply;
|
||||
+ return ActionReply::SuccessReply();
|
||||
else
|
||||
- return KAuth::ActionReply::HelperErrorReply;
|
||||
+ return ActionReply(ActionReply::HelperErrorType);
|
||||
|
||||
}
|
||||
-KAuth::ActionReply KSysGuardProcessListHelper::changecpuscheduler(QVariantMap parameters) {
|
||||
+ActionReply KSysGuardProcessListHelper::changecpuscheduler(QVariantMap parameters) {
|
||||
if(!parameters.contains("cpuScheduler") || !parameters.contains("cpuSchedulerPriority") || !parameters.contains("pidcount"))
|
||||
- return KAuth::ActionReply::HelperErrorReply;
|
||||
+ return ActionReply(ActionReply::HelperErrorType);
|
||||
|
||||
KSysGuard::ProcessesLocal processes;
|
||||
int cpuScheduler = qvariant_cast<int>(parameters.value("cpuScheduler"));
|
||||
@@ -116,9 +118,9 @@ KAuth::ActionReply KSysGuardProcessListHelper::changecpuscheduler(QVariantMap pa
|
||||
success = processes.setScheduler(pid, cpuScheduler, cpuSchedulerPriority) && success;
|
||||
}
|
||||
if(success)
|
||||
- return KAuth::ActionReply::SuccessReply;
|
||||
+ return ActionReply::SuccessReply();
|
||||
else
|
||||
- return KAuth::ActionReply::HelperErrorReply;
|
||||
+ return ActionReply(ActionReply::HelperErrorType);
|
||||
|
||||
}
|
||||
KAUTH_HELPER_MAIN("org.kde.ksysguard.processlisthelper", KSysGuardProcessListHelper)
|
||||
diff --git a/processcore/processes_linux_p.cpp b/processcore/processes_linux_p.cpp
|
||||
index 65b8dfd..0cff0e8 100644
|
||||
--- a/processcore/processes_linux_p.cpp
|
||||
+++ b/processcore/processes_linux_p.cpp
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "processes_local_p.h"
|
||||
#include "process.h"
|
||||
|
||||
-#include <klocale.h>
|
||||
+#include <klocalizedstring.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QHash>
|
||||
diff --git a/processui/ksysguardprocesslist.cpp b/processui/ksysguardprocesslist.cpp
|
||||
index 1651a0a..ba9d8c9 100644
|
||||
--- a/processui/ksysguardprocesslist.cpp
|
||||
+++ b/processui/ksysguardprocesslist.cpp
|
||||
@@ -48,6 +48,9 @@
|
||||
#include <signal.h> //For SIGTERM
|
||||
|
||||
#include <kauth.h>
|
||||
+#include <kauthaction.h>
|
||||
+#include <kauthactionreply.h>
|
||||
+#include <kauthobjectdecorator.h>
|
||||
#include <klocale.h>
|
||||
#include <kmessagebox.h>
|
||||
#include <kdialog.h>
|
||||
@@ -188,7 +191,7 @@ struct KSysGuardProcessListPrivate {
|
||||
int totalRowCount(const QModelIndex &parent) const;
|
||||
|
||||
/** Helper function to setup 'action' with the given pids */
|
||||
- void setupKAuthAction(KAuth::Action *action, const QList<long long> & pids) const;
|
||||
+ void setupKAuthAction(KAuth::Action &action, const QList<long long> & pids) const;
|
||||
|
||||
/** fire a timer event if we are set to use our internal timer*/
|
||||
void fireTimerEvent();
|
||||
@@ -392,15 +395,15 @@ int KSysGuardProcessListPrivate::totalRowCount(const QModelIndex &parent ) const
|
||||
return total;
|
||||
}
|
||||
|
||||
-void KSysGuardProcessListPrivate::setupKAuthAction(KAuth::Action *action, const QList<long long> & pids) const
|
||||
+void KSysGuardProcessListPrivate::setupKAuthAction(KAuth::Action &action, const QList<long long> & pids) const
|
||||
{
|
||||
- action->setHelperId("org.kde.ksysguard.processlisthelper");
|
||||
+ action.setHelperId("org.kde.ksysguard.processlisthelper");
|
||||
|
||||
int processCount = pids.count();
|
||||
for(int i = 0; i < processCount; i++) {
|
||||
- action->addArgument(QString("pid%1").arg(i), pids[i]);
|
||||
+ action.addArgument(QString("pid%1").arg(i), pids[i]);
|
||||
}
|
||||
- action->addArgument("pidcount", processCount);
|
||||
+ action.addArgument("pidcount", processCount);
|
||||
}
|
||||
void KSysGuardProcessList::selectionChanged()
|
||||
{
|
||||
@@ -1023,23 +1026,19 @@ bool KSysGuardProcessList::reniceProcesses(const QList<long long> &pids, int nic
|
||||
|
||||
|
||||
#warning KAuth needs porting, but docu is not adjusted, no idea how to do it
|
||||
-#if 0
|
||||
- KAuth::Action *action = new KAuth::Action("org.kde.ksysguard.processlisthelper.renice");
|
||||
- action->setParentWidget(window());
|
||||
+ KAuth::Action action("org.kde.ksysguard.processlisthelper.renice");
|
||||
+ action.setParentWidget(window());
|
||||
d->setupKAuthAction( action, unreniced_pids);
|
||||
- action->addArgument("nicevalue", niceValue);
|
||||
- KAuth::ActionReply reply = action->execute();
|
||||
+ action.addArgument("nicevalue", niceValue);
|
||||
+ KAuth::ExecuteJob *job = action.execute();
|
||||
|
||||
- if (reply == KAuth::ActionReply::SuccessReply) {
|
||||
+ if (job->exec()) {
|
||||
updateList();
|
||||
- delete action;
|
||||
- } else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) {
|
||||
+ } else if (!job->exec()) {
|
||||
KMessageBox::sorry(this, i18n("You do not have the permission to renice the process and there "
|
||||
- "was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription()));
|
||||
- delete action;
|
||||
+ "was a problem trying to run as root. Error %1 %2", job->error(), job->errorString()));
|
||||
return false;
|
||||
}
|
||||
-#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1189,26 +1188,22 @@ bool KSysGuardProcessList::changeIoScheduler(const QList< long long> &pids, KSys
|
||||
if(!d->mModel.isLocalhost()) return false; //We can't use kauth to affect non-localhost processes
|
||||
|
||||
#warning KAuth needs porting, but docu is not adjusted, no idea how to do it
|
||||
-#if 0
|
||||
- KAuth::Action *action = new KAuth::Action("org.kde.ksysguard.processlisthelper.changeioscheduler");
|
||||
- action->setParentWidget(window());
|
||||
+ KAuth::Action action("org.kde.ksysguard.processlisthelper.changeioscheduler");
|
||||
+ action.setParentWidget(window());
|
||||
|
||||
d->setupKAuthAction( action, unchanged_pids);
|
||||
- action->addArgument("ioScheduler", (int)newIoSched);
|
||||
- action->addArgument("ioSchedulerPriority", newIoSchedPriority);
|
||||
+ action.addArgument("ioScheduler", (int)newIoSched);
|
||||
+ action.addArgument("ioSchedulerPriority", newIoSchedPriority);
|
||||
|
||||
- KAuth::ActionReply reply = action->execute();
|
||||
+ KAuth::ExecuteJob *job = action.execute();
|
||||
|
||||
- if (reply == KAuth::ActionReply::SuccessReply) {
|
||||
+ if (job->exec()) {
|
||||
updateList();
|
||||
- delete action;
|
||||
- } else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) {
|
||||
+ } else if (!job->exec()) {
|
||||
KMessageBox::sorry(this, i18n("You do not have the permission to change the I/O priority of the process and there "
|
||||
- "was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription()));
|
||||
- delete action;
|
||||
+ "was a problem trying to run as root. Error %1 %2", job->error(), job->errorString()));
|
||||
return false;
|
||||
}
|
||||
-#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1226,24 +1221,20 @@ bool KSysGuardProcessList::changeCpuScheduler(const QList< long long> &pids, KSy
|
||||
if(!d->mModel.isLocalhost()) return false; //We can't use KAuth to affect non-localhost processes
|
||||
|
||||
#warning KAuth needs porting, but docu is not adjusted, no idea how to do it
|
||||
-#if 0
|
||||
- KAuth::Action *action = new KAuth::Action("org.kde.ksysguard.processlisthelper.changecpuscheduler");
|
||||
- action->setParentWidget(window());
|
||||
+ KAuth::Action action("org.kde.ksysguard.processlisthelper.changecpuscheduler");
|
||||
+ action.setParentWidget(window());
|
||||
d->setupKAuthAction( action, unchanged_pids);
|
||||
- action->addArgument("cpuScheduler", (int)newCpuSched);
|
||||
- action->addArgument("cpuSchedulerPriority", newCpuSchedPriority);
|
||||
- KAuth::ActionReply reply = action->execute();
|
||||
+ action.addArgument("cpuScheduler", (int)newCpuSched);
|
||||
+ action.addArgument("cpuSchedulerPriority", newCpuSchedPriority);
|
||||
+ KAuth::ExecuteJob *job = action.execute();
|
||||
|
||||
- if (reply == KAuth::ActionReply::SuccessReply) {
|
||||
+ if (job->exec()) {
|
||||
updateList();
|
||||
- delete action;
|
||||
- } else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) {
|
||||
+ } else if (!job->exec()) {
|
||||
KMessageBox::sorry(this, i18n("You do not have the permission to change the CPU Scheduler for the process and there "
|
||||
- "was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription()));
|
||||
- delete action;
|
||||
+ "was a problem trying to run as root. Error %1 %2", job->error(), job->errorString()));
|
||||
return false;
|
||||
}
|
||||
-#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1262,26 +1253,20 @@ bool KSysGuardProcessList::killProcesses(const QList< long long> &pids, int sig)
|
||||
if(!d->mModel.isLocalhost()) return false; //We can't elevate privileges to kill non-localhost processes
|
||||
|
||||
#warning KAuth needs porting, but docu is not adjusted, no idea how to do it
|
||||
-#if 0
|
||||
KAuth::Action action("org.kde.ksysguard.processlisthelper.sendsignal");
|
||||
action.setParentWidget(window());
|
||||
- d->setupKAuthAction( &action, unkilled_pids);
|
||||
+ //action.setHelperId("org.kde.ksysguard.processlisthelper");
|
||||
+ d->setupKAuthAction( action, unkilled_pids);
|
||||
action.addArgument("signal", sig);
|
||||
- KAuth::ActionReply reply = action.execute();
|
||||
+ KAuth::ExecuteJob *job = action.execute();
|
||||
|
||||
- if (reply == KAuth::ActionReply::SuccessReply) {
|
||||
+ if (job->exec()) {
|
||||
updateList();
|
||||
- } else if (reply.type() == KAuth::ActionReply::HelperError) {
|
||||
- if (reply.errorCode() > 0)
|
||||
- KMessageBox::sorry(this, i18n("You do not have the permission to kill the process and there "
|
||||
- "was a problem trying to run as root. %1", reply.errorDescription()));
|
||||
- return false;
|
||||
- } else if (reply != KAuth::ActionReply::UserCancelled && reply != KAuth::ActionReply::AuthorizationDenied) {
|
||||
+ } else if (!job->exec()) {
|
||||
KMessageBox::sorry(this, i18n("You do not have the permission to kill the process and there "
|
||||
- "was a problem trying to run as root. Error %1 %2", reply.errorCode(), reply.errorDescription()));
|
||||
+ "was a problem trying to run as root. Error %1 %2", job->error(), job->errorString()));
|
||||
return false;
|
||||
}
|
||||
-#endif
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user