don't mount interactively during login

This commit is contained in:
Matthias Clasen 2009-08-27 02:45:16 +00:00
parent 7099b075a5
commit dccc590e63
2 changed files with 137 additions and 2 deletions

View File

@ -0,0 +1,129 @@
diff --git a/configure.ac b/configure.ac
index 9bfb8ad..887cf95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -236,7 +236,7 @@ AC_ARG_ENABLE(gdu, [ --disable-gdu build without GDU volume monitor])
msg_gdu=no
GDU_LIBS=
GDU_CFLAGS=
-GDU_REQUIRED=0.4
+GDU_REQUIRED=0.5
if test "x$enable_gdu" != "xno"; then
PKG_CHECK_EXISTS([gdu >= $GDU_REQUIRED], msg_gdu=yes)
diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c
index a20b0bb..865a7b7 100644
--- a/monitor/gdu/ggduvolume.c
+++ b/monitor/gdu/ggduvolume.c
@@ -337,51 +337,12 @@ update_volume (GGduVolume *volume)
volume->should_automount = FALSE;
}
- /* Avoid automounting volumes from
- *
- * 1. drives on a 'virtual' or unset bus
- * 2. volumes without a drive
- *
- * This is to avoid interference with things like Fedora's
- * livecd-tools that use device-mapper to set up images. See
- * https://bugzilla.redhat.com/show_bug.cgi?id=494144 for more
- * background.
- *
- * In the future we might want to relax 1. so automounting
- * things like Linux MD and LVM2 devices work.
+ /* Respect the presentation hint for whether the volume should be automounted - normally
+ * nopolicy is only FALSE for "physical" devices - e.g. only "physical" devices will
+ * be set to be automounted.
*/
- if (volume->drive != NULL)
- {
- GduPresentable *drive_presentable;
- drive_presentable = g_gdu_drive_get_presentable (volume->drive);
- if (drive_presentable != NULL)
- {
- GduDevice *drive_device;
- drive_device = gdu_presentable_get_device (drive_presentable);
- if (drive_device != NULL)
- {
- const gchar *bus;
- bus = gdu_device_drive_get_connection_interface (drive_device);
- if (bus == NULL || strlen (bus) == 0 || g_strcmp0 (bus, "virtual") == 0)
- {
- volume->should_automount = FALSE;
- }
- g_object_unref (drive_device);
- }
- else
- {
- volume->should_automount = FALSE;
- }
- }
- else
- {
- volume->should_automount = FALSE;
- }
- }
- else
- {
- volume->should_automount = FALSE;
- }
+ if (gdu_device_get_presentation_nopolicy (device))
+ volume->should_automount = FALSE;
g_free (activation_uri);
}
@@ -650,22 +611,28 @@ g_gdu_volume_get_mount (GVolume *volume)
/* ---------------------------------------------------------------------------------------------------- */
static gchar **
-get_mount_options (GduDevice *device)
+get_mount_options (GduDevice *device,
+ gboolean allow_user_interaction)
{
- gchar **ret;
+ GPtrArray *p;
+
+ p = g_ptr_array_new ();
/* one day we might read this from user settings */
if (g_strcmp0 (gdu_device_id_get_usage (device), "filesystem") == 0 &&
g_strcmp0 (gdu_device_id_get_type (device), "vfat") == 0)
{
- ret = g_new0 (gchar *, 2);
- ret[0] = g_strdup ("flush");
- ret[1] = NULL;
+ g_ptr_array_add (p, g_strdup ("flush"));
}
- else
- ret = NULL;
- return ret;
+ if (!allow_user_interaction)
+ {
+ g_ptr_array_add (p, g_strdup ("auth_no_user_interaction"));
+ }
+
+ g_ptr_array_add (p, NULL);
+
+ return (gchar **) g_ptr_array_free (p, FALSE);
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -787,7 +754,7 @@ mount_cleartext_device (MountOpData *data,
else
{
gchar **mount_options;
- mount_options = get_mount_options (data->device_to_mount);
+ mount_options = get_mount_options (data->device_to_mount, data->mount_operation != NULL);
gdu_device_op_filesystem_mount (data->device_to_mount, mount_options, mount_cb, data);
g_strfreev (mount_options);
}
@@ -1205,7 +1172,7 @@ g_gdu_volume_mount (GVolume *_volume,
{
gchar **mount_options;
data->device_to_mount = g_object_ref (device);
- mount_options = get_mount_options (data->device_to_mount);
+ mount_options = get_mount_options (data->device_to_mount, data->mount_operation != NULL);
gdu_device_op_filesystem_mount (data->device_to_mount, mount_options, mount_cb, data);
g_strfreev (mount_options);
}

View File

@ -1,7 +1,7 @@
Summary: Backends for the gio framework in GLib
Name: gvfs
Version: 1.3.5
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -38,6 +38,8 @@ Patch1: gvfs-archive-integration.patch
# http://bugzilla.gnome.org/show_bug.cgi?id=591005
Patch10: 0001-Add-AFC-backend.patch
Patch11: gvfs-non-interactive-mounts.patch
%description
The gvfs package provides backend implementations for the gio
framework in GLib. It includes ftp, sftp, cifs.
@ -130,6 +132,7 @@ and iPod Touches to applications using gvfs.
%setup -q
%patch1 -p1 -b .archive-integration
%patch10 -p1 -b .afc
%patch11 -p1 -b .non-interactive-mounts
%build
@ -283,7 +286,10 @@ update-desktop-database &> /dev/null ||:
%{_datadir}/gvfs/remote-volume-monitors/afc.monitor
%changelog
* Mon Aug 24 2009 Matthias Clasne <mclasen@redhat.com> - 1.3.5-1
* Wed Aug 26 2009 Matthias Clasen <mclasen@redhat.com> - 1.3.5-2
- Don't mount interactively during login
* Mon Aug 24 2009 Matthias Clasen <mclasen@redhat.com> - 1.3.5-1
- Update to 1.3.5
* Mon Aug 17 2009 Tomas Bzatek <tbzatek@redhat.com> - 1.3.4-7