[PATCH] Unbreak permissions display on (s)ftp
- From: Christian Neumair <chris gnome-de org>
- To: nautilus-list gnome org
- Subject: [PATCH] Unbreak permissions display on (s)ftp
- Date: Wed, 22 Mar 2006 16:58:19 +0100
The attached patch makes Nautilus clearly distinguish between the ACCESS
field introduced in 2.14 used to flag what emblems should be displayed
(denies_access API), and the traditional PERMISSIONS field signalling
access to valid mode info (get_permissions API).
The patch also makes nautilus_file_can_set_permissions fall back to TRUE
if no valid UID info is available.
--
Christian Neumair <chris gnome-de org>
Index: libnautilus-private/nautilus-file.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v
retrieving revision 1.385
diff -u -p -r1.385 nautilus-file.c
--- libnautilus-private/nautilus-file.c 18 Mar 2006 07:13:49 -0000 1.385
+++ libnautilus-private/nautilus-file.c 22 Mar 2006 15:48:58 -0000
@@ -671,7 +671,7 @@ nautilus_file_denies_access_permission (
/* 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 @@ nautilus_file_get_size (NautilusFile *fi
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 @@ nautilus_file_can_set_permissions (Nauti
{
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]