rpms/kdelibs/F-9 kdelibs-4.1.4-policykit-workaround.patch, NONE, 1.1 kdelibs.spec, 1.368, 1.369 kdelibs-4.1.3-policykit-workaround.patch, 1.2, NONE

Lukas Tinkl ltinkl at fedoraproject.org
Wed Jan 7 14:35:06 UTC 2009


Author: ltinkl

Update of /cvs/extras/rpms/kdelibs/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv17443

Modified Files:
	kdelibs.spec 
Added Files:
	kdelibs-4.1.4-policykit-workaround.patch 
Removed Files:
	kdelibs-4.1.3-policykit-workaround.patch 
Log Message:
fix PolicyKit patch


kdelibs-4.1.4-policykit-workaround.patch:

--- NEW FILE kdelibs-4.1.4-policykit-workaround.patch ---
Pouze v kdelibs-4.1.4: kdelibs-4.1.3-policykit-workaround.patch
diff -ur kdelibs-orig/solid/solid/backends/hal/halstorageaccess.cpp kdelibs-4.1.4/solid/solid/backends/hal/halstorageaccess.cpp
--- kdelibs-orig/solid/solid/backends/hal/halstorageaccess.cpp	2009-01-07 00:34:55.000000000 +0100
+++ kdelibs-4.1.4/solid/solid/backends/hal/halstorageaccess.cpp	2009-01-07 15:26:27.000000000 +0100
@@ -17,10 +17,13 @@
 
 */
 
+#include <config-prefix.h> // for LIBEXEC_INSTALL_DIR
+
 #include "halstorageaccess.h"
 
 #include <QtCore/QLocale>
 #include <QtCore/QDebug>
+#include <QtCore/QProcess>
 #include <QtDBus/QDBusConnection>
 #include <QtDBus/QDBusInterface>
 #include <QtDBus/QDBusReply>
@@ -137,11 +140,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(),
@@ -314,6 +327,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-orig/solid/solid/backends/hal/halstorageaccess.h kdelibs-4.1.4/solid/solid/backends/hal/halstorageaccess.h
--- kdelibs-orig/solid/solid/backends/hal/halstorageaccess.h	2009-01-07 00:34:55.000000000 +0100
+++ kdelibs-4.1.4/solid/solid/backends/hal/halstorageaccess.h	2009-01-07 15:26:27.000000000 +0100
@@ -69,6 +69,9 @@
     bool callSystemMount();
     bool callSystemUnmount();
 
+    bool callPrivilegedMount();
+    bool callPrivilegedUnmount();
+
     bool requestPassphrase();
     void callCryptoSetup(const QString &passphrase);
     bool callCryptoTeardown();


Index: kdelibs.spec
===================================================================
RCS file: /cvs/extras/rpms/kdelibs/F-9/kdelibs.spec,v
retrieving revision 1.368
retrieving revision 1.369
diff -u -r1.368 -r1.369
--- kdelibs.spec	7 Jan 2009 12:29:00 -0000	1.368
+++ kdelibs.spec	7 Jan 2009 14:34:36 -0000	1.369
@@ -69,7 +69,7 @@
 # are loaded from kde4rc
 Patch10: kdelibs-4.0.2-no-cache-kdeglobals-paths.patch
 # workarounds for policykit and NTFS
-Patch11: kdelibs-4.1.3-policykit-workaround.patch
+Patch11: kdelibs-4.1.4-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.0.85-libexecdir.patch


--- kdelibs-4.1.3-policykit-workaround.patch DELETED ---




More information about the fedora-extras-commits mailing list