rpms/kdelibs/devel kdelibs-4.3.80-policykit-workaround.patch, NONE, 1.1 kdelibs.spec, 1.542, 1.543 kdelibs-4.3.75-policykit-workaround.patch, 1.1, NONE
Kevin Kofler
kkofler at fedoraproject.org
Thu Dec 3 02:52:58 UTC 2009
Author: kkofler
Update of /cvs/pkgs/rpms/kdelibs/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv12295/devel
Modified Files:
kdelibs.spec
Added Files:
kdelibs-4.3.80-policykit-workaround.patch
Removed Files:
kdelibs-4.3.75-policykit-workaround.patch
Log Message:
Rediff policykit-workaround patch.
kdelibs-4.3.80-policykit-workaround.patch:
halstorageaccess.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++++++--
halstorageaccess.h | 3 ++
2 files changed, 71 insertions(+), 2 deletions(-)
--- NEW FILE kdelibs-4.3.80-policykit-workaround.patch ---
diff -ur kdelibs-4.3.80/solid/solid/backends/hal/halstorageaccess.cpp kdelibs-4.3.80-policykit-workaround/solid/solid/backends/hal/halstorageaccess.cpp
--- kdelibs-4.3.80/solid/solid/backends/hal/halstorageaccess.cpp 2009-12-01 01:27:28.000000000 +0100
+++ kdelibs-4.3.80-policykit-workaround/solid/solid/backends/hal/halstorageaccess.cpp 2009-12-03 03:49:55.000000000 +0100
@@ -17,6 +17,8 @@
*/
+#include <config-prefix.h> // for LIBEXEC_INSTALL_DIR
+
#include "halstorageaccess.h"
#include "halfstabhandling.h"
@@ -177,11 +179,21 @@
{
// TODO: Better error reporting here
if (m_setupInProgress) {
+ if (error.name() == "org.freedesktop.Hal.Device.PermissionDeniedByPolicy") {
+ if (callPrivilegedMount())
+ return;
+ // if we fail to run kdesu, fall through and emit the original PermissionDeniedByPolicy error
+ }
m_setupInProgress = false;
emit setupDone(Solid::UnauthorizedOperation,
QString(error.name()+": "+error.message()),
m_device->udi());
} else if (m_teardownInProgress) {
+ if (error.name() == "org.freedesktop.Hal.Device.PermissionDeniedByPolicy") {
+ if (callPrivilegedUnmount())
+ return;
+ // if we fail to run kdesu, fall through and emit the original PermissionDeniedByPolicy error
+ }
m_teardownInProgress = false;
emit teardownDone(Solid::UnauthorizedOperation,
QString(error.name()+": "+error.message()),
@@ -311,8 +323,9 @@
#else
QString uid="uid=";
#endif
- if (halOptions.contains(uid)) {
- options << uid+QString::number(::getuid());
+ if (halOptions.contains(uid) &&
+ (fstype == "vfat" || fstype == "iso9660" || fstype == "hfs" || fstype == "udf")) {
+ options << uid+QString::number(::getuid());
}
#ifdef Q_OS_FREEBSD
@@ -354,6 +367,59 @@
SLOT(slotDBusError(const QDBusError &)));
}
+bool Solid::Backends::Hal::StorageAccess::callPrivilegedMount()
+{
+ QString udi = m_device->udi();
+ QString options;
+ QStringList halOptions = m_device->property("volume.mount.valid_options").toStringList();
+ QString fstype = m_device->property("volume.fstype").toString();
+
+ if (halOptions.contains("uid=")
+ && (fstype == "vfat" || fstype == "iso9660" || fstype == "hfs" || fstype == "udf")) {
+ options = "uid="+QString::number(::getuid());
+ }
+
+ m_process = new QProcess(this);
+
+ connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(slotProcessFinished(int, QProcess::ExitStatus)));
+
+ m_process->start(LIBEXEC_INSTALL_DIR "/kdesu", QStringList() << "-d" << "-t"
+ << "--noignorebutton" << "-c"
+ << QString::fromLatin1("dbus-send --system --print-reply --dest=org.freedesktop.Hal %1 "
+ "org.freedesktop.Hal.Device.Volume.Mount string: string: "
+ "array:string:%2").arg(udi).arg(options));
+
+ if (m_process->waitForStarted()) {
+ return true;
+ } else {
+ delete m_process;
+ return false;
+ }
+}
+
+bool Solid::Backends::Hal::StorageAccess::callPrivilegedUnmount()
+{
+ QString udi = m_device->udi();
+
+ m_process = new QProcess(this);
+
+ connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(slotProcessFinished(int, QProcess::ExitStatus)));
+
+ m_process->start(LIBEXEC_INSTALL_DIR "/kdesu", QStringList() << "-d" << "-t"
+ << "--noignorebutton" << "-c"
+ << QString::fromLatin1("dbus-send --system --print-reply --dest=org.freedesktop.Hal %1 "
+ "org.freedesktop.Hal.Device.Volume.Unmount array:string:").arg(udi));
+
+ if (m_process->waitForStarted()) {
+ return true;
+ } else {
+ delete m_process;
+ return false;
+ }
+}
+
bool StorageAccess::callHalVolumeUnmount()
{
QDBusConnection c = QDBusConnection::systemBus();
diff -ur kdelibs-4.3.80/solid/solid/backends/hal/halstorageaccess.h kdelibs-4.3.80-policykit-workaround/solid/solid/backends/hal/halstorageaccess.h
--- kdelibs-4.3.80/solid/solid/backends/hal/halstorageaccess.h 2009-12-01 01:27:28.000000000 +0100
+++ kdelibs-4.3.80-policykit-workaround/solid/solid/backends/hal/halstorageaccess.h 2009-12-03 03:49:55.000000000 +0100
@@ -70,6 +70,9 @@
bool callSystemMount();
bool callSystemUnmount();
+ bool callPrivilegedMount();
+ bool callPrivilegedUnmount();
+
bool requestPassphrase();
void callCryptoSetup(const QString &passphrase);
bool callCryptoTeardown();
Index: kdelibs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdelibs/devel/kdelibs.spec,v
retrieving revision 1.542
retrieving revision 1.543
diff -u -p -r1.542 -r1.543
--- kdelibs.spec 2 Dec 2009 06:22:29 -0000 1.542
+++ kdelibs.spec 3 Dec 2009 02:52:58 -0000 1.543
@@ -69,7 +69,7 @@ Patch9: kdelibs-4.0.2-branding.patch
# are loaded from kde4rc
Patch10: kdelibs-4.1.72-no-cache-kdeglobals-paths.patch
# workaround for policykit
-Patch11: kdelibs-4.3.75-policykit-workaround.patch
+Patch11: kdelibs-4.3.80-policykit-workaround.patch
Patch12: kdelibs-4.1.0-xdg-menu.patch
# patch KStandardDirs to use %{_libexecdir}/kde4 instead of %{_libdir}/kde4/libexec
Patch14: kdelibs-4.2.85-libexecdir.patch
--- kdelibs-4.3.75-policykit-workaround.patch DELETED ---
More information about the scm-commits
mailing list