mountpoint visibility



hello,

I'd like to start a discussion about visibility of mountpoint.

The main point is that I'm not sure users should see devices mounted by
other users.

this is not a common case, personnal computers are generally used by ONE
person at a time but let's think about a XDMCP server (I'm working on
such a system). When using a thin X client as workstation, the main
discomfort is to be unable to use removable media like floppy or usb
disk. That's why we are working on making them avaible as transparantly
as possible : on the thin client a script is launched by udev and inform
the XDMCP server of devices being plugged, the XDMCP server will then
pmount them through nbd as the user logged from this thin client.

Everything can be like on a real single system, except that if 10 users
have their usbdisk mounted, then they will see all mountpoint and it
becomes quite annoying.

the attached (yet very simple) patch to gnome-vfs prevents this: the
mountpoint is marked as visible ONLY if the user is the owner of the
mountpoint

it's not intended to be a perfect solution, I'd just like to discuss on
it, and get some feedback.
of course I secretly hope this feature will make it into gnome-vfs (or
somewhere else in gnome if it's not the right place?), so that I could
later upgrade to gnome2.10 without having to patch gnome-vfs again and
again :))


so, any comments/idea ?

-- 
aurelien

Index: libgnomevfs/gnome-vfs-volume-monitor-daemon.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-volume-monitor-daemon.c,v
retrieving revision 1.16
diff -u -r1.16 gnome-vfs-volume-monitor-daemon.c
--- libgnomevfs/gnome-vfs-volume-monitor-daemon.c	10 Dec 2004 21:33:53 -0000	1.16
+++ libgnomevfs/gnome-vfs-volume-monitor-daemon.c	13 Dec 2004 11:51:29 -0000
@@ -826,6 +826,7 @@
 	int disctype;
 	int fd;
 	char *uri;
+	struct stat *mstat = NULL;
 	GnomeVFSDrive *containing_drive;
 	
 	fixup_mount (mount);
@@ -926,7 +927,7 @@
 	
 	vol->priv->icon = get_icon_from_type (vol->priv->device_type, mount->mount_path);
 
-	vol->priv->is_user_visible = 0;
+	vol->priv->is_user_visible = FALSE;
 	switch (vol->priv->device_type) {
 	case GNOME_VFS_DEVICE_TYPE_CDROM:
 	case GNOME_VFS_DEVICE_TYPE_FLOPPY:
@@ -934,7 +935,12 @@
 	case GNOME_VFS_DEVICE_TYPE_JAZ:
 	case GNOME_VFS_DEVICE_TYPE_CAMERA:
 	case GNOME_VFS_DEVICE_TYPE_MEMORY_STICK:
-		vol->priv->is_user_visible = 1;
+		mstat = malloc(sizeof(struct stat));
+		stat(mount->mount_path, mstat);
+		if (mstat->st_uid == getuid()) {
+			vol->priv->is_user_visible = TRUE;
+		}
+		free(mstat);
 		break;
 	default:
 		break;
@@ -950,7 +956,7 @@
 	    g_list_find (containing_drive->priv->volumes, vol) == NULL) {
 		/* Make sure the mounted volume for a visible drive is visible */
 		if (containing_drive->priv->is_user_visible) {
-			vol->priv->is_user_visible = 1;
+			vol->priv->is_user_visible = TRUE;
 		}
 		
 		vol->priv->drive = containing_drive;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]