Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 25727 invoked from network); 9 Nov 2009 21:04:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Nov 2009 21:04:51 -0000 Received: (qmail 11229 invoked by uid 500); 9 Nov 2009 21:04:51 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 11171 invoked by uid 500); 9 Nov 2009 21:04:51 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 11162 invoked by uid 99); 9 Nov 2009 21:04:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Nov 2009 21:04:51 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Nov 2009 21:04:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9CF72238890A; Mon, 9 Nov 2009 21:04:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r834230 - in /httpd/httpd/trunk: CHANGES modules/dav/main/mod_dav.c Date: Mon, 09 Nov 2009 21:04:28 -0000 To: cvs@httpd.apache.org From: sf@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091109210428.9CF72238890A@eris.apache.org> Author: sf Date: Mon Nov 9 21:04:28 2009 New Revision: 834230 URL: http://svn.apache.org/viewvc?rev=834230&view=rev Log: Return 409 instead of 500 for a LOCK request if the parent resource does not exist or is not a collection. PR: 43465 Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/modules/dav/main/mod_dav.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=834230&r1=834229&r2=834230&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Mon Nov 9 21:04:28 2009 @@ -10,6 +10,9 @@ mod_proxy_ftp: NULL pointer dereference on error paths. [Stefan Fritsch , Joe Orton] + *) mod_dav_fs; Return 409 instead of 500 for a LOCK request if the parent + resource does not exist or is not a collection. PR 43465. [Stefan Fritsch] + *) mod_dav_fs: Return 409 instead of 500 for Litmus test case copy_nodestcoll (a COPY request where the parent of the destination resource does not exist). PR 39299. [Stefan Fritsch] Modified: httpd/httpd/trunk/modules/dav/main/mod_dav.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/dav/main/mod_dav.c?rev=834230&r1=834229&r2=834230&view=diff ============================================================================== --- httpd/httpd/trunk/modules/dav/main/mod_dav.c (original) +++ httpd/httpd/trunk/modules/dav/main/mod_dav.c Mon Nov 9 21:04:28 2009 @@ -2995,6 +2995,7 @@ { dav_error *err; dav_resource *resource; + dav_resource *parent; const dav_hooks_locks *locks_hooks; int result; int depth; @@ -3026,6 +3027,20 @@ if (err != NULL) return dav_handle_err(r, err, NULL); + /* Check if parent collection exists */ + if ((err = resource->hooks->get_parent_resource(resource, &parent)) != NULL) { + /* ### add a higher-level description? */ + return dav_handle_err(r, err, NULL); + } + if (parent && (!parent->exists || parent->collection != 1)) { + err = dav_new_error(r->pool, HTTP_CONFLICT, 0, + apr_psprintf(r->pool, + "The parent resource of %s does not " + "exist or is not a collection.", + ap_escape_html(r->pool, r->uri))); + return dav_handle_err(r, err, NULL); + } + /* * Open writable. Unless an error occurs, we'll be * writing into the database.