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

  • From: "grahamh" <trac@xxxxxxxxxxxx>
  • Date: Tue, 26 Oct 2010 19:23:05 -0000

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

Comment (by grahamh):

 Problem is that CheckPermissions is used for lots of different things. If
 a file is mode 444 (r--r--r--), then, for example,

 * You shouldn't be able to open() it with O_RDWR
 * You shouldn't be able to unlink() it
 * You shouldn't be able to truncate() it
 * You shouldn't be able to change the last modified date
 (all of these call CheckPermissions, and I think the last two are done by
 bfs_write_stat)

 but...
 * You should be able to chmod() it
 * You should be able to chown() it (I think - the POSIX spec is a bit
 vague on that)
 and both of these are also done in bfs_write stat. Which is why I think it
 needs the escalation of permissions when doing B_STAT_MODE, B_STAT_GID or
 B_STAT_UID, but should throw EACCES for other things like B_STAT_SIZE.

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

Other related posts: