[haiku-bugs] Re: [Haiku] #6750: chmod is broken for non-superuser

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Wed, 10 Nov 2010 16:44:22 -0000

#6750: chmod is broken for non-superuser
-------------------------------+---------------------------------
  Reporter:  grahamh           |        Owner:  axeld
      Type:  bug               |       Status:  closed
  Priority:  normal            |    Milestone:  R1
 Component:  File Systems/BFS  |      Version:  R1/Development
Resolution:  fixed             |     Keywords:  chmod, write_stat
Blocked By:                    |  Has a Patch:  1
  Platform:  All               |     Blocking:
-------------------------------+---------------------------------

Comment (by bonefish):

 Replying to [comment:17 axeld]:
 > Applied in r39378, and r39379, thanks a lot Rohit Yadav!
 >
 > To Ingo: the check_access() a.k.a. CheckPermissions() function could
 easily be a VFS delivered utility function.

 Sure.

 > BTW there is at least one functional difference between the previous
 version in BFS: before, root could always enter a directory, no matter if
 any X was set. In your version, that is no longer possible; I would assume
 the former version is the correct one, though.

 Possibly. At least it's what one might expect and what e.g. Linux does.
 But
 
[http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_04
 POSIX says]:

  "If a process has appropriate privileges: [...] If execute permission is
 requested, access shall be granted if execute permission is granted to at
 least one user by the file permission bits or by an alternate access
 control mechanism; otherwise, access shall be denied."

 At least if one ties directory entry resolution to the execute permission,
 it would be correct to also deny root the access when none of the X bits
 is set.

 Anyway, I only claimed that I got the permission handling in
 `write_stat()` right, not everywhere. :-) E.g. `access()` is wrong for
 sure as the standard requires to use the real user and group IDs for the
 check. If we want to support the `faccessat()` `AT_EACCESS` flag, we have
 to change the hook signature anyway, though (e.g. pass the user and group
 IDs).

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6750#comment:19>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: