diff options
author | David Zeuthen <davidz@redhat.com> | 2012-05-03 09:06:46 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2012-05-03 09:07:07 -0400 |
commit | 7ef4140c6eb484b8aabf36a86fe070ef634dab05 (patch) | |
tree | 677d3e8164ea31c70db2a57275d4de09c890dc94 | |
parent | 9b449288f63b6a6be45c8cee14bfa8f1c0b37024 (diff) | |
download | gvfs-7ef4140c6eb484b8aabf36a86fe070ef634dab05.tar.gz |
udisks2: don't show loop devices set up by other users
Signed-off-by: David Zeuthen <davidz@redhat.com>
-rw-r--r-- | monitor/udisks2/gvfsudisks2volumemonitor.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/monitor/udisks2/gvfsudisks2volumemonitor.c b/monitor/udisks2/gvfsudisks2volumemonitor.c index 2826164e..c407d840 100644 --- a/monitor/udisks2/gvfsudisks2volumemonitor.c +++ b/monitor/udisks2/gvfsudisks2volumemonitor.c @@ -818,6 +818,7 @@ should_include_volume (GVfsUDisks2VolumeMonitor *monitor, UDisksFilesystem *filesystem; UDisksDrive *udisks_drive = NULL; const gchar* const *mount_points; + UDisksLoop *loop; /* Block:Ignore trumps everything */ if (udisks_block_get_hint_ignore (block)) @@ -888,8 +889,24 @@ should_include_volume (GVfsUDisks2VolumeMonitor *monitor, goto out; } - /* otherwise, we're good to go */ + /* If the device (or if a partition, its containing device) is a + * loop device, check the SetupByUid property - we don't want to + * show loop devices set up by other users + */ +#ifdef UDISKS_CHECK_VERSION +# if UDISKS_CHECK_VERSION(1,97,0) + loop = udisks_client_get_loop_for_block (monitor->client, block); + if (loop != NULL) + { + guint setup_by_uid = udisks_loop_get_setup_by_uid (loop); + g_object_unref (loop); + if (setup_by_uid != 0 && setup_by_uid != getuid ()) + goto out; + } +# endif +#endif + /* otherwise, we're good to go */ ret = TRUE; out: |