rpms/kdelibs/F-9 kdelibs-4.1.3-policykit-workaround.patch, NONE, 1.1 kdelibs.spec, 1.366, 1.367 kdelibs-4.0.2-policykit-workaround.patch, 1.2, NONE

Kevin Kofler kkofler at fedoraproject.org
Mon Dec 8 01:12:54 UTC 2008


Author: kkofler

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

Modified Files:
	kdelibs.spec 
Added Files:
	kdelibs-4.1.3-policykit-workaround.patch 
Removed Files:
	kdelibs-4.0.2-policykit-workaround.patch 
Log Message:
* Mon Dec 08 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.1.3-4
- restore NTFS workaround which accidentally got dropped in the 4.1.3 update

kdelibs-4.1.3-policykit-workaround.patch:

--- NEW FILE kdelibs-4.1.3-policykit-workaround.patch ---
diff -ur kdelibs-4.1.3/solid/solid/backends/hal/halstorageaccess.cpp kdelibs-4.1.3-policykit-workaround/solid/solid/backends/hal/halstorageaccess.cpp
--- kdelibs-4.1.3/solid/solid/backends/hal/halstorageaccess.cpp	2008-10-30 14:24:05.000000000 +0100
+++ kdelibs-4.1.3-policykit-workaround/solid/solid/backends/hal/halstorageaccess.cpp	2008-12-08 02:07:20.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(),
@@ -241,7 +254,8 @@
 #else
     QString uid="uid=";
 #endif
-    if (halOptions.contains(uid)) {
+    if (halOptions.contains(uid)
+        && (fstype == "vfat" || fstype == "iso9660" || fstype == "hfs" || fstype == "udf")) {
         options << uid+QString::number(::getuid());
     }
 
@@ -297,6 +311,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.1.3/solid/solid/backends/hal/halstorageaccess.h kdelibs-4.1.3-policykit-workaround/solid/solid/backends/hal/halstorageaccess.h
--- kdelibs-4.1.3/solid/solid/backends/hal/halstorageaccess.h	2008-05-21 13:07:38.000000000 +0200
+++ kdelibs-4.1.3-policykit-workaround/solid/solid/backends/hal/halstorageaccess.h	2008-12-08 02:05:21.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/pkgs/rpms/kdelibs/F-9/kdelibs.spec,v
retrieving revision 1.366
retrieving revision 1.367
diff -u -r1.366 -r1.367
--- kdelibs.spec	20 Nov 2008 18:22:53 -0000	1.366
+++ kdelibs.spec	8 Dec 2008 01:12:23 -0000	1.367
@@ -2,7 +2,7 @@
 
 Summary: K Desktop Environment 4 - Libraries
 Version: 4.1.3
-Release: 3%{?dist}
+Release: 4%{?dist}
 
 %if 0%{?fedora} > 8
 Name: kdelibs
@@ -68,8 +68,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
+# workarounds for policykit and NTFS
+Patch11: kdelibs-4.1.3-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
@@ -368,6 +368,9 @@
 
 
 %changelog
+* Mon Dec 08 2008 Kevin Kofler <Kevin at tigcc.ticalc.org> 4.1.3-4
+- restore NTFS workaround which accidentally got dropped in the 4.1.3 update
+
 * Thu Nov 20 2008 Rex Dieter <rdieter at fedoraproject.org> 4.1.3-3
 - unmess Utilities menu (kdebug:161117)
 


--- kdelibs-4.0.2-policykit-workaround.patch DELETED ---




More information about the fedora-extras-commits mailing list