From 882daf039419be81b9873f4aad7b922e2dd66f43 Mon Sep 17 00:00:00 2001 From: "Gene Z. Ragan" Date: Wed, 21 Feb 2001 03:47:49 +0000 Subject: Fixed bug 6029, No option to mount zip drive in desktop menu. Fixed bug 2001-02-20 Gene Z. Ragan Fixed bug 6029, No option to mount zip drive in desktop menu. Fixed bug 6751, Nautilus does not detect all of my removable disks. Fixed bug 6194, SCSI CD-ROM drives are not displayed on desktop. Fixed bug 6396, cd-rom not detected Special thanks to liblit@acm.org for persisting and looking at the code. The check permissions code is an artifact from when we were considering having a mount daemon. I don't think it is needed at all because the volume monitor is not running as root. I wil mark the bugs fixed and wait for status but I think this will work. * libnautilus-extensions/nautilus-volume-monitor.c: (mount_volume_ext2_add), (mount_volume_udf_add), (mount_volume_vfat_add), (mount_volume_msdos_add): Remove old check_permissions code. --- ChangeLog | 18 ++++++++ libnautilus-extensions/nautilus-volume-monitor.c | 52 ------------------------ libnautilus-private/nautilus-volume-monitor.c | 52 ------------------------ 3 files changed, 18 insertions(+), 104 deletions(-) diff --git a/ChangeLog b/ChangeLog index d34bb3ebc..63bc2a727 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2001-02-20 Gene Z. Ragan + + Fixed bug 6029, No option to mount zip drive in desktop menu. + Fixed bug 6751, Nautilus does not detect all of my removable disks. + Fixed bug 6194, SCSI CD-ROM drives are not displayed on desktop. + Fixed bug 6396, cd-rom not detected + + Special thanks to liblit@acm.org for persisting and looking at the + code. The check permissions code is an artifact from when we were + considering having a mount daemon. I don't think it is needed at all + because the volume monitor is not running as root. I wil mark + the bugs fixed and wait for status but I think this will work. + + * libnautilus-extensions/nautilus-volume-monitor.c: + (mount_volume_ext2_add), (mount_volume_udf_add), + (mount_volume_vfat_add), (mount_volume_msdos_add): + Remove old check_permissions code. + 2001-02-20 John Sullivan Fixed bug 6785 ("Trash" should be capitalized) diff --git a/libnautilus-extensions/nautilus-volume-monitor.c b/libnautilus-extensions/nautilus-volume-monitor.c index 98afef8a7..39bfa6c3d 100644 --- a/libnautilus-extensions/nautilus-volume-monitor.c +++ b/libnautilus-extensions/nautilus-volume-monitor.c @@ -945,42 +945,6 @@ mount_volumes_check_status (NautilusVolumeMonitor *monitor) return TRUE; } - -/* Like access, but a bit more accurate in one way - access will let - * root do anything. Less accurate in other ways: does not get - * read-only or no-exec filesystems right, and returns FALSE if - * there's an error. - */ -static gboolean -check_permissions (const char *filename, int mode) -{ - guint euid, egid; - struct stat statbuf; - - euid = geteuid (); - egid = getegid (); - if (stat (filename, &statbuf) == 0) { - if ((mode & R_OK) && - !((statbuf.st_mode & S_IROTH) || - ((statbuf.st_mode & S_IRUSR) && euid == statbuf.st_uid) || - ((statbuf.st_mode & S_IRGRP) && egid == statbuf.st_gid))) - return FALSE; - if ((mode & W_OK) && - !((statbuf.st_mode & S_IWOTH) || - ((statbuf.st_mode & S_IWUSR) && euid == statbuf.st_uid) || - ((statbuf.st_mode & S_IWGRP) && egid == statbuf.st_gid))) - return FALSE; - if ((mode & X_OK) && - !((statbuf.st_mode & S_IXOTH) || - ((statbuf.st_mode & S_IXUSR) && euid == statbuf.st_uid) || - ((statbuf.st_mode & S_IXGRP) && egid == statbuf.st_gid))) - return FALSE; - - return TRUE; - } - return FALSE; -} - static gboolean mount_volume_floppy_add (NautilusVolume *volume) { @@ -991,10 +955,6 @@ mount_volume_floppy_add (NautilusVolume *volume) static gboolean mount_volume_ext2_add (NautilusVolume *volume) { - if (check_permissions (volume->device_path, R_OK)) { - return FALSE; - } - volume->type = NAUTILUS_VOLUME_EXT2; return TRUE; @@ -1003,10 +963,6 @@ mount_volume_ext2_add (NautilusVolume *volume) static gboolean mount_volume_udf_add (NautilusVolume *volume) { - if (check_permissions (volume->device_path, R_OK)) { - return FALSE; - } - volume->type = NAUTILUS_VOLUME_UDF; return TRUE; @@ -1015,10 +971,6 @@ mount_volume_udf_add (NautilusVolume *volume) static gboolean mount_volume_vfat_add (NautilusVolume *volume) { - if (check_permissions (volume->device_path, R_OK)) { - return FALSE; - } - volume->type = NAUTILUS_VOLUME_VFAT; return TRUE; @@ -1027,10 +979,6 @@ mount_volume_vfat_add (NautilusVolume *volume) static gboolean mount_volume_msdos_add (NautilusVolume *volume) { - if (check_permissions (volume->device_path, R_OK)) { - return FALSE; - } - volume->type = NAUTILUS_VOLUME_MSDOS; return TRUE; diff --git a/libnautilus-private/nautilus-volume-monitor.c b/libnautilus-private/nautilus-volume-monitor.c index 98afef8a7..39bfa6c3d 100644 --- a/libnautilus-private/nautilus-volume-monitor.c +++ b/libnautilus-private/nautilus-volume-monitor.c @@ -945,42 +945,6 @@ mount_volumes_check_status (NautilusVolumeMonitor *monitor) return TRUE; } - -/* Like access, but a bit more accurate in one way - access will let - * root do anything. Less accurate in other ways: does not get - * read-only or no-exec filesystems right, and returns FALSE if - * there's an error. - */ -static gboolean -check_permissions (const char *filename, int mode) -{ - guint euid, egid; - struct stat statbuf; - - euid = geteuid (); - egid = getegid (); - if (stat (filename, &statbuf) == 0) { - if ((mode & R_OK) && - !((statbuf.st_mode & S_IROTH) || - ((statbuf.st_mode & S_IRUSR) && euid == statbuf.st_uid) || - ((statbuf.st_mode & S_IRGRP) && egid == statbuf.st_gid))) - return FALSE; - if ((mode & W_OK) && - !((statbuf.st_mode & S_IWOTH) || - ((statbuf.st_mode & S_IWUSR) && euid == statbuf.st_uid) || - ((statbuf.st_mode & S_IWGRP) && egid == statbuf.st_gid))) - return FALSE; - if ((mode & X_OK) && - !((statbuf.st_mode & S_IXOTH) || - ((statbuf.st_mode & S_IXUSR) && euid == statbuf.st_uid) || - ((statbuf.st_mode & S_IXGRP) && egid == statbuf.st_gid))) - return FALSE; - - return TRUE; - } - return FALSE; -} - static gboolean mount_volume_floppy_add (NautilusVolume *volume) { @@ -991,10 +955,6 @@ mount_volume_floppy_add (NautilusVolume *volume) static gboolean mount_volume_ext2_add (NautilusVolume *volume) { - if (check_permissions (volume->device_path, R_OK)) { - return FALSE; - } - volume->type = NAUTILUS_VOLUME_EXT2; return TRUE; @@ -1003,10 +963,6 @@ mount_volume_ext2_add (NautilusVolume *volume) static gboolean mount_volume_udf_add (NautilusVolume *volume) { - if (check_permissions (volume->device_path, R_OK)) { - return FALSE; - } - volume->type = NAUTILUS_VOLUME_UDF; return TRUE; @@ -1015,10 +971,6 @@ mount_volume_udf_add (NautilusVolume *volume) static gboolean mount_volume_vfat_add (NautilusVolume *volume) { - if (check_permissions (volume->device_path, R_OK)) { - return FALSE; - } - volume->type = NAUTILUS_VOLUME_VFAT; return TRUE; @@ -1027,10 +979,6 @@ mount_volume_vfat_add (NautilusVolume *volume) static gboolean mount_volume_msdos_add (NautilusVolume *volume) { - if (check_permissions (volume->device_path, R_OK)) { - return FALSE; - } - volume->type = NAUTILUS_VOLUME_MSDOS; return TRUE; -- cgit v1.2.1