owncloud-archive / files_locking

3 stars 5 forks source link

Allow file truncation to automatically delete+recreate file if read-only #7

Closed PVince81 closed 8 years ago

PVince81 commented 9 years ago

Steps to reproduce:

  1. Disable encryption
  2. touch data/files/admin/testperms.txt
  3. Make sure that the web server does NOT have write permissions on "testperms.txt" (either chmod a-w or change the owner to root:root)
  4. Enable encryption
  5. Login as "admin"

    Expected result

Write lock can be acquired when overwriting "testperms.txt"

Actual result

Write lock cannot be acquired because the file is read-only.

The problem happens in the rename() code, where the target file is attempted to be locked with a write lock. Even though we'd overwrite the file anyway, it fails.

The idea would be to adapt the code to find out whether we are in an "overwrite" situation. If yes, then delete + recreate the target file when acquiring the write lock.

@icewind1991 @DeepDiver1975

PVince81 commented 8 years ago

goodbye files_locking app, closing as obsolete