Szabolcs Szakacsits wrote:
> On Mon, 7 Apr 2008, Marc Andre Tanner wrote:
> 
>> I have now taken a closer look and after reading the POSIX comments 
>> within the test cases it makes more sense. For example from 
>> tests/open/00.t:
>>
>> # POSIX: (If O_CREAT is specified and the file doesn't exist) [...] the user 
>> ID
>> # of the file shall be set to the effective user ID of the process; the 
>> group ID
>> # of the file shall be set to the group ID of the file's parent directory or 
>> to
>> # the effective group ID of the process [...]
>>
>> expect 0 chown . 65535 65535
>> expect 0 -u 65535 -g 65535 open ${n0} O_CREAT,O_WRONLY 0644
>> expect 65535,65535 lstat ${n0} uid,gid
>>
>> This doesn't work for the fuse example file system because the open
>> syscall which actually creates the file isn't executed with the requested 
>> uid,gid but in the context of the user who mounted the fuse file system. 
>> So you end up with different values.
> 
> Yes. These could be supported by using fuse_get_context()->uid, 
> fuse_get_context()->gid, seteuid() and setegid().

So when you want a fuse file system with correct permission semantics
for multiple users you basically have to wrap every operation with:

  setegid(fuse_get_context()->gid);
  seteuid(fuse_get_context()->uid);
  /* do some work */
  seteuid(getuid());
  setegid(getgid());

Or am i missing something? But this only works when the file system is
mounted by root. Also are the euid, egid stored per thread? If not then
this will cause all kind of problems with race conditions.

So in my opinion -o allow_other when used as a non root user and not
intended for read only access is basically useless because new files
will be owned by the user who mounted the fs.

Cheers,
Marc

-- 
  Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to