Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving a locked file to a locked folder, both locks are preserved #34389

Open
davitol opened this issue Feb 5, 2019 · 3 comments
Open

Moving a locked file to a locked folder, both locks are preserved #34389

davitol opened this issue Feb 5, 2019 · 3 comments

Comments

@davitol
Copy link
Contributor

davitol commented Feb 5, 2019

Steps to reproduce

  1. Lock a file:
curl -u admin:admin -X LOCK http://owncloudserver/remote.php/webdav/lock.txt  -d "<?xml version='1.0' encoding='UTF-8'?><d:lockinfo xmlns:d='DAV:'> <d:timeout>Infinite</d:timeout> <d:lockscope><d:exclusive/></d:lockscope></d:lockinfo>"
  1. Lock a folder
curl -u admin:admin -X LOCK http://owncloudserver/remote.php/webdav/FolderCerrado  -d "<?xml version='1.0' encoding='UTF-8'?><d:lockinfo xmlns:d='DAV:'> <d:timeout>Infinite</d:timeout> <d:lockscope><d:exclusive/></d:lockscope></d:lockinfo>"
  1. Move the file into the folder using both tokens:
curl -k -u admin:admin -H 'If: (<opaquelocktoken:ad232c59-98d3-434e-a18c-81cdc65aa4c1>,<opaquelocktoken:76484811-c9ce-4ff5-9e5f-59f45e146449>)' -H 'Destination:http://owncloudserver/remote.php/webdav/FolderCerrado/lock.txt' -H 'Overwrite:F' -H 'User-Agent:Mozilla/5.0 (Android) ownCloud-android/2.7.0' -H 'Host:owncloudserver' -X MOVE 'http://owncloudserver/remote.php/webdav/lock.txt'
  1. Check the lock in the moved file

Expected behavior

The lock token of the file should not be preserved https://tools.ietf.org/html/rfc4918#page-33:

A successful MOVE request on a write locked resource MUST NOT move
   the write lock with the resource.  However, if there is an existing
   lock at the destination, the server MUST add the moved resource to
   the destination lock scope.  For example, if the MOVE makes the
   resource a child of a collection that has a depth-infinity lock, then
   the resource will be added to that collection's lock.  Additionally,
   if a resource with a depth-infinity lock is moved to a destination
   that is within the scope of the same lock (e.g., within the URL
   namespace tree covered by the lock), the moved resource will again be
   added to the lock.  In both these examples, as specified in
   Section 7.5, an If header must be submitted containing a lock token
   for both the source and destination.

Actual behavior

Both lock tokens are preserved

curl -u admin:admin -X PROPFIND http://owncloudserver/remote.php/webdav/FolderCerrado/lock.txt  -d "<?xml version='1.0' encoding='UTF-8'?> <d:propfind xmlns:d='DAV:'> <d:prop><d:lockdiscovery/></d:prop> </d:propfind>" | xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1222  100  1106  100   116    704     73  0:00:01  0:00:01 --:--:--   704
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/remote.php/webdav/FolderCerrado/lock.txt</d:href>
    <d:propstat>
      <d:prop>
        <d:lockdiscovery>
          <d:activelock>
            <d:lockscope>
              <d:exclusive/>
            </d:lockscope>
            <d:locktype>
              <d:write/>
            </d:locktype>
            <d:lockroot>
              <d:href>/remote.php/webdav/FolderCerrado/lock.txt</d:href>
            </d:lockroot>
            <d:depth>infinity</d:depth>
            <d:timeout>Second-1445</d:timeout>
            <d:locktoken>
              <d:href>opaquelocktoken:76484811-c9ce-4ff5-9e5f-59f45e146449</d:href>
            </d:locktoken>
            <d:owner>admin </d:owner>
          </d:activelock>
          <d:activelock>
            <d:lockscope>
              <d:exclusive/>
            </d:lockscope>
            <d:locktype>
              <d:write/>
            </d:locktype>
            <d:lockroot>
              <d:href>/remote.php/webdav/FolderCerrado</d:href>
            </d:lockroot>
            <d:depth>infinity</d:depth>
            <d:timeout>Second-1466</d:timeout>
            <d:locktoken>
              <d:href>opaquelocktoken:ad232c59-98d3-434e-a18c-81cdc65aa4c1</d:href>
            </d:locktoken>
            <d:owner>admin</d:owner>
          </d:activelock>
        </d:lockdiscovery>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>

@individual-it @PVince81

@ownclouders
Copy link
Contributor

GitMate.io thinks the contributor most likely able to help you is @ownclouders.

Possibly related issues are #34372 (moving a locked file into a locked folder (providing token) results in conflicting locks), #24737 (File Locked), #26838 (File locking), #28991 (file is locked), and #21881 (File Permanently Locked).

@PVince81
Copy link
Contributor

PVince81 commented Feb 5, 2019

it's another variation of #34372

moving to backlog for now

@PVince81 PVince81 modified the milestones: QA, backlog Feb 5, 2019
@jvillafanez
Copy link
Member

Maybe we can add a afterMethod:MOVE in the "new" PublicDavLocksPlugin (#36402 - pending to be merged) in order to remove the persistent lock there.
Alternatively, we could add the same functionality in the "FilesPlugin" although there isn't anything related to locks there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants