1
From e57f8698b52a9eaf5c848b5f5e27af3eee80b7b9 Mon Sep 17 00:00:00 2001
2
From: David Zeuthen <davidz@redhat.com>
3
Date: Mon, 17 Aug 2009 20:48:09 +0000
4
Subject: Bug 22914 – Require password to eject a CD or DVD mounted by the same user
6
Apparently this got messed up in the port to polkit1.
8
diff --git a/src/devkit-disks-device.c b/src/devkit-disks-device.c
9
index 06898c0..dac22e7 100644
10
--- a/src/devkit-disks-device.c
11
+++ b/src/devkit-disks-device.c
12
@@ -4853,6 +4853,8 @@ devkit_disks_device_filesystem_unmount_authorized_cb (DevkitDisksDaemon *dae
14
gboolean force_unmount;
21
@@ -4877,10 +4879,10 @@ devkit_disks_device_filesystem_unmount_authorized_cb (DevkitDisksDaemon *dae
25
+ devkit_disks_daemon_local_get_uid (device->priv->daemon, &uid, context);
26
+ g_snprintf (uid_buf, sizeof uid_buf, "%d", uid);
28
if (!devkit_disks_mount_file_has_device (device->priv->device_file, NULL, NULL)) {
29
- /* Check if the device is referenced in /etc/fstab; if so, attempt to
30
- * unmount the device as uid 0 (since the user has acquired .unmount-others already)
32
if (is_device_in_fstab (device, &mount_path)) {
35
@@ -4890,10 +4892,14 @@ devkit_disks_device_filesystem_unmount_authorized_cb (DevkitDisksDaemon *dae
37
argv[n++] = "unmount";
38
argv[n++] = device->priv->device_file;
40
+ argv[n++] = uid_buf;
45
+ /* otherwise the user will have the .unmount-others authorization per the logic in
46
+ * devkit_disks_device_filesystem_unmount()
50
mount_path = g_strdup (((gchar **) device->priv->device_mount_paths->pdata)[0]);
51
@@ -4930,9 +4936,8 @@ devkit_disks_device_filesystem_unmount (DevkitDisksDevice *device,
53
DBusGMethodInvocation *context)
57
const gchar *action_id;
60
if (!device->priv->device_is_mounted ||
61
device->priv->device_mount_paths->len == 0) {
62
@@ -4942,15 +4947,18 @@ devkit_disks_device_filesystem_unmount (DevkitDisksDevice *device,
66
+ /* if device is in /etc/fstab, then we'll run unmount as the calling user */
68
if (!devkit_disks_mount_file_has_device (device->priv->device_file, &uid_of_mount, NULL)) {
72
- devkit_disks_daemon_local_get_uid (device->priv->daemon, &uid, context);
73
- if (uid_of_mount != uid) {
74
- action_id = "org.freedesktop.devicekit.disks.filesystem-unmount-others";
75
+ if (!is_device_in_fstab (device, NULL)) {
76
+ action_id = "org.freedesktop.devicekit.disks.filesystem-unmount-others";
81
+ devkit_disks_daemon_local_get_uid (device->priv->daemon, &uid, context);
82
+ if (uid_of_mount != uid) {
83
+ action_id = "org.freedesktop.devicekit.disks.filesystem-unmount-others";
87
devkit_disks_daemon_local_check_auth (device->priv->daemon,