Return-Path: Delivered-To: apmail-apache-cvs-archive@apache.org Received: (qmail 67562 invoked by uid 500); 12 Jan 2001 12:18:12 -0000 Mailing-List: contact apache-cvs-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list apache-cvs@apache.org Received: (qmail 67549 invoked by uid 500); 12 Jan 2001 12:18:11 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 12 Jan 2001 12:18:11 -0000 Message-ID: <20010112121811.67545.qmail@apache.org> From: gstein@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/dav/fs repos.c gstein 01/01/12 04:18:10 Modified: modules/dav/main mod_dav.c mod_dav.h modules/dav/fs repos.c Log: Fix a problem found by Ryan when deleting collections, which triggered an underlying (broad) bug. dav_add_response() was assuming the walk params were a dav_walker_ctx. During the walker cleanup in Nov00, that assumption was removed, so response errors that occurred in the cleaned sections (such as dav_fs_delete_resource) could trigger a segfault. Solution: add a pool to dav_walk_resource and alter dav_add_response to use that, rather than assume the ctx is a dav_walker_ctx. [ note there is also a pool in dav_walk_resource.resource, but that pool is associated with the *resource* rather than the process of walking, so we introduced another field. currently they are the same, however. ] Found by: Ryan Bloom Revision Changes Path 1.35 +2 -3 httpd-2.0/modules/dav/main/mod_dav.c Index: mod_dav.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -u -r1.34 -r1.35 --- mod_dav.c 2001/01/08 23:54:50 1.34 +++ mod_dav.c 2001/01/12 12:18:09 1.35 @@ -1137,12 +1137,11 @@ DAV_DECLARE(void) dav_add_response(dav_walk_resource *wres, int status, dav_get_props_result *propstats) { - dav_walker_ctx *ctx = wres->walk_ctx; dav_response *resp; /* just drop some data into an dav_response */ - resp = apr_pcalloc(ctx->w.pool, sizeof(*resp)); - resp->href = apr_pstrdup(ctx->w.pool, wres->resource->uri); + resp = apr_pcalloc(wres->pool, sizeof(*resp)); + resp->href = apr_pstrdup(wres->pool, wres->resource->uri); resp->status = status; if (propstats) { resp->propresult = *propstats; 1.35 +3 -0 httpd-2.0/modules/dav/main/mod_dav.h Index: mod_dav.h =================================================================== RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.h,v retrieving revision 1.34 retrieving revision 1.35 diff -u -u -r1.34 -r1.35 --- mod_dav.h 2000/12/06 08:10:35 1.34 +++ mod_dav.h 2001/01/12 12:18:09 1.35 @@ -1436,6 +1436,9 @@ /* the client-provided context */ void *walk_ctx; + /* pool to use for allocations in the callback */ + apr_pool_t *pool; + /* the current resource */ const dav_resource *resource; 1.41 +1 -0 httpd-2.0/modules/dav/fs/repos.c Index: repos.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/dav/fs/repos.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -u -r1.40 -r1.41 --- repos.c 2001/01/05 19:40:01 1.40 +++ repos.c 2001/01/12 12:18:10 1.41 @@ -1597,6 +1597,7 @@ fsctx.params = params; fsctx.wres.walk_ctx = params->walk_ctx; + fsctx.wres.pool = params->pool; /* ### zero out versioned, working, baselined? */