rpms/kdelibs/devel kdelibs-4.0.2-policykit-workaround.patch, NONE, 1.1 kdelibs.spec, 1.294, 1.295
Than Ngo (than)
fedora-extras-commits at redhat.com
Thu Mar 27 11:19:53 UTC 2008
Author: than
Update of /cvs/extras/rpms/kdelibs/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6576
Modified Files:
kdelibs.spec
Added Files:
kdelibs-4.0.2-policykit-workaround.patch
Log Message:
bz#428212, adapted Kevin Kofler's workaround for Policykit
kdelibs-4.0.2-policykit-workaround.patch:
--- NEW FILE kdelibs-4.0.2-policykit-workaround.patch ---
diff -ur kdelibs-4.0.2/solid/solid/backends/hal/halstorageaccess.cpp kdelibs-4.0.2-userdiskmount/solid/solid/backends/hal/halstorageaccess.cpp
--- kdelibs-4.0.2/solid/solid/backends/hal/halstorageaccess.cpp 2008-01-05 01:00:10.000000000 +0100
+++ kdelibs-4.0.2-userdiskmount/solid/solid/backends/hal/halstorageaccess.cpp 2008-03-18 11:00:40.000000000 +0100
@@ -20,6 +20,7 @@
#include "halstorageaccess.h"
#include <QtCore/QDebug>
+#include <QtCore/QProcess>
#include <QtDBus/QDBusConnection>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusReply>
@@ -131,11 +132,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,
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,
error.name()+": "+error.message(),
@@ -229,8 +240,10 @@
"Mount");
QStringList options;
QStringList halOptions = m_device->property("volume.mount.valid_options").toStringList();
+ QString fstype = m_device->property("volume.fstype").toString();
- if (halOptions.contains("uid=")) {
+ if (halOptions.contains("uid=")
+ && (fstype == "vfat" || fstype == "iso9660" || fstype == "hfs" || fstype == "udf")) {
options << "uid="+QString::number(::getuid());
}
@@ -256,6 +269,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 Solid::Backends::Hal::StorageAccess::callSystemMount()
{
const QString device = m_device->property("block.device").toString();
diff -ur kdelibs-4.0.2/solid/solid/backends/hal/halstorageaccess.h kdelibs-4.0.2-userdiskmount/solid/solid/backends/hal/halstorageaccess.h
--- kdelibs-4.0.2/solid/solid/backends/hal/halstorageaccess.h 2008-01-05 01:00:11.000000000 +0100
+++ kdelibs-4.0.2-userdiskmount/solid/solid/backends/hal/halstorageaccess.h 2008-03-18 09:26:39.000000000 +0100
@@ -69,6 +69,9 @@
bool callSystemMount();
bool callSystemUnmount();
+ bool callPrivilegedMount();
+ bool callPrivilegedUnmount();
+
bool requestPassphrase();
void callCryptoSetup(const QString &passphrase);
bool callCryptoTeardown();
diff -up kdelibs-4.0.2/solid/solid/backends/hal/halstorageaccess.cpp.orig kdelibs-4.0.2/solid/solid/backends/hal/halstorageaccess.cpp
--- kdelibs-4.0.2/solid/solid/backends/hal/halstorageaccess.cpp.orig 2008-03-26 17:00:23.000000000 +0100
+++ kdelibs-4.0.2/solid/solid/backends/hal/halstorageaccess.cpp 2008-03-26 17:04:35.000000000 +0100
@@ -17,6 +17,8 @@
*/
+#include <config-prefix.h> // for LIBEXEC_INSTALL_DIR
+
#include "halstorageaccess.h"
#include <QtCore/QDebug>
Index: kdelibs.spec
===================================================================
RCS file: /cvs/extras/rpms/kdelibs/devel/kdelibs.spec,v
retrieving revision 1.294
retrieving revision 1.295
diff -u -r1.294 -r1.295
--- kdelibs.spec 26 Mar 2008 17:36:58 -0000 1.294
+++ kdelibs.spec 27 Mar 2008 11:19:11 -0000 1.295
@@ -1,7 +1,7 @@
Summary: K Desktop Environment 4 - Libraries
Version: 4.0.2
-Release: 11%{?dist}
+Release: 12%{?dist}
%if 0%{?fedora} > 8
Name: kdelibs
@@ -72,6 +72,8 @@
# don't cache kdeglobals paths because they change after profile directories
# are loaded from kde4rc
Patch10: kdelibs-4.0.2-no-cache-kdeglobals-paths.patch
+# workaround for policykit
+Patch11: kdelibs-4.0.2-policykit-workaround.patch
# upstream patches
Patch100: kdelibs-4.0.x-kio.patch
@@ -188,6 +190,7 @@
%patch9 -p1 -b .branding
sed -i -e "s|@@VERSION_RELEASE@@|%{version}-%{release}|" kio/kio/kprotocolmanager.cpp
%patch10 -p1 -b .no-cache-kdeglobals-paths
+%patch11 -p1 -b .policykit
# upstream patches
%patch100 -p1 -b .kio
@@ -350,6 +353,9 @@
%changelog
+* Thu Mar 27 2008 Than Ngo <than at redhat.com> 4.0.2-12
+- bz#428212, adapted Kevin Kofler's workaround for Policykit
+
* Thu Mar 20 2008 Rex Dieter <rdieter at fedoraproject.org> 4.0.2-11
- apidocs subpackage should be noarch (#436579)
More information about the fedora-extras-commits
mailing list