Skip to content

Refresh lock tocken does not modify Timeout value when no timeout value is passed or no body given #34374

Open
@davitol

Description

@davitol

Steps to reproduce

  1. Create a file
  2. Lock the file and save lock-token.
curl -u admin:admin -H Timeout:Second-120 -H 'If: (<opaquelocktoken:e249539f-a66f-4dcc-85e7-9f8b00399df6>)' -X LOCK http://10.40.40.222:9681/remote.php/webdav/WindowsNetworkDrive/User/asf.txt
  1. Refresh the lock-token (LOCK with empty body) and check the Timeout value:
curl -u admin:admin -H 'If: (<opaquelocktoken:e249539f-a66f-4dcc-85e7-9f8b00399df6>)' -X LOCK http://10.40.40.222:9681/remote.php/webdav/WindowsNetworkDrive/User/asf.txt

Info related refreshing lock-token in the RFC https://tools.ietf.org/html/rfc4918#page-21 :

Refreshing Write Locks

   A client MUST NOT submit the same write lock request twice.  Note
   that a client is always aware it is resubmitting the same lock
   request because it must include the lock token in the If header in
   order to make the request for a resource that is already locked.

   However, a client may submit a LOCK request with an If header but
   without a body.  A server receiving a LOCK request with no body MUST
   NOT create a new lock -- this form of the LOCK request is only to be
   used to "refresh" an existing lock (meaning, at minimum, that any
   timers associated with the lock MUST be reset).

   Clients may submit Timeout headers of arbitrary value with their lock
   refresh requests.  Servers, as always, may ignore Timeout headers
   submitted by the client, and a server MAY refresh a lock with a
   timeout period that is different than the previous timeout period
   used for the lock, provided it advertises the new value in the LOCK
   refresh response.

Expected behaviour

Refresh is supposed to extend the timeout somehow. We could maybe reset the value "oc_persistent_token.created_at"

Actual behaviour

Timeout is not modified.

curl -u admin:admin -H 'If: (<opaquelocktoken:e249539f-a66f-4dcc-85e7-9f8b00399df6>)' -X LOCK http://10.40.40.222:9681/remote.php/webdav/WindowsNetworkDrive/User/asf.txt
<?xml version="1.0"?>
<d:prop xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
 <d:lockdiscovery>
  <d:activelock>
   <d:lockscope>
    <d:exclusive/>
   </d:lockscope>
   <d:locktype>
    <d:write/>
   </d:locktype>
   <d:lockroot>
    <d:href>WindowsNetworkDrive/User/asf.txt</d:href>
   </d:lockroot>
   <d:depth>infinity</d:depth>
   <d:timeout>Second-607</d:timeout>
   <d:locktoken>
    <d:href>opaquelocktoken:e249539f-a66f-4dcc-85e7-9f8b00399df6</d:href>
   </d:locktoken>
   <d:owner>admin</d:owner>
  </d:activelock>
 </d:lockdiscovery>
</d:prop>

Server configuration

Operating system:
Ubuntu 18.04
Web server:
Apache2
Database:
MySQL
PHP version:
7.1
ownCloud version: (see ownCloud admin page)
10.1 RC1
Updated from an older ownCloud or fresh install:
fresh
Where did you install ownCloud from:
tarball
Are you using external storage, if yes which one: local/smb/sftp/...
no
Are you using encryption: yes/no
no
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no

@PVince81 @individual-it FYI

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions