Branch: Tag:

2018-02-02

2018-02-02 12:20:09 by Henrik Grubbström (Grubba) <grubba@grubba.org>

WebDAV: MOVE should unlock moved locks.

RFC 4918 9.9:
The MOVE operation on a non-collection resource is
the logical equivalent of a copy (COPY), followed
by consistency maintenance processing, followed by
a delete of the source, where all three actions are
performed in a single operation.

The above seems to imply that RFC 4918 9.6 applies
to MOVE. We thus need to destroy any locks rooted
on the moved resource.

Fixes [WS-162].

485:    (source, destination, behavior, overwrite, id);    if (res && ((res->error == 201) || (res->error == 204))) {    empty_result = res; +  if (id->method == "MOVE") { +  // RFC 4918 9.9: +  // The MOVE operation on a non-collection resource is +  // the logical equivalent of a copy (COPY), followed +  // by consistency maintenance processing, followed by +  // a delete of the source, where all three actions are +  // performed in a single operation. +  +  // The above seems to imply that RFC 4918 9.6 applies +  // to MOVE. We thus need to destroy any locks rooted +  // on the moved resource. +  multiset(DAVLock) sub_locks = +  module->find_locks(path, -1, 0, id); +  foreach(sub_locks||(<>);DAVLock lock;) { +  SIMPLE_TRACE_ENTER(module, +  "MOVE: Unlocking %O...", lock); +  mapping fail = +  id->conf->unlock_file(lock->path, lock, id); +  if (fail) { +  TRACE_LEAVE("MOVE: Unlock failed."); +  } else { +  TRACE_LEAVE("MOVE: Unlock ok."); +  } +  } +  }    return 0;    }    else if (!res && id->misc->error_code) {