gvfs r1209 - in trunk: . client



Author: alexl
Date: Wed Jan 30 12:37:41 2008
New Revision: 1209
URL: http://svn.gnome.org/viewvc/gvfs?rev=1209&view=rev

Log:
2008-01-30  Alexander Larsson  <alexl redhat com>

        * client/gvfsfusedaemon.c:
	Set read and execute privs for all directories.
	Fix up type when reading can-read etc attributes.
	Don't use uid/gid in the fuse mount. The
	uid/gid doesn't make sense locally anyway.




Modified:
   trunk/ChangeLog
   trunk/client/gvfsfusedaemon.c

Modified: trunk/client/gvfsfusedaemon.c
==============================================================================
--- trunk/client/gvfsfusedaemon.c	(original)
+++ trunk/client/gvfsfusedaemon.c	Wed Jan 30 12:37:41 2008
@@ -677,16 +677,18 @@
         break;
     }
 
-  if (!g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ)
-      || g_file_info_get_attribute_uint32 (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
+  if (file_type == G_FILE_TYPE_DIRECTORY ||
+      !g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ) ||
+      g_file_info_get_attribute_boolean (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
     unix_mode |= S_IRUSR;
-  if (!g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)
-      || g_file_info_get_attribute_uint32 (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
+  if (!g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE) ||
+      g_file_info_get_attribute_boolean (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))
     unix_mode |= S_IWUSR;
-  if (!g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE)
-      || g_file_info_get_attribute_uint32 (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE))
+  if (file_type == G_FILE_TYPE_DIRECTORY ||
+      !g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE) ||
+      g_file_info_get_attribute_boolean (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE))
     unix_mode |= S_IXUSR;
-
+  
   return unix_mode;
 }
 
@@ -708,11 +710,6 @@
       sbuf->st_uid = daemon_uid;
       sbuf->st_gid = daemon_gid;
 
-      if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_UNIX_UID))
-        sbuf->st_uid = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_UNIX_UID);
-      if (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_UNIX_GID))
-        sbuf->st_gid = file_info_get_attribute_as_uint (file_info, G_FILE_ATTRIBUTE_UNIX_GID);
-
       g_file_info_get_modification_time (file_info, &mod_time);
       sbuf->st_mtime = mod_time.tv_sec;
       sbuf->st_ctime = mod_time.tv_sec;
@@ -777,7 +774,7 @@
     {
       /* Mount list */
 
-      sbuf->st_mode = S_IFDIR | 0555;                   /* mode_t    protection */
+      sbuf->st_mode = S_IFDIR | 0500;                   /* mode_t    protection */
       sbuf->st_nlink = 2 + g_list_length (mount_list);  /* nlink_t   number of hard links */
       sbuf->st_atime = daemon_creation_time;
       sbuf->st_mtime = daemon_creation_time;
@@ -1815,11 +1812,11 @@
       if (file_info)
         {
           if ((mode & R_OK && (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ) &&
-                               !g_file_info_get_attribute_uint32 (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ))) ||
+                               !g_file_info_get_attribute_boolean (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ))) ||
               (mode & W_OK && (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE) &&
-                               !g_file_info_get_attribute_uint32 (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))) ||
+                               !g_file_info_get_attribute_boolean (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE))) ||
               (mode & X_OK && (g_file_info_has_attribute (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE) &&
-                               !g_file_info_get_attribute_uint32 (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE))))
+                               !g_file_info_get_attribute_boolean (file_info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE))))
             result = -EACCES;
 
           g_object_unref (file_info);



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