[Pkg-apache-commits] r1171 - in /trunk/apache2: changelog patches/073_mod_dav_trunk_fixes.dpatch
sf at alioth.debian.org
sf at alioth.debian.org
Mon Mar 29 19:51:53 UTC 2010
Author: sf
Date: Mon Mar 29 19:51:52 2010
New Revision: 1171
URL: http://svn.debian.org/wsvn/pkg-apache/?sc=1&rev=1171
Log:
mod_dav_fs: Use correct permissions when creating new files
Modified:
trunk/apache2/changelog
trunk/apache2/patches/073_mod_dav_trunk_fixes.dpatch
Modified: trunk/apache2/changelog
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/changelog?rev=1171&op=diff
==============================================================================
--- trunk/apache2/changelog (original)
+++ trunk/apache2/changelog Mon Mar 29 19:51:52 2010
@@ -2,6 +2,7 @@
* mod_reqtimeout: backport bugfixes from upstream trunk up to r928881,
including a fix for mod_proxy CONNECT requests.
+ * mod_dav_fs: Use correct permissions when creating new files. LP: #540747
-- Stefan Fritsch <sf at debian.org> Mon, 29 Mar 2010 21:44:32 +0200
Modified: trunk/apache2/patches/073_mod_dav_trunk_fixes.dpatch
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/patches/073_mod_dav_trunk_fixes.dpatch?rev=1171&op=diff
==============================================================================
--- trunk/apache2/patches/073_mod_dav_trunk_fixes.dpatch (original)
+++ trunk/apache2/patches/073_mod_dav_trunk_fixes.dpatch Mon Mar 29 19:51:52 2010
@@ -2,91 +2,32 @@
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Various bug fixes for mod_dav/mod_dav_fs
-## DP: upstream svn revs 834018:835092 in modules/dav
-#
-# *) mod_dav: Include uri when logging a PUT error due to connection abort.
-# PR 38149. [Stefan Fritsch]
-#
-# *) mod_dav: 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]
-#
-# *) mod_dav_fs: Don't delete the whole file if a PUT with content-range failed.
-# PR 42896. [Stefan Fritsch]
-#
-# *) mod_dav_fs: Make PUT create files atomically and no longer destroy the
-# old file if the transfer aborted. PR 39815. [Paul Querna, Stefan Fritsch]
-#
-# *) mod_dav_fs: Remove inode keyed locking as this conflicts with atomically
-# creating files. On systems with inode numbers, this is a format change of
-# the DavLockDB. The old DavLockDB must be deleted on upgrade.
-# [Stefan Fritsch]
+## DP: upstream svn revs 834018:835092 and 928403 in modules/dav
+## DP:
+## DP: *) mod_dav: Include uri when logging a PUT error due to connection abort.
+## DP: PR 38149. [Stefan Fritsch]
+## DP:
+## DP: *) mod_dav: Return 409 instead of 500 for a LOCK request if the parent
+## DP: resource does not exist or is not a collection. PR 43465. [Stefan Fritsch]
+## DP:
+## DP: *) mod_dav_fs: Return 409 instead of 500 for Litmus test case copy_nodestcoll
+## DP: (a COPY request where the parent of the destination resource does not
+## DP: exist). PR 39299. [Stefan Fritsch]
+## DP:
+## DP: *) mod_dav_fs: Don't delete the whole file if a PUT with content-range failed.
+## DP: PR 42896. [Stefan Fritsch]
+## DP:
+## DP: *) mod_dav_fs: Make PUT create files atomically and no longer destroy the
+## DP: old file if the transfer aborted. PR 39815. [Paul Querna, Stefan Fritsch]
+## DP:
+## DP: *) mod_dav_fs: Remove inode keyed locking as this conflicts with atomically
+## DP: creating files. On systems with inode numbers, this is a format change of
+## DP: the DavLockDB. The old DavLockDB must be deleted on upgrade.
+## DP: [Stefan Fritsch]
@DPATCH@
-Index: a/modules/dav/main/mod_dav.c
-===================================================================
---- a/modules/dav/main/mod_dav.c (Revision 834018)
-+++ a/modules/dav/main/mod_dav.c (Revision 835089)
-@@ -982,7 +982,10 @@
-
- if (rc != APR_SUCCESS) {
- err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
-- "Could not get next bucket brigade");
-+ apr_psprintf(r->pool,
-+ "Could not get next bucket "
-+ "brigade (URI: %s)",
-+ ap_escape_html(r->pool, r->uri)));
- break;
- }
-
-@@ -1005,8 +1008,10 @@
- rc = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
- if (rc != APR_SUCCESS) {
- err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
-- "An error occurred while reading "
-- "the request body.");
-+ apr_psprintf(r->pool,
-+ "An error occurred while reading"
-+ " the request body (URI: %s)",
-+ ap_escape_html(r->pool, r->uri)));
- break;
- }
-
-@@ -2995,6 +3000,7 @@
- {
- dav_error *err;
- dav_resource *resource;
-+ dav_resource *parent;
- const dav_hooks_locks *locks_hooks;
- int result;
- int depth;
-@@ -3026,6 +3032,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.
-Index: a/modules/dav/fs/lock.c
-===================================================================
---- a/modules/dav/fs/lock.c (Revision 834018)
-+++ a/modules/dav/fs/lock.c (Revision 835089)
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' trunk~/modules/dav/fs/lock.c trunk/modules/dav/fs/lock.c
+--- trunk~/modules/dav/fs/lock.c 2010-03-29 21:46:51.000000000 +0200
++++ trunk/modules/dav/fs/lock.c 2010-03-29 21:49:00.970983302 +0200
@@ -48,9 +48,8 @@
**
** KEY
@@ -228,23 +169,33 @@
return NULL;
}
-Index: a/modules/dav/fs/repos.c
-===================================================================
---- a/modules/dav/fs/repos.c (Revision 834018)
-+++ a/modules/dav/fs/repos.c (Revision 835089)
-@@ -140,6 +140,11 @@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' trunk~/modules/dav/fs/repos.c trunk/modules/dav/fs/repos.c
+--- trunk~/modules/dav/fs/repos.c 2010-03-29 21:46:51.000000000 +0200
++++ trunk/modules/dav/fs/repos.c 2010-03-29 21:49:08.031078314 +0200
+@@ -27,6 +27,10 @@
+ #include <stdio.h> /* for sprintf() */
+ #endif
+
++#if APR_HAVE_UNISTD_H
++#include <unistd.h> /* for getpid() */
++#endif
++
+ #include "httpd.h"
+ #include "http_log.h"
+ #include "http_protocol.h" /* for ap_set_* (in dav_fs_set_headers) */
+@@ -139,6 +143,11 @@
*/
#define DAV_PROPID_FS_executable 1
+/*
+ * prefix for temporary files
+ */
-+#define DAV_FS_TMP_PREFIX ".davfs."
++#define DAV_FS_TMP_PREFIX ".davfs.tmp"
+
static const dav_liveprop_spec dav_fs_props[] =
{
/* standard DAV properties */
-@@ -192,11 +197,14 @@
+@@ -191,11 +200,14 @@
apr_pool_t *p;
apr_file_t *f;
const char *pathname; /* we may need to remove it at close time */
@@ -259,7 +210,7 @@
HTTP_INTERNAL_SERVER_ERROR)
/* forward declaration for internal treewalkers */
-@@ -420,11 +428,24 @@
+@@ -414,11 +426,24 @@
apr_file_close(inf);
apr_file_close(outf);
@@ -286,7 +237,7 @@
/* ### ACK. this creates an inconsistency. do more!? */
/* ### use something besides 500? */
-@@ -506,9 +527,13 @@
+@@ -500,9 +525,13 @@
dst = apr_pstrcat(p, dst, "/", dst_file, NULL);
/* copy/move the file now */
@@ -303,7 +254,7 @@
/* ### use something besides 500? */
return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
"Could not move state file.");
-@@ -848,6 +873,14 @@
+@@ -841,6 +870,34 @@
&& ctx2->pathname[len1] == '/');
}
@@ -315,10 +266,30 @@
+ return APR_SUCCESS;
+}
+
++/* custom mktemp that creates the file with APR_OS_DEFAULT permissions */
++static apr_status_t dav_fs_mktemp(apr_file_t **fp, char *templ, apr_pool_t *p)
++{
++ apr_status_t rv;
++ int num = ((getpid() << 7) + (int)templ % (1 << 16) ) % ( 1 << 23 ) ;
++ char *numstr = templ + strlen(templ) - 6;
++
++ ap_assert(numstr >= templ);
++
++ do {
++ num = (num + 1) % ( 1 << 23 );
++ snprintf(numstr, 7, "%06x", num);
++ rv = apr_file_open(fp, templ,
++ APR_WRITE | APR_CREATE | APR_BINARY | APR_EXCL,
++ APR_OS_DEFAULT, p);
++ } while (APR_STATUS_IS_EEXIST(rv));
++
++ return rv;
++}
++
static dav_error * dav_fs_open_stream(const dav_resource *resource,
dav_stream_mode mode,
dav_stream **stream)
-@@ -872,7 +905,32 @@
+@@ -865,7 +922,32 @@
ds->p = p;
ds->pathname = resource->info->pathname;
@@ -329,7 +300,7 @@
+ if (mode == DAV_MODE_WRITE_TRUNC) {
+ ds->temppath = apr_pstrcat(p, ap_make_dirstr_parent(p, ds->pathname),
+ DAV_FS_TMP_PREFIX "XXXXXX", NULL);
-+ rv = apr_file_mktemp(&ds->f, ds->temppath, flags, ds->p);
++ rv = dav_fs_mktemp(&ds->f, ds->temppath, ds->p);
+ apr_pool_cleanup_register(p, ds, tmpfile_cleanup,
+ apr_pool_cleanup_null);
+ }
@@ -352,7 +323,7 @@
if (rv != APR_SUCCESS) {
return dav_new_error(p, MAP_IO2HTTP(rv), 0,
"An error occurred while opening a resource.");
-@@ -886,17 +944,33 @@
+@@ -879,17 +961,33 @@
static dav_error * dav_fs_close_stream(dav_stream *stream, int commit)
{
@@ -369,7 +340,7 @@
- "when it was being closed.");
+ if (stream->temppath) {
+ apr_pool_cleanup_run(stream->p, stream, tmpfile_cleanup);
- }
++ }
+ else if (stream->unlink_on_error) {
+ if (apr_file_remove(stream->pathname, stream->p) != APR_SUCCESS) {
+ /* ### use a better description? */
@@ -378,7 +349,7 @@
+ "back) the resource "
+ "when it was being closed.");
+ }
-+ }
+ }
}
+ else if (stream->temppath) {
+ rv = apr_file_rename(stream->temppath, stream->pathname, stream->p);
@@ -392,7 +363,7 @@
return NULL;
}
-@@ -1204,7 +1278,7 @@
+@@ -1201,7 +1299,7 @@
dav_resource_private *srcinfo = src->info;
dav_resource_private *dstinfo = dst->info;
dav_error *err;
@@ -401,7 +372,7 @@
#if DAV_DEBUG
if (src->hooks != dst->hooks) {
-@@ -1218,39 +1292,12 @@
+@@ -1215,39 +1313,12 @@
}
#endif
@@ -444,7 +415,7 @@
if ((err = dav_fs_copymove_resource(1, src, dst, DAV_INFINITY,
response)) == NULL) {
/* update resource states */
-@@ -1263,20 +1310,16 @@
+@@ -1260,20 +1331,16 @@
return err;
}
@@ -467,7 +438,7 @@
dst->exists = 1;
dst->collection = src->collection;
src->exists = 0;
-@@ -1478,14 +1521,18 @@
+@@ -1475,14 +1542,18 @@
/* ### need to authorize each file */
/* ### example: .htaccess is normally configured to fail auth */
@@ -490,3 +461,60 @@
continue;
}
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' trunk~/modules/dav/main/mod_dav.c trunk/modules/dav/main/mod_dav.c
+--- trunk~/modules/dav/main/mod_dav.c 2010-03-29 21:46:51.000000000 +0200
++++ trunk/modules/dav/main/mod_dav.c 2010-03-29 21:49:00.966964568 +0200
+@@ -986,7 +986,10 @@
+
+ if (rc != APR_SUCCESS) {
+ err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
+- "Could not get next bucket brigade");
++ apr_psprintf(r->pool,
++ "Could not get next bucket "
++ "brigade (URI: %s)",
++ ap_escape_html(r->pool, r->uri)));
+ break;
+ }
+
+@@ -1009,8 +1012,10 @@
+ rc = apr_bucket_read(b, &data, &len, APR_BLOCK_READ);
+ if (rc != APR_SUCCESS) {
+ err = dav_new_error(r->pool, HTTP_BAD_REQUEST, 0,
+- "An error occurred while reading "
+- "the request body.");
++ apr_psprintf(r->pool,
++ "An error occurred while reading"
++ " the request body (URI: %s)",
++ ap_escape_html(r->pool, r->uri)));
+ break;
+ }
+
+@@ -2966,6 +2971,7 @@
+ {
+ dav_error *err;
+ dav_resource *resource;
++ dav_resource *parent;
+ const dav_hooks_locks *locks_hooks;
+ int result;
+ int depth;
+@@ -2997,6 +3003,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.
More information about the Pkg-apache-commits
mailing list