Branch: Tag:

2018-03-19

2018-03-19 16:16:23 by Henrik Grubbström (Grubba) <grubba@grubba.org>

WebDAV: Return lock-token-submitted errors on locked paths.

Fixes [WS-221].

1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2009, Roxen IS. - // $Id: module.pike,v 1.245 2012/01/23 12:50:52 grubba Exp $ + // $Id$      #include <module_constants.h>   #include <module.h>
1258:    if (lock && intp(lock)) {    if (lock & 1) {    TRACE_LEAVE("Locked by other user."); -  return Roxen.http_status(Protocols.HTTP.DAV_LOCKED); +  return Roxen.http_dav_error(Protocols.HTTP.DAV_LOCKED, +  "lock-token-submitted");    }    else if (recursive)    // This is set for LOCK_OWN_BELOW too since it might be
1276:    if (!if_data || !sizeof(condition = if_data[path] || if_data[0])) {    if (lock) {    TRACE_LEAVE("Locked, no if header."); -  return Roxen.http_status(Protocols.HTTP.DAV_LOCKED); +  return Roxen.http_dav_error(Protocols.HTTP.DAV_LOCKED, +  "lock-token-submitted");    }    SIMPLE_TRACE_LEAVE("No lock and no if header - ok%s.",    got_sublocks ? " (this level only)" : "");
1349:    locked_fail = 1;    }    -  TRACE_LEAVE("Failed."); -  return Roxen.http_status(locked_fail ? -  Protocols.HTTP.DAV_LOCKED : -  Protocols.HTTP.HTTP_PRECOND_FAILED); +  if (locked_fail) { +  TRACE_LEAVE("Failed (locked)."); +  return Roxen.http_dav_error(Protocols.HTTP.DAV_LOCKED, +  "lock-token-submitted");    }    -  +  TRACE_LEAVE("Precondition failed."); +  return Roxen.http_status(Protocols.HTTP.HTTP_PRECOND_FAILED); + } +    //! Used by some default implementations to check if we may perform a   //! write access to @[path]. It should at least call   //! @[check_if_header] to check DAV locks. It takes the same arguments