~ubuntu-desktop/gvfs/ubuntu

« back to all changes in this revision

Viewing changes to debian/patches/04_dont_automount_internal_partitions.patch

  • Committer: Martin Pitt
  • Date: 2010-03-23 20:00:29 UTC
  • Revision ID: martin.pitt@canonical.com-20100323200029-7bl7ok6wefwvpuuh
abandon branch in favor of lp:ubuntu/gvfs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 771b1d897212f365f256e74bcb5106d096bc2aab Mon Sep 17 00:00:00 2001
2
 
From: Martin Pitt <martin.pitt@ubuntu.com>
3
 
Date: Mon, 19 Oct 2009 13:36:50 +0200
4
 
Subject: [PATCH 3/3] =?utf-8?q?Bug=20598914=20=E2=80=94=20Attempts=20to=20automount=20internal=20partitions?=
5
 
MIME-Version: 1.0
6
 
Content-Type: text/plain; charset=utf-8
7
 
Content-Transfer-Encoding: 8bit
8
 
 
9
 
On a live system, where the user does not have a password, internal partitions
10
 
often get automounted. This is not quite desirable, since a live system isn't
11
 
supposed to modify your system (at least not automatically).
12
 
 
13
 
Disable automounting for system internal drives to fix this.
14
 
 
15
 
For real installed systems this does not actually change behaviour, since
16
 
internal drives require polkit authorization, and all drives which do are not
17
 
automounted at nautilus startup anyway.
18
 
---
19
 
 monitor/gdu/ggduvolume.c |   17 +++++++++++------
20
 
 1 files changed, 11 insertions(+), 6 deletions(-)
21
 
 
22
 
Index: gvfs-1.5.2/monitor/gdu/ggduvolume.c
23
 
===================================================================
24
 
--- gvfs-1.5.2.orig/monitor/gdu/ggduvolume.c    2009-12-14 09:31:09.000000000 +0100
25
 
+++ gvfs-1.5.2/monitor/gdu/ggduvolume.c 2010-01-26 13:25:47.593988736 +0100
26
 
@@ -368,42 +368,47 @@
27
 
        *          automount all mountable devices from the box. See
28
 
        *          the enterprise distro bug trackers for details.
29
 
        */
30
 
-      volume->should_automount = FALSE;
31
 
-      if (volume->drive != NULL)
32
 
-        {
33
 
-          GduPresentable *drive_presentable;
34
 
-          drive_presentable = g_gdu_drive_get_presentable (volume->drive);
35
 
-          if (drive_presentable != NULL)
36
 
+      if (gdu_device_is_system_internal (device))
37
 
+         volume->should_automount = FALSE;
38
 
+      else
39
 
+         {
40
 
+          volume->should_automount = FALSE;
41
 
+          if (volume->drive != NULL)
42
 
             {
43
 
-              GduDevice *drive_device;
44
 
-              drive_device = gdu_presentable_get_device (drive_presentable);
45
 
-              if (drive_device != NULL)
46
 
+              GduPresentable *drive_presentable;
47
 
+              drive_presentable = g_gdu_drive_get_presentable (volume->drive);
48
 
+              if (drive_presentable != NULL)
49
 
                 {
50
 
-                  if (gdu_device_is_drive (drive_device))
51
 
+                  GduDevice *drive_device;
52
 
+                  drive_device = gdu_presentable_get_device (drive_presentable);
53
 
+                  if (drive_device != NULL)
54
 
                     {
55
 
-                      const gchar *connection_interface;
56
 
+                      if (gdu_device_is_drive (drive_device))
57
 
+                        {
58
 
+                          const gchar *connection_interface;
59
 
 
60
 
-                      connection_interface = gdu_device_drive_get_connection_interface (drive_device);
61
 
+                          connection_interface = gdu_device_drive_get_connection_interface (drive_device);
62
 
 
63
 
-                      if (g_strcmp0 (connection_interface, "usb") == 0 ||
64
 
-                          g_strcmp0 (connection_interface, "firewire") == 0 ||
65
 
-                          g_strcmp0 (connection_interface, "sdio") == 0 ||
66
 
-                          gdu_device_is_optical_disc (drive_device))
67
 
-                        {
68
 
-                          volume->should_automount = TRUE;
69
 
+                          if (g_strcmp0 (connection_interface, "usb") == 0 ||
70
 
+                              g_strcmp0 (connection_interface, "firewire") == 0 ||
71
 
+                              g_strcmp0 (connection_interface, "sdio") == 0 ||
72
 
+                              gdu_device_is_optical_disc (drive_device))
73
 
+                            {
74
 
+                              volume->should_automount = TRUE;
75
 
+                            }
76
 
                         }
77
 
+                      g_object_unref (drive_device);
78
 
                     }
79
 
-                  g_object_unref (drive_device);
80
 
                 }
81
 
-            }
82
 
 
83
 
-          /* If a volume (partition) appear _much later_ than when media was inserted it
84
 
-           * can only be because the media was repartitioned. We don't want to automount
85
 
-           * such volumes.
86
 
-           */
87
 
-          now = time (NULL);
88
 
-          if (now - g_gdu_drive_get_time_of_last_media_insertion (volume->drive) > 5)
89
 
-            volume->should_automount = FALSE;
90
 
+              /* If a volume (partition) appear _much later_ than when media was inserted it
91
 
+               * can only be because the media was repartitioned. We don't want to automount
92
 
+               * such volumes.
93
 
+               */
94
 
+              now = time (NULL);
95
 
+              if (now - g_gdu_drive_get_time_of_last_media_insertion (volume->drive) > 5)
96
 
+                volume->should_automount = FALSE;
97
 
+            }
98
 
         }
99
 
 
100
 
       /* Respect the presentation hint for whether the volume should be automounted - normally