=================================================================== RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v retrieving revision 1.386 retrieving revision 1.386.2.1 diff -u -r1.386 -r1.386.2.1 --- nautilus-file.c 2006/04/18 16:54:31 1.386 +++ libnautilus-private/nautilus-file.c 2006/04/27 14:01:24 1.386.2.1 @@ -671,7 +671,7 @@ /* File system does not provide permission bits. * Can't determine specific permissions, do not deny permission at all. */ - if (!nautilus_file_can_get_permissions (file)) { + if (nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_ACCESS)) { return FALSE; } @@ -3409,7 +3409,7 @@ gboolean nautilus_file_can_get_permissions (NautilusFile *file) { - return !nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_ACCESS); + return !nautilus_file_info_missing (file, GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS); } /** @@ -3429,29 +3429,27 @@ { uid_t user_id; - /* Not allowed to set the permissions if we can't - * even read them. This can happen on non-UNIX file - * systems. - */ - if (!nautilus_file_can_get_permissions (file)) { - return FALSE; - } + if (file->details->info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_IDS) { + /* Check the user. */ + user_id = geteuid(); - /* Check the user. */ - user_id = geteuid(); + /* Owner is allowed to set permissions. */ + if (user_id == (uid_t) file->details->info->uid) { + return TRUE; + } - /* Owner is allowed to set permissions. */ - if (user_id == (uid_t) file->details->info->uid) { - return TRUE; - } + /* Root is also allowed to set permissions. */ + if (user_id == 0) { + return TRUE; + } - /* Root is also allowed to set permissions. */ - if (user_id == 0) { - return TRUE; + /* Nobody else is allowed. */ + return FALSE; } - /* Nobody else is allowed. */ - return FALSE; + /* pretend to have full chmod rights when no info is available, relevant when + * the FS can't provide ownership info, for instance for FTP */ + return TRUE; } GnomeVFSFilePermissions