Modified: subversion/branches/svn-auth-x509/subversion/mod_dav_svn/repos.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/mod_dav_svn/repos.c?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/mod_dav_svn/repos.c (original) +++ subversion/branches/svn-auth-x509/subversion/mod_dav_svn/repos.c Fri Jan 16 14:01:35 2015 @@ -509,6 +509,9 @@ parse_vtxnstub_uri(dav_resource_combined if (parse_txnstub_uri(comb, path, label, use_checked_in)) return TRUE; + if (!comb->priv.root.txn_name) + return TRUE; + comb->priv.root.vtxn_name = comb->priv.root.txn_name; comb->priv.root.txn_name = dav_svn__get_txn(comb->priv.repos, comb->priv.root.vtxn_name); @@ -577,6 +580,9 @@ parse_vtxnroot_uri(dav_resource_combined if (parse_txnroot_uri(comb, path, label, use_checked_in)) return TRUE; + if (!comb->priv.root.txn_name) + return TRUE; + comb->priv.root.vtxn_name = comb->priv.root.txn_name; comb->priv.root.txn_name = dav_svn__get_txn(comb->priv.repos, comb->priv.root.vtxn_name); @@ -922,6 +928,10 @@ prep_working(dav_resource_combined *comb point. */ if (txn_name == NULL) { + if (!comb->priv.root.activity_id) + return dav_svn__new_error(comb->res.pool, HTTP_BAD_REQUEST, 0, + "The request did not specify an activity ID"); + txn_name = dav_svn__get_txn(comb->priv.repos, comb->priv.root.activity_id); if (txn_name == NULL) @@ -1032,8 +1042,13 @@ prep_working(dav_resource_combined *comb static dav_error * prep_activity(dav_resource_combined *comb) { - const char *txn_name = dav_svn__get_txn(comb->priv.repos, - comb->priv.root.activity_id); + const char *txn_name; + + if (!comb->priv.root.activity_id) + return dav_svn__new_error(comb->res.pool, HTTP_BAD_REQUEST, 0, + "The request did not specify an activity ID"); + + txn_name = dav_svn__get_txn(comb->priv.repos, comb->priv.root.activity_id); comb->priv.root.txn_name = txn_name; comb->res.exists = txn_name != NULL; @@ -1194,14 +1209,15 @@ static void log_warning(void *baton, svn AP_MODULE_DECLARE(dav_error *) -dav_svn_split_uri(request_rec *r, - const char *uri_to_split, - const char *root_path, - const char **cleaned_uri, - int *trailing_slash, - const char **repos_basename, - const char **relative_path, - const char **repos_path) +dav_svn_split_uri2(request_rec *r, + const char *uri_to_split, + const char *root_path, + const char **cleaned_uri, + int *trailing_slash, + const char **repos_basename, + const char **relative_path, + const char **repos_path, + apr_pool_t *pool) { apr_size_t len1; int had_slash; @@ -1217,7 +1233,7 @@ dav_svn_split_uri(request_rec *r, if ((fs_path == NULL) && (fs_parent_path == NULL)) { /* ### are SVN_ERR_APMOD codes within the right numeric space? */ - return dav_svn__new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, + return dav_svn__new_error(pool, HTTP_INTERNAL_SERVER_ERROR, SVN_ERR_APMOD_MISSING_PATH_TO_FS, "The server is misconfigured: " "either an SVNPath or SVNParentPath " @@ -1226,7 +1242,7 @@ dav_svn_split_uri(request_rec *r, } /* make a copy so that we can do some work on it */ - uri = apr_pstrdup(r->pool, uri_to_split); + uri = apr_pstrdup(pool, uri_to_split); /* remove duplicate slashes, and make sure URI has no trailing '/' */ ap_no2slash(uri); @@ -1241,7 +1257,7 @@ dav_svn_split_uri(request_rec *r, *trailing_slash = FALSE; /* return the first item. */ - *cleaned_uri = apr_pstrdup(r->pool, uri); + *cleaned_uri = apr_pstrdup(pool, uri); /* The URL space defined by the SVN provider is always a virtual space. Construct the path relative to the configured Location @@ -1282,7 +1298,7 @@ dav_svn_split_uri(request_rec *r, if (fs_path != NULL) { /* the repos_basename is the last component of root_path. */ - *repos_basename = svn_dirent_basename(root_path, r->pool); + *repos_basename = svn_dirent_basename(root_path, pool); /* 'relative' is already correct for SVNPath; the root_path already contains the name of the repository, so relative is @@ -1300,7 +1316,7 @@ dav_svn_split_uri(request_rec *r, if (relative[1] == '\0') { /* ### are SVN_ERR_APMOD codes within the right numeric space? */ - return dav_svn__new_error(r->pool, HTTP_FORBIDDEN, + return dav_svn__new_error(pool, HTTP_FORBIDDEN, SVN_ERR_APMOD_MALFORMED_URI, "The URI does not contain the name " "of a repository."); @@ -1317,7 +1333,7 @@ dav_svn_split_uri(request_rec *r, } else { - magic_component = apr_pstrndup(r->pool, relative + 1, + magic_component = apr_pstrndup(pool, relative + 1, magic_end - relative - 1); relative = magic_end; } @@ -1327,7 +1343,7 @@ dav_svn_split_uri(request_rec *r, } /* We can return 'relative' at this point too. */ - *relative_path = apr_pstrdup(r->pool, relative); + *relative_path = apr_pstrdup(pool, relative); /* Code to remove the !svn junk from the front of the relative path, mainly stolen from parse_uri(). This code assumes that @@ -1348,7 +1364,7 @@ dav_svn_split_uri(request_rec *r, if (ch == '\0') { /* relative is just "!svn", which is malformed. */ - return dav_svn__new_error(r->pool, HTTP_NOT_FOUND, + return dav_svn__new_error(pool, HTTP_NOT_FOUND, SVN_ERR_APMOD_MALFORMED_URI, "Nothing follows the svn special_uri."); } @@ -1375,7 +1391,7 @@ dav_svn_split_uri(request_rec *r, *repos_path = NULL; else return dav_svn__new_error( - r->pool, HTTP_NOT_FOUND, + pool, HTTP_NOT_FOUND, SVN_ERR_APMOD_MALFORMED_URI, "Missing info after special_uri."); } @@ -1399,7 +1415,7 @@ dav_svn_split_uri(request_rec *r, /* Did we break from the loop prematurely? */ if (j != (defn->numcomponents - 1)) return dav_svn__new_error( - r->pool, HTTP_NOT_FOUND, + pool, HTTP_NOT_FOUND, SVN_ERR_APMOD_MALFORMED_URI, "Not enough components after " "special_uri."); @@ -1413,13 +1429,13 @@ dav_svn_split_uri(request_rec *r, else { /* Found a slash after the special components. */ - *repos_path = apr_pstrdup(r->pool, start - 1); + *repos_path = apr_pstrdup(pool, start - 1); } } else { return - dav_svn__new_error(r->pool, HTTP_NOT_FOUND, + dav_svn__new_error(pool, HTTP_NOT_FOUND, SVN_ERR_APMOD_MALFORMED_URI, "Unknown data after special_uri."); } @@ -1430,7 +1446,7 @@ dav_svn_split_uri(request_rec *r, if (defn->name == NULL) return - dav_svn__new_error(r->pool, HTTP_NOT_FOUND, + dav_svn__new_error(pool, HTTP_NOT_FOUND, SVN_ERR_APMOD_MALFORMED_URI, "Couldn't match subdir after special_uri."); } @@ -1439,13 +1455,27 @@ dav_svn_split_uri(request_rec *r, { /* There's no "!svn/" at all, so the relative path is already a valid path within the repository. */ - *repos_path = apr_pstrdup(r->pool, relative - 1); + *repos_path = apr_pstrdup(pool, relative - 1); } } return NULL; } +AP_MODULE_DECLARE(dav_error *) +dav_svn_split_uri(request_rec *r, + const char *uri_to_split, + const char *root_path, + const char **cleaned_uri, + int *trailing_slash, + const char **repos_basename, + const char **relative_path, + const char **repos_path) +{ + return dav_svn_split_uri2(r, uri_to_split, root_path, cleaned_uri, + trailing_slash, repos_basename, relative_path, + repos_path, r->pool); +} /* Context for cleanup handler. */ struct cleanup_fs_access_baton @@ -4169,9 +4199,16 @@ typedef struct walker_ctx_t { } walker_ctx_t; - +/* Recursively walk a resource for walk(). When DEPTH != 0, recurse with + DEPTH-1 on child nodes. WALK_ROOT should be TRUE for the root and will be + FALSE for any descendants, to avoid unneeded work for every descendant + node. + */ static dav_error * -do_walk(walker_ctx_t *ctx, int depth) +do_walk(walker_ctx_t *ctx, + int depth, + svn_boolean_t walk_root, + apr_pool_t *scratch_pool) { const dav_walk_params *params = ctx->params; int isdir = ctx->res.collection; @@ -4235,28 +4272,31 @@ do_walk(walker_ctx_t *ctx, int depth) uri_len = ctx->uri->len; repos_len = ctx->repos_path->len; - /* Tell our logging subsystem that we're listing a directory. + if (walk_root) + { + /* Tell our logging subsystem that we're listing a directory. - Note: if we cared, we could look at the 'User-Agent:' request - header and distinguish an svn client ('svn ls') from a generic - DAV client. */ - dav_svn__operational_log(&ctx->info, - svn_log__get_dir(ctx->info.repos_path, - ctx->info.root.rev, - TRUE, FALSE, SVN_DIRENT_ALL, - params->pool)); + Note: if we cared, we could look at the 'User-Agent:' request + header and distinguish an svn client ('svn ls') from a generic + DAV client. */ + dav_svn__operational_log(&ctx->info, + svn_log__get_dir(ctx->info.repos_path, + ctx->info.root.rev, + TRUE, FALSE, SVN_DIRENT_ALL, + scratch_pool)); + } /* fetch this collection's children */ serr = svn_fs_dir_entries(&children, ctx->info.root.root, - ctx->info.repos_path, params->pool); + ctx->info.repos_path, scratch_pool); if (serr != NULL) return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR, "could not fetch collection members", params->pool); /* iterate over the children in this collection */ - iterpool = svn_pool_create(params->pool); - for (hi = apr_hash_first(params->pool, children); hi; hi = apr_hash_next(hi)) + iterpool = svn_pool_create(scratch_pool); + for (hi = apr_hash_first(scratch_pool, children); hi; hi = apr_hash_next(hi)) { const void *key; apr_ssize_t klen; @@ -4297,7 +4337,10 @@ do_walk(walker_ctx_t *ctx, int depth) { err = (*params->func)(&ctx->wres, DAV_CALLTYPE_MEMBER); if (err != NULL) - return err; + { + svn_pool_destroy(iterpool); + return err; + } } else { @@ -4309,9 +4352,12 @@ do_walk(walker_ctx_t *ctx, int depth) ctx->res.uri = ctx->uri->data; /* recurse on this collection */ - err = do_walk(ctx, depth - 1); + err = do_walk(ctx, depth - 1, FALSE, iterpool); if (err != NULL) - return err; + { + svn_pool_destroy(iterpool); + return err; + } /* restore the data */ ctx->res.collection = FALSE; @@ -4391,7 +4437,7 @@ walk(const dav_walk_params *params, int /* ### is the root already/always open? need to verify */ /* always return the error, and any/all multistatus responses */ - err = do_walk(&ctx, depth); + err = do_walk(&ctx, depth, TRUE, params->pool); *response = ctx.wres.response; return err;
Modified: subversion/branches/svn-auth-x509/subversion/mod_dav_svn/version.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/mod_dav_svn/version.c?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/mod_dav_svn/version.c (original) +++ subversion/branches/svn-auth-x509/subversion/mod_dav_svn/version.c Fri Jan 16 14:01:35 2015 @@ -1381,20 +1381,10 @@ release_locks(apr_hash_t *locks, request_rec *r, apr_pool_t *pool) { - apr_hash_index_t *hi; apr_pool_t *subpool = svn_pool_create(pool); - apr_hash_t *targets = apr_hash_make(subpool); svn_error_t *err; - for (hi = apr_hash_first(subpool, locks); hi; hi = apr_hash_next(hi)) - { - const char *path = apr_hash_this_key(hi); - const char *token = apr_hash_this_val(hi); - - svn_hash_sets(targets, path, token); - } - - err = svn_repos_fs_unlock_many(repos, targets, FALSE, unlock_many_cb, r, + err = svn_repos_fs_unlock_many(repos, locks, FALSE, unlock_many_cb, r, subpool, subpool); if (err) /* If we got an error, just log it and move along. */
