[gvfs/gnome-2-28] [gdu] Be more careful with automounting - use a whitelist
- From: David Zeuthen <davidz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-2-28] [gdu] Be more careful with automounting - use a whitelist
- Date: Tue, 8 Dec 2009 19:43:34 +0000 (UTC)
commit e286c9b3f032c84298b715eaf821bc8a7df59bc3
Author: David Zeuthen <davidz redhat com>
Date: Tue Dec 8 14:33:43 2009 -0500
[gdu] Be more careful with automounting - use a whitelist
The current behavior is that we try to automount all filesystems. This
has unintended consequences for big iron boxes connected to a SAN when
the user is logging in as root (thus having all polkit authorizations
at hand) - literally hundreds or thousands of devices may get mounted.
As such, only automount filesystems from the current whitelist
- anything connected via USB or Firewire or SDIO buses
- optical discs
Signed-off-by: David Zeuthen <davidz redhat com>
monitor/gdu/ggduvolume.c | 51 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 47 insertions(+), 4 deletions(-)
---
diff --git a/monitor/gdu/ggduvolume.c b/monitor/gdu/ggduvolume.c
index 6e2fcd3..23f5060 100644
--- a/monitor/gdu/ggduvolume.c
+++ b/monitor/gdu/ggduvolume.c
@@ -351,13 +351,56 @@ update_volume (GGduVolume *volume)
volume->can_mount = TRUE;
- /* If a volume (partition) appear _much later_ than when media was insertion it
- * can only be because the media was repartitioned. We don't want to automount
- * such volumes.
+ /* Only automount filesystems from drives of known types/interconnects:
+ *
+ * - USB
+ * - Firewire
+ * - sdio
+ * - optical discs
+ *
+ * The mantra here is "be careful" - we really don't want to
+ * automount fs'es from all devices in a SAN etc - We REALLY
+ * need to be CAREFUL here.
+ *
+ * Sidebar: Actually, a surprisingly large number of admins like
+ * to log into GNOME as root (thus having all polkit
+ * authorizations) and if weren't careful we'd
+ * automount all mountable devices from the box. See
+ * the enterprise distro bug trackers for details.
*/
- volume->should_automount = TRUE;
+ volume->should_automount = FALSE;
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)
+ {
+ if (gdu_device_is_drive (drive_device))
+ {
+ const gchar *connection_interface;
+
+ connection_interface = gdu_device_drive_get_connection_interface (drive_device);
+
+ if (g_strcmp0 (connection_interface, "usb") == 0 ||
+ g_strcmp0 (connection_interface, "firewire") == 0 ||
+ g_strcmp0 (connection_interface, "sdio") == 0 ||
+ gdu_device_is_optical_disc (drive_device))
+ {
+ volume->should_automount = TRUE;
+ }
+ }
+ g_object_unref (drive_device);
+ }
+ }
+
+ /* If a volume (partition) appear _much later_ than when media was inserted it
+ * can only be because the media was repartitioned. We don't want to automount
+ * such volumes.
+ */
now = time (NULL);
if (now - g_gdu_drive_get_time_of_last_media_insertion (volume->drive) > 5)
volume->should_automount = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]