You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2013/05/10 16:58:56 UTC
svn commit: r1481041 [33/38] - in /subversion/branches/master-passphrase: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
contrib/client-side/svncopy/ contrib/hook-scripts/
contrib/server-side/fsfsfixer/ contrib/server-side/fsfsf...
Modified: subversion/branches/master-passphrase/subversion/svnserve/serve.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/svnserve/serve.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/svnserve/serve.c (original)
+++ subversion/branches/master-passphrase/subversion/svnserve/serve.c Fri May 10 14:58:47 2013
@@ -35,6 +35,7 @@
#include "svn_compat.h"
#include "svn_private_config.h" /* For SVN_PATH_LOCAL_SEPARATOR */
+#include "svn_hash.h"
#include "svn_types.h"
#include "svn_string.h"
#include "svn_pools.h"
@@ -52,6 +53,7 @@
#include "private/svn_log.h"
#include "private/svn_mergeinfo_private.h"
+#include "private/svn_ra_svn_private.h"
#include "private/svn_fspath.h"
#ifdef HAVE_UNISTD_H
@@ -189,10 +191,10 @@ log_fail_and_flush(svn_error_t *err, ser
svn_error_t *io_err;
log_server_error(err, server, conn, pool);
- io_err = svn_ra_svn_write_cmd_failure(conn, pool, err);
+ io_err = svn_ra_svn__write_cmd_failure(conn, pool, err);
svn_error_clear(err);
SVN_ERR(io_err);
- return svn_ra_svn_flush(conn, pool);
+ return svn_ra_svn__flush(conn, pool);
}
/* Log a client command. */
@@ -244,7 +246,7 @@ log_authz_denied(const char *path,
timestr = svn_time_to_cstring(apr_time_now(), pool);
remote_host = svn_ra_svn_conn_remote_host(conn);
- line = apr_psprintf(pool, "%" APR_PID_T_FMT
+ line = apr_psprintf(pool, "%" APR_PID_T_FMT
" %s %s %s %s Authorization Failed %s%s %s" APR_EOL_STR,
getpid(), timestr,
(remote_host ? remote_host : "-"),
@@ -274,7 +276,8 @@ svn_error_t *load_pwdb_config(server_bat
pwdb_path = svn_dirent_internal_style(pwdb_path, pool);
pwdb_path = svn_dirent_join(server->base, pwdb_path, pool);
- err = svn_config_read2(&server->pwdb, pwdb_path, TRUE, FALSE, pool);
+ err = svn_config_read3(&server->pwdb, pwdb_path, TRUE,
+ FALSE, FALSE, pool);
if (err)
{
log_server_error(err, server, conn, pool);
@@ -306,29 +309,35 @@ svn_error_t *load_pwdb_config(server_bat
return SVN_NO_ERROR;
}
-/* Canonicalize ACCESS_FILE based on the type of argument.
- * SERVER baton is used to convert relative paths to absolute paths
- * rooted at the server root. */
-static const char *
-canonicalize_access_file(const char *access_file,
- server_baton_t *server,
- apr_pool_t *pool)
+/* Canonicalize *ACCESS_FILE based on the type of argument. Results are
+ * placed in *ACCESS_FILE. SERVER baton is used to convert relative paths to
+ * absolute paths rooted at the server root. REPOS_ROOT is used to calculate
+ * an absolute URL for repos-relative URLs. */
+static svn_error_t *
+canonicalize_access_file(const char **access_file, server_baton_t *server,
+ const char *repos_root, apr_pool_t *pool)
{
- if (svn_path_is_url(access_file))
+ if (svn_path_is_url(*access_file))
{
- access_file = svn_uri_canonicalize(access_file, pool);
+ *access_file = svn_uri_canonicalize(*access_file, pool);
}
- else if (!svn_path_is_repos_relative_url(access_file))
+ else if (svn_path_is_repos_relative_url(*access_file))
{
- access_file = svn_dirent_internal_style(access_file, pool);
- access_file = svn_dirent_join(server->base, access_file, pool);
- }
+ const char *repos_root_url;
- /* We don't canonicalize repos relative urls since they get
- * canonicalized inside svn_repos_authz_read2() when they
- * are resolved. */
+ SVN_ERR(svn_uri_get_file_url_from_dirent(&repos_root_url, repos_root,
+ pool));
+ SVN_ERR(svn_path_resolve_repos_relative_url(access_file, *access_file,
+ repos_root_url, pool));
+ *access_file = svn_uri_canonicalize(*access_file, pool);
+ }
+ else
+ {
+ *access_file = svn_dirent_internal_style(*access_file, pool);
+ *access_file = svn_dirent_join(server->base, *access_file, pool);
+ }
- return access_file;
+ return SVN_NO_ERROR;
}
svn_error_t *load_authz_config(server_baton_t *server,
@@ -352,15 +361,18 @@ svn_error_t *load_authz_config(server_ba
const char *case_force_val;
/* Canonicalize and add the base onto the authzdb_path (if needed). */
- authzdb_path = canonicalize_access_file(authzdb_path, server, pool);
+ err = canonicalize_access_file(&authzdb_path, server,
+ repos_root, pool);
/* Same for the groupsdb_path if it is present. */
- if (groupsdb_path)
- groupsdb_path = canonicalize_access_file(groupsdb_path,
- server, pool);
+ if (groupsdb_path && !err)
+ err = canonicalize_access_file(&groupsdb_path, server,
+ repos_root, pool);
+
+ if (!err)
+ err = svn_repos_authz_read2(&server->authzdb, authzdb_path,
+ groupsdb_path, TRUE, pool);
- err = svn_repos_authz_read2(&server->authzdb, authzdb_path,
- groupsdb_path, TRUE, repos_root, pool);
if (err)
{
log_server_error(err, server, conn, pool);
@@ -552,11 +564,11 @@ static svn_error_t *send_mechs(svn_ra_sv
svn_boolean_t needs_username)
{
if (!needs_username && get_access(b, UNAUTHENTICATED) >= required)
- SVN_ERR(svn_ra_svn_write_word(conn, pool, "ANONYMOUS"));
+ SVN_ERR(svn_ra_svn__write_word(conn, pool, "ANONYMOUS"));
if (b->tunnel_user && get_access(b, AUTHENTICATED) >= required)
- SVN_ERR(svn_ra_svn_write_word(conn, pool, "EXTERNAL"));
+ SVN_ERR(svn_ra_svn__write_word(conn, pool, "EXTERNAL"));
if (b->pwdb && get_access(b, AUTHENTICATED) >= required)
- SVN_ERR(svn_ra_svn_write_word(conn, pool, "CRAM-MD5"));
+ SVN_ERR(svn_ra_svn__write_word(conn, pool, "CRAM-MD5"));
return SVN_NO_ERROR;
}
@@ -629,10 +641,10 @@ static svn_error_t *auth(svn_ra_svn_conn
&& b->tunnel_user && strcmp(mech, "EXTERNAL") == 0)
{
if (*mecharg && strcmp(mecharg, b->tunnel_user) != 0)
- return svn_ra_svn_write_tuple(conn, pool, "w(c)", "failure",
- "Requested username does not match");
+ return svn_ra_svn__write_tuple(conn, pool, "w(c)", "failure",
+ "Requested username does not match");
b->user = b->tunnel_user;
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w()", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w()", "success"));
*success = TRUE;
return SVN_NO_ERROR;
}
@@ -640,7 +652,7 @@ static svn_error_t *auth(svn_ra_svn_conn
if (get_access(b, UNAUTHENTICATED) >= required
&& strcmp(mech, "ANONYMOUS") == 0 && ! needs_username)
{
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w()", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w()", "success"));
*success = TRUE;
return SVN_NO_ERROR;
}
@@ -653,7 +665,7 @@ static svn_error_t *auth(svn_ra_svn_conn
return SVN_NO_ERROR;
}
- return svn_ra_svn_write_tuple(conn, pool, "w(c)", "failure",
+ return svn_ra_svn__write_tuple(conn, pool, "w(c)", "failure",
"Must authenticate with listed mechanism");
}
@@ -666,12 +678,12 @@ internal_auth_request(svn_ra_svn_conn_t
svn_boolean_t success;
const char *mech, *mecharg;
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w((!", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "success"));
SVN_ERR(send_mechs(conn, pool, b, required, needs_username));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)c)", b->realm));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)c)", b->realm));
do
{
- SVN_ERR(svn_ra_svn_read_tuple(conn, pool, "w(?c)", &mech, &mecharg));
+ SVN_ERR(svn_ra_svn__read_tuple(conn, pool, "w(?c)", &mech, &mecharg));
if (!*mech)
break;
SVN_ERR(auth(conn, pool, mech, mecharg, b, required, needs_username,
@@ -704,7 +716,7 @@ static svn_error_t *auth_request(svn_ra_
static svn_error_t *trivial_auth_request(svn_ra_svn_conn_t *conn,
apr_pool_t *pool, server_baton_t *b)
{
- return svn_ra_svn_write_cmd_response(conn, pool, "()c", "");
+ return svn_ra_svn__write_cmd_response(conn, pool, "()c", "");
}
/* Ensure that the client has the REQUIRED access by checking the
@@ -827,7 +839,7 @@ static svn_error_t *set_path(svn_ra_svn_
svn_depth_t depth = svn_depth_infinity;
svn_boolean_t start_empty;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "crb?(?c)?w",
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "crb?(?c)?w",
&path, &rev, &start_empty, &lock_token,
&depth_word));
if (depth_word)
@@ -850,7 +862,7 @@ static svn_error_t *delete_path(svn_ra_s
report_driver_baton_t *b = baton;
const char *path;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c", &path));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c", &path));
path = svn_relpath_canonicalize(path, pool);
if (!b->err)
b->err = svn_repos_delete_path(b->report_baton, path, pool);
@@ -867,7 +879,7 @@ static svn_error_t *link_path(svn_ra_svn
/* Default to infinity, for old clients that don't send depth. */
svn_depth_t depth = svn_depth_infinity;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "ccrb?(?c)?w",
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "ccrb?(?c)?w",
&path, &url, &rev, &start_empty,
&lock_token, &depth_word));
@@ -972,7 +984,7 @@ static svn_error_t *accept_report(svn_bo
rb.from_rev = from_rev;
if (from_rev)
*from_rev = SVN_INVALID_REVNUM;
- err = svn_ra_svn_handle_commands2(conn, pool, report_commands, &rb, TRUE);
+ err = svn_ra_svn__handle_commands2(conn, pool, report_commands, &rb, TRUE);
if (err)
{
/* Network or protocol error while handling commands. */
@@ -984,7 +996,7 @@ static svn_error_t *accept_report(svn_bo
/* Some failure during the reporting or editing operations. */
SVN_CMD_ERR(rb.err);
}
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
if (only_empty_entry)
*only_empty_entry = rb.entry_counter == 1 && rb.only_empty_entries;
@@ -1006,8 +1018,8 @@ static svn_error_t *write_prop_diffs(svn
{
const svn_prop_t *prop = &APR_ARRAY_IDX(propdiffs, i, svn_prop_t);
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "c(?s)",
- prop->name, prop->value));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "c(?s)",
+ prop->name, prop->value));
}
return SVN_NO_ERROR;
@@ -1023,9 +1035,9 @@ static svn_error_t *write_lock(svn_ra_sv
cdate = svn_time_to_cstring(lock->creation_date, pool);
edate = lock->expiration_date
? svn_time_to_cstring(lock->expiration_date, pool) : NULL;
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "ccc(?c)c(?c)", lock->path,
- lock->token, lock->owner, lock->comment,
- cdate, edate));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "ccc(?c)c(?c)", lock->path,
+ lock->token, lock->owner, lock->comment,
+ cdate, edate));
return SVN_NO_ERROR;
}
@@ -1055,19 +1067,16 @@ get_props(apr_hash_t **props,
path, pool));
str = svn_string_create(apr_psprintf(pool, "%ld", crev),
pool);
- apr_hash_set(*props, SVN_PROP_ENTRY_COMMITTED_REV, APR_HASH_KEY_STRING,
- str);
+ svn_hash_sets(*props, SVN_PROP_ENTRY_COMMITTED_REV, str);
str = (cdate) ? svn_string_create(cdate, pool) : NULL;
- apr_hash_set(*props, SVN_PROP_ENTRY_COMMITTED_DATE, APR_HASH_KEY_STRING,
- str);
+ svn_hash_sets(*props, SVN_PROP_ENTRY_COMMITTED_DATE, str);
str = (cauthor) ? svn_string_create(cauthor, pool) : NULL;
- apr_hash_set(*props, SVN_PROP_ENTRY_LAST_AUTHOR, APR_HASH_KEY_STRING,
- str);
+ svn_hash_sets(*props, SVN_PROP_ENTRY_LAST_AUTHOR, str);
/* Hardcode the values for the UUID. */
SVN_ERR(svn_fs_get_uuid(svn_fs_root_fs(root), &uuid, pool));
str = (uuid) ? svn_string_create(uuid, pool) : NULL;
- apr_hash_set(*props, SVN_PROP_ENTRY_UUID, APR_HASH_KEY_STRING, str);
+ svn_hash_sets(*props, SVN_PROP_ENTRY_UUID, str);
}
/* Get any inherited properties the user is authorized to. */
@@ -1090,7 +1099,7 @@ static svn_error_t *reparent(svn_ra_svn_
const char *url;
const char *fs_path;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c", &url));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c", &url));
url = svn_uri_canonicalize(url, pool);
SVN_ERR(trivial_auth_request(conn, pool, b));
SVN_CMD_ERR(get_fs_path(svn_path_uri_decode(b->repos_url, pool),
@@ -1098,7 +1107,7 @@ static svn_error_t *reparent(svn_ra_svn_
&fs_path));
SVN_ERR(log_command(b, conn, pool, "%s", svn_log__reparent(fs_path, pool)));
svn_stringbuf_set(b->fs_path, fs_path);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -1112,7 +1121,7 @@ static svn_error_t *get_latest_rev(svn_r
SVN_ERR(trivial_auth_request(conn, pool, b));
SVN_CMD_ERR(svn_fs_youngest_rev(&rev, b->fs, pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "r", rev));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "r", rev));
return SVN_NO_ERROR;
}
@@ -1124,13 +1133,13 @@ static svn_error_t *get_dated_rev(svn_ra
apr_time_t tm;
const char *timestr;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c", ×tr));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c", ×tr));
SVN_ERR(log_command(b, conn, pool, "get-dated-rev %s", timestr));
SVN_ERR(trivial_auth_request(conn, pool, b));
SVN_CMD_ERR(svn_time_from_cstring(&tm, timestr, pool));
SVN_CMD_ERR(svn_repos_dated_revision(&rev, b->repos, tm, pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "r", rev));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "r", rev));
return SVN_NO_ERROR;
}
@@ -1156,7 +1165,7 @@ static svn_error_t *do_change_rev_prop(s
TRUE, TRUE,
authz_check_access_cb_func(b), &ab,
pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -1172,9 +1181,9 @@ static svn_error_t *change_rev_prop2(svn
svn_string_t *old_value;
svn_boolean_t dont_care;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "rc(?s)(b?s)",
- &rev, &name, &value,
- &dont_care, &old_value));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "rc(?s)(b?s)",
+ &rev, &name, &value,
+ &dont_care, &old_value));
/* Argument parsing. */
if (dont_care)
@@ -1208,7 +1217,7 @@ static svn_error_t *change_rev_prop(svn_
/* Because the revprop value was at one time mandatory, the usual
optional element pattern "(?s)" isn't used. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "rc?s", &rev, &name, &value));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "rc?s", &rev, &name, &value));
SVN_ERR(do_change_rev_prop(conn, b, rev, name, NULL, value, pool));
@@ -1226,16 +1235,16 @@ static svn_error_t *rev_proplist(svn_ra_
ab.server = b;
ab.conn = conn;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "r", &rev));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "r", &rev));
SVN_ERR(log_command(b, conn, pool, "%s", svn_log__rev_proplist(rev, pool)));
SVN_ERR(trivial_auth_request(conn, pool, b));
SVN_CMD_ERR(svn_repos_fs_revision_proplist(&props, b->repos, rev,
authz_check_access_cb_func(b), &ab,
pool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w((!", "success"));
- SVN_ERR(svn_ra_svn_write_proplist(conn, pool, props));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!))"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "success"));
+ SVN_ERR(svn_ra_svn__write_proplist(conn, pool, props));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!))"));
return SVN_NO_ERROR;
}
@@ -1251,7 +1260,7 @@ static svn_error_t *rev_prop(svn_ra_svn_
ab.server = b;
ab.conn = conn;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "rc", &rev, &name));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "rc", &rev, &name));
SVN_ERR(log_command(b, conn, pool, "%s",
svn_log__rev_prop(rev, name, pool)));
@@ -1259,7 +1268,7 @@ static svn_error_t *rev_prop(svn_ra_svn_
SVN_CMD_ERR(svn_repos_fs_revision_prop(&value, b->repos, rev, name,
authz_check_access_cb_func(b), &ab,
pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "(?s)", value));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "(?s)", value));
return SVN_NO_ERROR;
}
@@ -1405,7 +1414,7 @@ static svn_error_t *commit(svn_ra_svn_co
{
/* Clients before 1.2 don't send lock-tokens, keep-locks,
and rev-props fields. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c", &log_msg));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c", &log_msg));
lock_tokens = NULL;
keep_locks = TRUE;
revprop_list = NULL;
@@ -1413,9 +1422,9 @@ static svn_error_t *commit(svn_ra_svn_co
else
{
/* Clients before 1.5 don't send the rev-props field. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "clb?l", &log_msg,
- &lock_tokens, &keep_locks,
- &revprop_list));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "clb?l", &log_msg,
+ &lock_tokens, &keep_locks,
+ &revprop_list));
}
/* The handling for locks is a little problematic, because the
@@ -1433,18 +1442,18 @@ static svn_error_t *commit(svn_ra_svn_co
SVN_CMD_ERR(add_lock_tokens(conn, lock_tokens, b, pool));
if (revprop_list)
- SVN_ERR(svn_ra_svn_parse_proplist(revprop_list, pool, &revprop_table));
+ SVN_ERR(svn_ra_svn__parse_proplist(revprop_list, pool, &revprop_table));
else
{
revprop_table = apr_hash_make(pool);
- apr_hash_set(revprop_table, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING,
- svn_string_create(log_msg, pool));
+ svn_hash_sets(revprop_table, SVN_PROP_REVISION_LOG,
+ svn_string_create(log_msg, pool));
}
/* Get author from the baton, making sure clients can't circumvent
the authentication via the revision props. */
- apr_hash_set(revprop_table, SVN_PROP_REVISION_AUTHOR, APR_HASH_KEY_STRING,
- b->user ? svn_string_create(b->user, pool) : NULL);
+ svn_hash_sets(revprop_table, SVN_PROP_REVISION_AUTHOR,
+ b->user ? svn_string_create(b->user, pool) : NULL);
ccb.pool = pool;
ccb.new_rev = &new_rev;
@@ -1458,8 +1467,9 @@ static svn_error_t *commit(svn_ra_svn_co
b->fs_path->data, revprop_table,
commit_done, &ccb,
authz_commit_cb, &ab, pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
- SVN_ERR(svn_ra_svn_drive_editor(conn, pool, editor, edit_baton, &aborted));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn_drive_editor2(conn, pool, editor, edit_baton,
+ &aborted, FALSE));
if (!aborted)
{
SVN_ERR(log_command(b, conn, pool, "%s",
@@ -1478,8 +1488,8 @@ static svn_error_t *commit(svn_ra_svn_co
if (! keep_locks && lock_tokens && lock_tokens->nelts)
SVN_ERR(unlock_paths(lock_tokens, b, conn, pool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "r(?c)(?c)(?c)",
- new_rev, date, author, post_commit_err));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "r(?c)(?c)(?c)",
+ new_rev, date, author, post_commit_err));
if (! b->tunnel)
SVN_ERR(svn_fs_deltify_revision(b->fs, new_rev, pool));
@@ -1511,9 +1521,9 @@ static svn_error_t *get_file(svn_ra_svn_
ab.conn = conn;
/* Parse arguments. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?r)bb?B", &path, &rev,
- &want_props, &want_contents,
- &wants_inherited_props));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c(?r)bb?B", &path, &rev,
+ &want_props, &want_contents,
+ &wants_inherited_props));
full_path = svn_fspath__join(b->fs_path->data,
svn_relpath_canonicalize(path, pool), pool);
@@ -1541,31 +1551,31 @@ static svn_error_t *get_file(svn_ra_svn_
SVN_CMD_ERR(svn_fs_file_contents(&contents, root, full_path, pool));
/* Send successful command response with revision and props. */
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w((?c)r(!", "success",
- hex_digest, rev));
- SVN_ERR(svn_ra_svn_write_proplist(conn, pool, props));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((?c)r(!", "success",
+ hex_digest, rev));
+ SVN_ERR(svn_ra_svn__write_proplist(conn, pool, props));
if (wants_inherited_props)
{
apr_pool_t *iterpool = svn_pool_create(pool);
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)(?!"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)(?!"));
for (i = 0; i < inherited_props->nelts; i++)
{
svn_prop_inherited_item_t *iprop =
APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
svn_pool_clear(iterpool);
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!(c(!",
- iprop->path_or_url));
- SVN_ERR(svn_ra_svn_write_proplist(conn, iterpool, iprop->prop_hash));
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!))!",
- iprop->path_or_url));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!(c(!",
+ iprop->path_or_url));
+ SVN_ERR(svn_ra_svn__write_proplist(conn, iterpool, iprop->prop_hash));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!))!",
+ iprop->path_or_url));
}
svn_pool_destroy(iterpool);
}
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!))"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!))"));
/* Now send the file's contents. */
if (want_contents)
@@ -1581,7 +1591,7 @@ static svn_error_t *get_file(svn_ra_svn_
{
write_str.data = buf;
write_str.len = len;
- SVN_ERR(svn_ra_svn_write_string(conn, pool, &write_str));
+ SVN_ERR(svn_ra_svn__write_string(conn, pool, &write_str));
}
if (len < sizeof(buf))
{
@@ -1589,14 +1599,14 @@ static svn_error_t *get_file(svn_ra_svn_
break;
}
}
- write_err = svn_ra_svn_write_cstring(conn, pool, "");
+ write_err = svn_ra_svn__write_cstring(conn, pool, "");
if (write_err)
{
svn_error_clear(err);
return write_err;
}
SVN_CMD_ERR(err);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
}
return SVN_NO_ERROR;
@@ -1624,10 +1634,10 @@ static svn_error_t *get_dir(svn_ra_svn_c
ab.server = b;
ab.conn = conn;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?r)bb?l?B", &path, &rev,
- &want_props, &want_contents,
- &dirent_fields_list,
- &wants_inherited_props));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c(?r)bb?l?B", &path, &rev,
+ &want_props, &want_contents,
+ &dirent_fields_list,
+ &wants_inherited_props));
if (! dirent_fields_list)
{
@@ -1685,9 +1695,9 @@ static svn_error_t *get_dir(svn_ra_svn_c
pool));
/* Begin response ... */
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w(r(!", "success", rev));
- SVN_ERR(svn_ra_svn_write_proplist(conn, pool, props));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)(!"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w(r(!", "success", rev));
+ SVN_ERR(svn_ra_svn__write_proplist(conn, pool, props));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)(!"));
/* Fetch the directory entries if requested and send them immediately. */
if (want_contents)
@@ -1765,11 +1775,11 @@ static svn_error_t *get_dir(svn_ra_svn_c
cdate = missing_date;
/* Send the entry. */
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "cwnbr(?c)(?c)", name,
- svn_node_kind_to_word(entry_kind),
- (apr_uint64_t) entry_size,
- has_props, created_rev,
- cdate, last_author));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "cwnbr(?c)(?c)", name,
+ svn_node_kind_to_word(entry_kind),
+ (apr_uint64_t) entry_size,
+ has_props, created_rev,
+ cdate, last_author));
}
svn_pool_destroy(subpool);
}
@@ -1778,24 +1788,24 @@ static svn_error_t *get_dir(svn_ra_svn_c
{
apr_pool_t *iterpool = svn_pool_create(pool);
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)(?!"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)(?!"));
for (i = 0; i < inherited_props->nelts; i++)
{
svn_prop_inherited_item_t *iprop =
APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
svn_pool_clear(iterpool);
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!(c(!",
- iprop->path_or_url));
- SVN_ERR(svn_ra_svn_write_proplist(conn, iterpool, iprop->prop_hash));
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!))!",
- iprop->path_or_url));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!(c(!",
+ iprop->path_or_url));
+ SVN_ERR(svn_ra_svn__write_proplist(conn, iterpool, iprop->prop_hash));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!))!",
+ iprop->path_or_url));
}
svn_pool_destroy(iterpool);
}
/* Finish response. */
- return svn_ra_svn_write_tuple(conn, pool, "!))");
+ return svn_ra_svn__write_tuple(conn, pool, "!))");
}
static svn_error_t *update(svn_ra_svn_conn_t *conn, apr_pool_t *pool,
@@ -1805,16 +1815,17 @@ static svn_error_t *update(svn_ra_svn_co
svn_revnum_t rev;
const char *target, *full_path, *depth_word;
svn_boolean_t recurse;
- svn_boolean_t send_copyfrom_args;
- apr_uint64_t send_copyfrom_param;
+ svn_tristate_t send_copyfrom_args; /* Optional; default FALSE */
+ svn_tristate_t ignore_ancestry; /* Optional; default FALSE */
/* Default to unknown. Old clients won't send depth, but we'll
handle that by converting recurse if necessary. */
svn_depth_t depth = svn_depth_unknown;
svn_boolean_t is_checkout;
/* Parse the arguments. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "(?r)cb?wB", &rev, &target,
- &recurse, &depth_word, &send_copyfrom_param));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?r)cb?w3?3", &rev, &target,
+ &recurse, &depth_word,
+ &send_copyfrom_args, &ignore_ancestry));
target = svn_relpath_canonicalize(target, pool);
if (depth_word)
@@ -1822,9 +1833,6 @@ static svn_error_t *update(svn_ra_svn_co
else
depth = SVN_DEPTH_INFINITY_OR_FILES(recurse);
- send_copyfrom_args = (send_copyfrom_param == SVN_RA_SVN_UNSPECIFIED_NUMBER) ?
- FALSE : (svn_boolean_t) send_copyfrom_param;
-
full_path = svn_fspath__join(b->fs_path->data, target, pool);
/* Check authorization and authenticate the user if necessary. */
SVN_ERR(must_have_access(conn, pool, b, svn_authz_read, full_path, FALSE));
@@ -1834,7 +1842,9 @@ static svn_error_t *update(svn_ra_svn_co
SVN_ERR(accept_report(&is_checkout, NULL,
conn, pool, b, rev, target, NULL, TRUE,
- depth, send_copyfrom_args, FALSE));
+ depth,
+ (send_copyfrom_args == svn_tristate_true),
+ (ignore_ancestry == svn_tristate_true)));
if (is_checkout)
{
SVN_ERR(log_command(b, conn, pool, "%s",
@@ -1845,7 +1855,9 @@ static svn_error_t *update(svn_ra_svn_co
{
SVN_ERR(log_command(b, conn, pool, "%s",
svn_log__update(full_path, rev, depth,
- send_copyfrom_args, pool)));
+ (send_copyfrom_args
+ == svn_tristate_true),
+ pool)));
}
return SVN_NO_ERROR;
@@ -1862,13 +1874,13 @@ static svn_error_t *switch_cmd(svn_ra_sv
/* Default to unknown. Old clients won't send depth, but we'll
handle that by converting recurse if necessary. */
svn_depth_t depth = svn_depth_unknown;
- apr_uint64_t send_copyfrom_args; /* Optional; default FALSE */
- apr_uint64_t ignore_ancestry; /* Optional; default TRUE */
+ svn_tristate_t send_copyfrom_args; /* Optional; default FALSE */
+ svn_tristate_t ignore_ancestry; /* Optional; default TRUE */
/* Parse the arguments. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "(?r)cbc?w?BB", &rev, &target,
- &recurse, &switch_url, &depth_word,
- &send_copyfrom_args, &ignore_ancestry));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?r)cbc?w?33", &rev, &target,
+ &recurse, &switch_url, &depth_word,
+ &send_copyfrom_args, &ignore_ancestry));
target = svn_relpath_canonicalize(target, pool);
switch_url = svn_uri_canonicalize(switch_url, pool);
@@ -1895,8 +1907,8 @@ static svn_error_t *switch_cmd(svn_ra_sv
return accept_report(NULL, NULL,
conn, pool, b, rev, target, switch_path, TRUE,
depth,
- (send_copyfrom_args == TRUE) /* send_copyfrom_args */,
- (ignore_ancestry != FALSE) /* ignore_ancestry */);
+ (send_copyfrom_args == svn_tristate_true),
+ (ignore_ancestry != svn_tristate_false));
}
static svn_error_t *status(svn_ra_svn_conn_t *conn, apr_pool_t *pool,
@@ -1911,8 +1923,8 @@ static svn_error_t *status(svn_ra_svn_co
svn_depth_t depth = svn_depth_unknown;
/* Parse the arguments. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "cb?(?r)?w",
- &target, &recurse, &rev, &depth_word));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "cb?(?r)?w",
+ &target, &recurse, &rev, &depth_word));
target = svn_relpath_canonicalize(target, pool);
if (depth_word)
@@ -1950,17 +1962,17 @@ static svn_error_t *diff(svn_ra_svn_conn
if (params->nelts == 5)
{
/* Clients before 1.4 don't send the text_deltas boolean or depth. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "(?r)cbbc", &rev, &target,
- &recurse, &ignore_ancestry, &versus_url));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?r)cbbc", &rev, &target,
+ &recurse, &ignore_ancestry, &versus_url));
text_deltas = TRUE;
depth_word = NULL;
}
else
{
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "(?r)cbbcb?w",
- &rev, &target, &recurse,
- &ignore_ancestry, &versus_url,
- &text_deltas, &depth_word));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?r)cbbcb?w",
+ &rev, &target, &recurse,
+ &ignore_ancestry, &versus_url,
+ &text_deltas, &depth_word));
}
target = svn_relpath_canonicalize(target, pool);
versus_url = svn_uri_canonicalize(versus_url, pool);
@@ -2016,8 +2028,8 @@ static svn_error_t *get_mergeinfo(svn_ra
ab.server = b;
ab.conn = conn;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "l(?r)wb", &paths, &rev,
- &inherit_word, &include_descendants));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "l(?r)wb", &paths, &rev,
+ &inherit_word, &include_descendants));
inherit = svn_inheritance_from_word(inherit_word);
/* Canonicalize the paths which mergeinfo has been requested for. */
@@ -2049,7 +2061,7 @@ static svn_error_t *get_mergeinfo(svn_ra
pool));
SVN_ERR(svn_mergeinfo__remove_prefix_from_catalog(&mergeinfo, mergeinfo,
b->fs_path->data, pool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w((!", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "success"));
iterpool = svn_pool_create(pool);
for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi))
{
@@ -2060,11 +2072,11 @@ static svn_error_t *get_mergeinfo(svn_ra
svn_pool_clear(iterpool);
SVN_ERR(svn_mergeinfo_to_string(&mergeinfo_string, value, iterpool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "cs", key,
- mergeinfo_string));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "cs", key,
+ mergeinfo_string));
}
svn_pool_destroy(iterpool);
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!))"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!))"));
return SVN_NO_ERROR;
}
@@ -2096,7 +2108,7 @@ static svn_error_t *log_receiver(void *b
b->stack_depth--;
}
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "(!"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "(!"));
if (log_entry->changed_paths2)
{
for (h = apr_hash_first(pool, log_entry->changed_paths2); h;
@@ -2107,7 +2119,7 @@ static svn_error_t *log_receiver(void *b
action[0] = change->action;
action[1] = '\0';
- SVN_ERR(svn_ra_svn_write_tuple(
+ SVN_ERR(svn_ra_svn__write_tuple(
conn, pool, "cw(?cr)(cbb)",
path,
action,
@@ -2125,14 +2137,14 @@ static svn_error_t *log_receiver(void *b
revprop_count = apr_hash_count(log_entry->revprops);
else
revprop_count = 0;
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)r(?c)(?c)(?c)bbn(!",
- log_entry->revision,
- author, date, message,
- log_entry->has_children,
- invalid_revnum, revprop_count));
- SVN_ERR(svn_ra_svn_write_proplist(conn, pool, log_entry->revprops));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)b",
- log_entry->subtractive_merge));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)r(?c)(?c)(?c)bbn(!",
+ log_entry->revision,
+ author, date, message,
+ log_entry->has_children,
+ invalid_revnum, revprop_count));
+ SVN_ERR(svn_ra_svn__write_proplist(conn, pool, log_entry->revprops));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)b",
+ log_entry->subtractive_merge));
if (log_entry->has_children)
b->stack_depth++;
@@ -2159,11 +2171,11 @@ static svn_error_t *log_cmd(svn_ra_svn_c
ab.server = b;
ab.conn = conn;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "l(?r)(?r)bb?n?Bwl", &paths,
- &start_rev, &end_rev, &send_changed_paths,
- &strict_node, &limit,
- &include_merged_revs_param,
- &revprop_word, &revprop_items));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "l(?r)(?r)bb?n?Bwl", &paths,
+ &start_rev, &end_rev, &send_changed_paths,
+ &strict_node, &limit,
+ &include_merged_revs_param,
+ &revprop_word, &revprop_items));
if (include_merged_revs_param == SVN_RA_SVN_UNSPECIFIED_NUMBER)
include_merged_revisions = FALSE;
@@ -2231,14 +2243,14 @@ static svn_error_t *log_cmd(svn_ra_svn_c
authz_check_access_cb_func(b), &ab, log_receiver,
&lb, pool);
- write_err = svn_ra_svn_write_word(conn, pool, "done");
+ write_err = svn_ra_svn__write_word(conn, pool, "done");
if (write_err)
{
svn_error_clear(err);
return write_err;
}
SVN_CMD_ERR(err);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -2251,7 +2263,7 @@ static svn_error_t *check_path(svn_ra_sv
svn_fs_root_t *root;
svn_node_kind_t kind;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?r)", &path, &rev));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c(?r)", &path, &rev));
full_path = svn_fspath__join(b->fs_path->data,
svn_relpath_canonicalize(path, pool), pool);
@@ -2267,8 +2279,8 @@ static svn_error_t *check_path(svn_ra_sv
SVN_CMD_ERR(svn_fs_revision_root(&root, b->fs, rev, pool));
SVN_CMD_ERR(svn_fs_check_path(&kind, root, full_path, pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "w",
- svn_node_kind_to_word(kind)));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "w",
+ svn_node_kind_to_word(kind)));
return SVN_NO_ERROR;
}
@@ -2281,7 +2293,7 @@ static svn_error_t *stat_cmd(svn_ra_svn_
svn_fs_root_t *root;
svn_dirent_t *dirent;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?r)", &path, &rev));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c(?r)", &path, &rev));
full_path = svn_fspath__join(b->fs_path->data,
svn_relpath_canonicalize(path, pool), pool);
@@ -2303,18 +2315,18 @@ static svn_error_t *stat_cmd(svn_ra_svn_
if (dirent == NULL)
{
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "()"));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "()"));
return SVN_NO_ERROR;
}
cdate = (dirent->time == (time_t) -1) ? NULL
: svn_time_to_cstring(dirent->time, pool);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "((wnbr(?c)(?c)))",
- svn_node_kind_to_word(dirent->kind),
- (apr_uint64_t) dirent->size,
- dirent->has_props, dirent->created_rev,
- cdate, dirent->last_author));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "((wnbr(?c)(?c)))",
+ svn_node_kind_to_word(dirent->kind),
+ (apr_uint64_t) dirent->size,
+ dirent->has_props, dirent->created_rev,
+ cdate, dirent->last_author));
return SVN_NO_ERROR;
}
@@ -2338,9 +2350,9 @@ static svn_error_t *get_locations(svn_ra
ab.conn = conn;
/* Parse the arguments. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "crl", &relative_path,
- &peg_revision,
- &loc_revs_proto));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "crl", &relative_path,
+ &peg_revision,
+ &loc_revs_proto));
relative_path = svn_relpath_canonicalize(relative_path, pool);
abs_path = svn_fspath__join(b->fs_path->data, relative_path, pool);
@@ -2386,13 +2398,13 @@ static svn_error_t *get_locations(svn_ra
const svn_revnum_t *iter_key = svn__apr_hash_index_key(iter);
const char *iter_value = svn__apr_hash_index_val(iter);
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "rc",
- *iter_key, iter_value));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "rc",
+ *iter_key, iter_value));
}
}
}
- write_err = svn_ra_svn_write_word(conn, pool, "done");
+ write_err = svn_ra_svn__write_word(conn, pool, "done");
if (write_err)
{
svn_error_clear(err);
@@ -2400,7 +2412,7 @@ static svn_error_t *get_locations(svn_ra
}
SVN_CMD_ERR(err);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -2410,10 +2422,10 @@ static svn_error_t *gls_receiver(svn_loc
apr_pool_t *pool)
{
svn_ra_svn_conn_t *conn = baton;
- return svn_ra_svn_write_tuple(conn, pool, "rr(?c)",
- segment->range_start,
- segment->range_end,
- segment->path);
+ return svn_ra_svn__write_tuple(conn, pool, "rr(?c)",
+ segment->range_start,
+ segment->range_end,
+ segment->path);
}
static svn_error_t *get_location_segments(svn_ra_svn_conn_t *conn,
@@ -2432,9 +2444,9 @@ static svn_error_t *get_location_segment
ab.conn = conn;
/* Parse the arguments. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?r)(?r)(?r)",
- &relative_path, &peg_revision,
- &start_rev, &end_rev));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c(?r)(?r)(?r)",
+ &relative_path, &peg_revision,
+ &start_rev, &end_rev));
relative_path = svn_relpath_canonicalize(relative_path, pool);
abs_path = svn_fspath__join(b->fs_path->data, relative_path, pool);
@@ -2476,7 +2488,7 @@ static svn_error_t *get_location_segment
gls_receiver, (void *)conn,
authz_check_access_cb_func(b), &ab,
pool);
- write_err = svn_ra_svn_write_word(conn, pool, "done");
+ write_err = svn_ra_svn__write_word(conn, pool, "done");
if (write_err)
{
svn_error_clear(err);
@@ -2484,7 +2496,7 @@ static svn_error_t *get_location_segment
}
SVN_CMD_ERR(err);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -2499,7 +2511,7 @@ static svn_error_t *svndiff_handler(void
str.data = data;
str.len = *len;
- return svn_ra_svn_write_string(b->conn, b->pool, &str);
+ return svn_ra_svn__write_string(b->conn, b->pool, &str);
}
/* This implements svn_close_fn_t. Mark the end of the data by writing an
@@ -2508,7 +2520,7 @@ static svn_error_t *svndiff_close_handle
{
file_revs_baton_t *b = baton;
- SVN_ERR(svn_ra_svn_write_cstring(b->conn, b->pool, ""));
+ SVN_ERR(svn_ra_svn__write_cstring(b->conn, b->pool, ""));
return SVN_NO_ERROR;
}
@@ -2524,12 +2536,12 @@ static svn_error_t *file_rev_handler(voi
file_revs_baton_t *frb = baton;
svn_stream_t *stream;
- SVN_ERR(svn_ra_svn_write_tuple(frb->conn, pool, "cr(!",
- path, rev));
- SVN_ERR(svn_ra_svn_write_proplist(frb->conn, pool, rev_props));
- SVN_ERR(svn_ra_svn_write_tuple(frb->conn, pool, "!)(!"));
+ SVN_ERR(svn_ra_svn__write_tuple(frb->conn, pool, "cr(!",
+ path, rev));
+ SVN_ERR(svn_ra_svn__write_proplist(frb->conn, pool, rev_props));
+ SVN_ERR(svn_ra_svn__write_tuple(frb->conn, pool, "!)(!"));
SVN_ERR(write_prop_diffs(frb->conn, pool, prop_diffs));
- SVN_ERR(svn_ra_svn_write_tuple(frb->conn, pool, "!)b", merged_revision));
+ SVN_ERR(svn_ra_svn__write_tuple(frb->conn, pool, "!)b", merged_revision));
/* Store the pool for the delta stream. */
frb->pool = pool;
@@ -2552,7 +2564,7 @@ static svn_error_t *file_rev_handler(voi
svn_ra_svn_compression_level(frb->conn), pool);
}
else
- SVN_ERR(svn_ra_svn_write_cstring(frb->conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cstring(frb->conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -2574,9 +2586,9 @@ static svn_error_t *get_file_revs(svn_ra
ab.conn = conn;
/* Parse arguments. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?r)(?r)?B",
- &path, &start_rev, &end_rev,
- &include_merged_revs_param));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c(?r)(?r)?B",
+ &path, &start_rev, &end_rev,
+ &include_merged_revs_param));
path = svn_relpath_canonicalize(path, pool);
SVN_ERR(trivial_auth_request(conn, pool, b));
full_path = svn_fspath__join(b->fs_path->data, path, pool);
@@ -2598,14 +2610,14 @@ static svn_error_t *get_file_revs(svn_ra
include_merged_revisions,
authz_check_access_cb_func(b), &ab,
file_rev_handler, &frb, pool);
- write_err = svn_ra_svn_write_word(conn, pool, "done");
+ write_err = svn_ra_svn__write_word(conn, pool, "done");
if (write_err)
{
svn_error_clear(err);
return write_err;
}
SVN_CMD_ERR(err);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -2621,8 +2633,8 @@ static svn_error_t *lock(svn_ra_svn_conn
svn_revnum_t current_rev;
svn_lock_t *l;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?c)b(?r)", &path, &comment,
- &steal_lock, ¤t_rev));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c(?c)b(?r)", &path, &comment,
+ &steal_lock, ¤t_rev));
full_path = svn_fspath__join(b->fs_path->data,
svn_relpath_canonicalize(path, pool), pool);
@@ -2635,9 +2647,9 @@ static svn_error_t *lock(svn_ra_svn_conn
0, /* No expiration time. */
current_rev, steal_lock, pool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w(!", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w(!", "success"));
SVN_ERR(write_lock(conn, pool, l));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!)"));
return SVN_NO_ERROR;
}
@@ -2658,8 +2670,8 @@ static svn_error_t *lock_many(svn_ra_svn
svn_lock_t *l;
svn_error_t *err = SVN_NO_ERROR, *write_err;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "(?c)bl", &comment, &steal_lock,
- &path_revs));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "(?c)bl", &comment, &steal_lock,
+ &path_revs));
subpool = svn_pool_create(pool);
@@ -2682,8 +2694,8 @@ static svn_error_t *lock_many(svn_ra_svn
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
"Lock requests should be list of lists");
- SVN_ERR(svn_ra_svn_parse_tuple(item->u.list, pool, "c(?r)", &path,
- ¤t_rev));
+ SVN_ERR(svn_ra_svn__parse_tuple(item->u.list, pool, "c(?r)", &path,
+ ¤t_rev));
/* Allocate the full_path out of pool so it will survive for use
* by operational logging, after this loop. */
@@ -2709,7 +2721,7 @@ static svn_error_t *lock_many(svn_ra_svn
{
if (SVN_ERR_IS_LOCK_ERROR(err))
{
- write_err = svn_ra_svn_write_cmd_failure(conn, pool, err);
+ write_err = svn_ra_svn__write_cmd_failure(conn, pool, err);
svn_error_clear(err);
err = NULL;
SVN_ERR(write_err);
@@ -2719,9 +2731,9 @@ static svn_error_t *lock_many(svn_ra_svn
}
else
{
- SVN_ERR(svn_ra_svn_write_tuple(conn, subpool, "w!", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, subpool, "w!", "success"));
SVN_ERR(write_lock(conn, subpool, l));
- SVN_ERR(svn_ra_svn_write_tuple(conn, subpool, "!"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, subpool, "!"));
}
}
@@ -2731,12 +2743,12 @@ static svn_error_t *lock_many(svn_ra_svn
svn_log__lock(log_paths, steal_lock, pool)));
/* NOTE: err might contain a fatal locking error from the loop above. */
- write_err = svn_ra_svn_write_word(conn, pool, "done");
+ write_err = svn_ra_svn__write_word(conn, pool, "done");
if (!write_err)
SVN_CMD_ERR(err);
svn_error_clear(err);
SVN_ERR(write_err);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -2748,7 +2760,7 @@ static svn_error_t *unlock(svn_ra_svn_co
const char *path, *token, *full_path;
svn_boolean_t break_lock;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c(?c)b", &path, &token,
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c(?c)b", &path, &token,
&break_lock));
full_path = svn_fspath__join(b->fs_path->data,
@@ -2763,7 +2775,7 @@ static svn_error_t *unlock(svn_ra_svn_co
SVN_CMD_ERR(svn_repos_fs_unlock(b->repos, full_path, token, break_lock,
pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -2782,8 +2794,8 @@ static svn_error_t *unlock_many(svn_ra_s
const char *token;
svn_error_t *err = SVN_NO_ERROR, *write_err;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "bl", &break_lock,
- &unlock_tokens));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "bl", &break_lock,
+ &unlock_tokens));
/* Username required unless break_lock was specified. */
SVN_ERR(must_have_access(conn, pool, b, svn_authz_write, NULL, ! break_lock));
@@ -2803,8 +2815,8 @@ static svn_error_t *unlock_many(svn_ra_s
return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
"Unlock request should be a list of lists");
- SVN_ERR(svn_ra_svn_parse_tuple(item->u.list, subpool, "c(?c)", &path,
- &token));
+ SVN_ERR(svn_ra_svn__parse_tuple(item->u.list, subpool, "c(?c)", &path,
+ &token));
/* Allocate the full_path out of pool so it will survive for use
* by operational logging, after this loop. */
@@ -2827,7 +2839,7 @@ static svn_error_t *unlock_many(svn_ra_s
{
if (SVN_ERR_IS_UNLOCK_ERROR(err))
{
- write_err = svn_ra_svn_write_cmd_failure(conn, pool, err);
+ write_err = svn_ra_svn__write_cmd_failure(conn, pool, err);
svn_error_clear(err);
err = NULL;
SVN_ERR(write_err);
@@ -2836,8 +2848,8 @@ static svn_error_t *unlock_many(svn_ra_s
break;
}
else
- SVN_ERR(svn_ra_svn_write_tuple(conn, subpool, "w(c)", "success",
- path));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, subpool, "w(c)", "success",
+ path));
}
svn_pool_destroy(subpool);
@@ -2846,11 +2858,11 @@ static svn_error_t *unlock_many(svn_ra_s
svn_log__unlock(log_paths, break_lock, pool)));
/* NOTE: err might contain a fatal unlocking error from the loop above. */
- write_err = svn_ra_svn_write_word(conn, pool, "done");
+ write_err = svn_ra_svn__write_word(conn, pool, "done");
if (! write_err)
SVN_CMD_ERR(err);
svn_error_clear(err);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -2863,7 +2875,7 @@ static svn_error_t *get_lock(svn_ra_svn_
const char *full_path;
svn_lock_t *l;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c", &path));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c", &path));
full_path = svn_fspath__join(b->fs_path->data,
svn_relpath_canonicalize(path, pool), pool);
@@ -2875,10 +2887,10 @@ static svn_error_t *get_lock(svn_ra_svn_
SVN_CMD_ERR(svn_fs_get_lock(&l, b->fs, full_path, pool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w((!", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "success"));
if (l)
SVN_ERR(write_lock(conn, pool, l));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!))"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!))"));
return SVN_NO_ERROR;
}
@@ -2899,7 +2911,7 @@ static svn_error_t *get_locks(svn_ra_svn
ab.server = b;
ab.conn = conn;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "c?(?w)", &path, &depth_word));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "c?(?w)", &path, &depth_word));
depth = depth_word ? svn_depth_from_word(depth_word) : svn_depth_infinity;
if ((depth != svn_depth_empty) &&
@@ -2923,14 +2935,14 @@ static svn_error_t *get_locks(svn_ra_svn
authz_check_access_cb_func(b), &ab,
pool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w((!", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w((!", "success"));
for (hi = apr_hash_first(pool, locks); hi; hi = apr_hash_next(hi))
{
svn_lock_t *l = svn__apr_hash_index_val(hi);
SVN_ERR(write_lock(conn, pool, l));
}
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!))"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!))"));
return SVN_NO_ERROR;
}
@@ -2952,8 +2964,7 @@ static svn_error_t *replay_one_revision(
ab.conn = conn;
SVN_ERR(log_command(b, conn, pool,
- svn_log__replay(b->fs_path->data, low_water_mark,
- pool)));
+ svn_log__replay(b->fs_path->data, rev, pool)));
svn_ra_svn_get_editor(&editor, &edit_baton, conn, pool, NULL, NULL);
@@ -2968,8 +2979,7 @@ static svn_error_t *replay_one_revision(
svn_error_clear(editor->abort_edit(edit_baton, pool));
SVN_CMD_ERR(err);
- return svn_ra_svn_write_templated_cmd(conn, pool,
- svn_ra_svn_cmd_finish_replay);
+ return svn_ra_svn__write_cmd_finish_replay(conn, pool);
}
static svn_error_t *replay(svn_ra_svn_conn_t *conn, apr_pool_t *pool,
@@ -2979,7 +2989,7 @@ static svn_error_t *replay(svn_ra_svn_co
svn_boolean_t send_deltas;
server_baton_t *b = baton;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "rrb", &rev, &low_water_mark,
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "rrb", &rev, &low_water_mark,
&send_deltas));
SVN_ERR(trivial_auth_request(conn, pool, b));
@@ -2987,7 +2997,7 @@ static svn_error_t *replay(svn_ra_svn_co
SVN_ERR(replay_one_revision(conn, b, rev, low_water_mark,
send_deltas, pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -3004,7 +3014,7 @@ static svn_error_t *replay_range(svn_ra_
ab.server = b;
ab.conn = conn;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "rrrb", &start_rev,
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "rrrb", &start_rev,
&end_rev, &low_water_mark,
&send_deltas));
@@ -3021,9 +3031,9 @@ static svn_error_t *replay_range(svn_ra_
authz_check_access_cb_func(b),
&ab,
iterpool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "w(!", "revprops"));
- SVN_ERR(svn_ra_svn_write_proplist(conn, iterpool, props));
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!)"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "w(!", "revprops"));
+ SVN_ERR(svn_ra_svn__write_proplist(conn, iterpool, props));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!)"));
SVN_ERR(replay_one_revision(conn, b, rev, low_water_mark,
send_deltas, iterpool));
@@ -3031,7 +3041,7 @@ static svn_error_t *replay_range(svn_ra_
}
svn_pool_destroy(iterpool);
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, ""));
return SVN_NO_ERROR;
}
@@ -3048,7 +3058,7 @@ get_deleted_rev(svn_ra_svn_conn_t *conn,
svn_revnum_t end_revision;
svn_revnum_t revision_deleted;
- SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "crr",
+ SVN_ERR(svn_ra_svn__parse_tuple(params, pool, "crr",
&path, &peg_revision, &end_revision));
full_path = svn_fspath__join(b->fs_path->data,
svn_relpath_canonicalize(path, pool), pool);
@@ -3056,7 +3066,7 @@ get_deleted_rev(svn_ra_svn_conn_t *conn,
SVN_ERR(trivial_auth_request(conn, pool, b));
SVN_ERR(svn_repos_deleted_rev(b->fs, full_path, peg_revision, end_revision,
&revision_deleted, pool));
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "r", revision_deleted));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "r", revision_deleted));
return SVN_NO_ERROR;
}
@@ -3079,7 +3089,7 @@ get_inherited_props(svn_ra_svn_conn_t *c
ab.conn = conn;
/* Parse arguments. */
- SVN_ERR(svn_ra_svn_parse_tuple(params, iterpool, "c(?r)", &path, &rev));
+ SVN_ERR(svn_ra_svn__parse_tuple(params, iterpool, "c(?r)", &path, &rev));
full_path = svn_fspath__join(b->fs_path->data,
svn_relpath_canonicalize(path, iterpool),
@@ -3101,9 +3111,9 @@ get_inherited_props(svn_ra_svn_conn_t *c
SVN_CMD_ERR(get_props(NULL, &inherited_props, &ab, root, full_path, pool));
/* Send successful command response with revision and props. */
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "w(!", "success"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "w(!", "success"));
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!(?!"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!(?!"));
for (i = 0; i < inherited_props->nelts; i++)
{
@@ -3111,14 +3121,14 @@ get_inherited_props(svn_ra_svn_conn_t *c
APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
svn_pool_clear(iterpool);
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!(c(!",
- iprop->path_or_url));
- SVN_ERR(svn_ra_svn_write_proplist(conn, iterpool, iprop->prop_hash));
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!))!",
- iprop->path_or_url));
- }
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!(c(!",
+ iprop->path_or_url));
+ SVN_ERR(svn_ra_svn__write_proplist(conn, iterpool, iprop->prop_hash));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!))!",
+ iprop->path_or_url));
+ }
- SVN_ERR(svn_ra_svn_write_tuple(conn, iterpool, "!))"));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, iterpool, "!))"));
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
@@ -3279,9 +3289,10 @@ static svn_error_t *find_repos(const cha
{
b->base = svn_repos_conf_dir(b->repos, pool);
- SVN_ERR(svn_config_read2(&b->cfg, svn_repos_svnserve_conf(b->repos, pool),
+ SVN_ERR(svn_config_read3(&b->cfg, svn_repos_svnserve_conf(b->repos, pool),
FALSE, /* must_exist */
FALSE, /* section_names_case_sensitive */
+ FALSE, /* option_names_case_sensitive */
pool));
SVN_ERR(load_pwdb_config(b, conn, pool));
SVN_ERR(load_authz_config(b, conn, repos_root, pool));
@@ -3321,7 +3332,7 @@ static svn_error_t *find_repos(const cha
SVN_CONFIG_OPTION_HOOKS_ENV, NULL);
if (hooks_env)
hooks_env = svn_dirent_internal_style(hooks_env, pool);
- SVN_ERR(svn_repos_hooks_setenv(b->repos, hooks_env, pool, pool));
+ SVN_ERR(svn_repos_hooks_setenv(b->repos, hooks_env, pool));
return SVN_NO_ERROR;
}
@@ -3425,20 +3436,18 @@ fetch_props_func(apr_hash_t **props,
}
static svn_error_t *
-fetch_kind_func(svn_kind_t *kind,
+fetch_kind_func(svn_node_kind_t *kind,
void *baton,
const char *path,
svn_revnum_t base_revision,
apr_pool_t *scratch_pool)
{
- svn_node_kind_t node_kind;
svn_fs_root_t *fs_root;
path = get_normalized_repo_rel_path(baton, path, scratch_pool);
SVN_ERR(get_revision_root(&fs_root, baton, base_revision, scratch_pool));
- SVN_ERR(svn_fs_check_path(&node_kind, fs_root, path, scratch_pool));
- *kind = svn__kind_from_node_kind(node_kind, FALSE);
+ SVN_ERR(svn_fs_check_path(kind, fs_root, path, scratch_pool));
return SVN_NO_ERROR;
}
@@ -3508,52 +3517,52 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
/* construct FS configuration parameters */
b.fs_config = apr_hash_make(pool);
- apr_hash_set(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_DELTAS,
- APR_HASH_KEY_STRING, params->cache_txdeltas ? "1" : "0");
- apr_hash_set(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS,
- APR_HASH_KEY_STRING, params->cache_fulltexts ? "1" : "0");
- apr_hash_set(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
- APR_HASH_KEY_STRING, params->cache_revprops ? "1" : "0");
+ svn_hash_sets(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_DELTAS,
+ params->cache_txdeltas ? "1" :"0");
+ svn_hash_sets(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS,
+ params->cache_fulltexts ? "1" :"0");
+ svn_hash_sets(b.fs_config, SVN_FS_CONFIG_FSFS_CACHE_REVPROPS,
+ params->cache_revprops ? "1" :"0");
/* Send greeting. We don't support version 1 any more, so we can
* send an empty mechlist. */
if (params->compression_level > 0)
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwwwwwww)",
- (apr_uint64_t) 2, (apr_uint64_t) 2,
- SVN_RA_SVN_CAP_EDIT_PIPELINE,
- SVN_RA_SVN_CAP_SVNDIFF1,
- SVN_RA_SVN_CAP_ABSENT_ENTRIES,
- SVN_RA_SVN_CAP_COMMIT_REVPROPS,
- SVN_RA_SVN_CAP_DEPTH,
- SVN_RA_SVN_CAP_LOG_REVPROPS,
- SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
- SVN_RA_SVN_CAP_PARTIAL_REPLAY,
- SVN_RA_SVN_CAP_INHERITED_PROPS,
- SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS,
- SVN_RA_SVN_CAP_GET_FILE_REVS_REVERSE
- ));
- else
- SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, "nn()(wwwwwwwwww)",
- (apr_uint64_t) 2, (apr_uint64_t) 2,
- SVN_RA_SVN_CAP_EDIT_PIPELINE,
- SVN_RA_SVN_CAP_ABSENT_ENTRIES,
- SVN_RA_SVN_CAP_COMMIT_REVPROPS,
- SVN_RA_SVN_CAP_DEPTH,
- SVN_RA_SVN_CAP_LOG_REVPROPS,
- SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
- SVN_RA_SVN_CAP_PARTIAL_REPLAY,
- SVN_RA_SVN_CAP_INHERITED_PROPS,
- SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS,
- SVN_RA_SVN_CAP_GET_FILE_REVS_REVERSE
- ));
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "nn()(wwwwwwwwwww)",
+ (apr_uint64_t) 2, (apr_uint64_t) 2,
+ SVN_RA_SVN_CAP_EDIT_PIPELINE,
+ SVN_RA_SVN_CAP_SVNDIFF1,
+ SVN_RA_SVN_CAP_ABSENT_ENTRIES,
+ SVN_RA_SVN_CAP_COMMIT_REVPROPS,
+ SVN_RA_SVN_CAP_DEPTH,
+ SVN_RA_SVN_CAP_LOG_REVPROPS,
+ SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
+ SVN_RA_SVN_CAP_PARTIAL_REPLAY,
+ SVN_RA_SVN_CAP_INHERITED_PROPS,
+ SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS,
+ SVN_RA_SVN_CAP_GET_FILE_REVS_REVERSE
+ ));
+ else
+ SVN_ERR(svn_ra_svn__write_cmd_response(conn, pool, "nn()(wwwwwwwwww)",
+ (apr_uint64_t) 2, (apr_uint64_t) 2,
+ SVN_RA_SVN_CAP_EDIT_PIPELINE,
+ SVN_RA_SVN_CAP_ABSENT_ENTRIES,
+ SVN_RA_SVN_CAP_COMMIT_REVPROPS,
+ SVN_RA_SVN_CAP_DEPTH,
+ SVN_RA_SVN_CAP_LOG_REVPROPS,
+ SVN_RA_SVN_CAP_ATOMIC_REVPROPS,
+ SVN_RA_SVN_CAP_PARTIAL_REPLAY,
+ SVN_RA_SVN_CAP_INHERITED_PROPS,
+ SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS,
+ SVN_RA_SVN_CAP_GET_FILE_REVS_REVERSE
+ ));
/* Read client response, which we assume to be in version 2 format:
* version, capability list, and client URL; then we do an auth
* request. */
- SVN_ERR(svn_ra_svn_read_tuple(conn, pool, "nlc?c(?c)",
- &ver, &caplist, &client_url,
- &ra_client_string,
- &client_string));
+ SVN_ERR(svn_ra_svn__read_tuple(conn, pool, "nlc?c(?c)",
+ &ver, &caplist, &client_url,
+ &ra_client_string,
+ &client_string));
if (ver != 2)
return SVN_NO_ERROR;
@@ -3608,10 +3617,10 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
{
log_error(err, b.log_file, svn_ra_svn_conn_remote_host(conn),
b.user, NULL, pool);
- io_err = svn_ra_svn_write_cmd_failure(conn, pool, err);
+ io_err = svn_ra_svn__write_cmd_failure(conn, pool, err);
svn_error_clear(err);
SVN_ERR(io_err);
- return svn_ra_svn_flush(conn, pool);
+ return svn_ra_svn__flush(conn, pool);
}
/* Log the open. */
@@ -3647,11 +3656,11 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
SVN_ERR(svn_repos_has_capability(b.repos, &supports_mergeinfo,
SVN_REPOS_CAPABILITY_MERGEINFO, pool));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "w(cc(!",
- "success", uuid, b.repos_url));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "w(cc(!",
+ "success", uuid, b.repos_url));
if (supports_mergeinfo)
- SVN_ERR(svn_ra_svn_write_word(conn, pool, SVN_RA_SVN_CAP_MERGEINFO));
- SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!))"));
+ SVN_ERR(svn_ra_svn__write_word(conn, pool, SVN_RA_SVN_CAP_MERGEINFO));
+ SVN_ERR(svn_ra_svn__write_tuple(conn, pool, "!))"));
}
/* Set up editor shims. */
@@ -3667,5 +3676,5 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
SVN_ERR(svn_ra_svn__set_shim_callbacks(conn, callbacks));
}
- return svn_ra_svn_handle_commands2(conn, pool, main_commands, &b, FALSE);
+ return svn_ra_svn__handle_commands2(conn, pool, main_commands, &b, FALSE);
}
Modified: subversion/branches/master-passphrase/subversion/svnserve/server.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/svnserve/server.h?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/svnserve/server.h (original)
+++ subversion/branches/master-passphrase/subversion/svnserve/server.h Fri May 10 14:58:47 2013
@@ -138,7 +138,7 @@ svn_error_t *serve(svn_ra_svn_conn_t *co
apr_pool_t *pool);
/* Load the password database for the listening server based on the
- entries in the SERVER struct.
+ entries in the SERVER struct.
SERVER and CONN must not be NULL. The real errors will be logged with
SERVER and CONN but return generic errors to the client. */
Modified: subversion/branches/master-passphrase/subversion/svnserve/svnserve.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/svnserve/svnserve.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/svnserve/svnserve.c (original)
+++ subversion/branches/master-passphrase/subversion/svnserve/svnserve.c Fri May 10 14:58:47 2013
@@ -50,7 +50,11 @@
#include "svn_io.h"
#include "svn_private_config.h"
+
#include "private/svn_dep_compat.h"
+#include "private/svn_cmdline_private.h"
+#include "private/svn_atomic.h"
+
#include "winservice.h"
#ifdef HAVE_UNISTD_H
@@ -238,13 +242,11 @@ static const apr_getopt_option_t svnserv
" "
"[used for FSFS repositories only]")},
{"client-speed", SVNSERVE_OPT_CLIENT_SPEED, 1,
- N_("Optimize throughput based on the assumption that\n"
- " "
- "clients can receive data with a bitrate of at\n"
+ N_("Optimize network handling based on the assumption\n"
" "
- "least ARG Gbit/s. For clients receiving data at\n"
+ "that most clients are connected with a bitrate of\n"
" "
- "less than 1 Gbit/s, zero should be used.\n"
+ "ARG Mbit/s.\n"
" "
"Default is 0 (optimizations disabled).")},
#ifdef CONNECTION_HAVE_THREAD_OPTION
@@ -377,11 +379,44 @@ static apr_status_t redirect_stdout(void
return apr_file_dup2(out_file, err_file, pool);
}
+#if APR_HAS_THREADS
+/* The pool passed to apr_thread_create can only be released when both
+
+ A: the call to apr_thread_create has returned to the calling thread
+ B: the new thread has started running and reached apr_thread_start_t
+
+ So we set the atomic counter to 2 then both the calling thread and
+ the new thread decrease it and when it reaches 0 the pool can be
+ released. */
+struct shared_pool_t {
+ svn_atomic_t count;
+ apr_pool_t *pool;
+};
+
+static struct shared_pool_t *
+attach_shared_pool(apr_pool_t *pool)
+{
+ struct shared_pool_t *shared = apr_palloc(pool, sizeof(struct shared_pool_t));
+
+ shared->pool = pool;
+ svn_atomic_set(&shared->count, 2);
+
+ return shared;
+}
+
+static void
+release_shared_pool(struct shared_pool_t *shared)
+{
+ if (svn_atomic_dec(&shared->count) == 0)
+ svn_pool_destroy(shared->pool);
+}
+#endif
+
/* "Arguments" passed from the main thread to the connection thread */
struct serve_thread_t {
svn_ra_svn_conn_t *conn;
serve_params_t *params;
- apr_pool_t *pool;
+ struct shared_pool_t *shared_pool;
};
#if APR_HAS_THREADS
@@ -389,8 +424,8 @@ static void * APR_THREAD_FUNC serve_thre
{
struct serve_thread_t *d = data;
- svn_error_clear(serve(d->conn, d->params, d->pool));
- svn_pool_destroy(d->pool);
+ svn_error_clear(serve(d->conn, d->params, d->shared_pool->pool));
+ release_shared_pool(d->shared_pool);
return NULL;
}
@@ -454,6 +489,7 @@ int main(int argc, const char *argv[])
#if APR_HAS_THREADS
apr_threadattr_t *tattr;
apr_thread_t *tid;
+ struct shared_pool_t *shared_pool;
struct serve_thread_t *thread_data;
#endif
@@ -667,11 +703,16 @@ int main(int argc, const char *argv[])
{
apr_size_t bandwidth = (apr_size_t)apr_strtoi64(arg, NULL, 0);
- /* block other clients for at most 1 ms (at full bandwidth) */
- params.zero_copy_limit = bandwidth * 120000;
-
- /* check for aborted connections at the same rate */
- params.error_check_interval = bandwidth * 120000;
+ /* for slower clients, don't try anything fancy */
+ if (bandwidth >= 1000)
+ {
+ /* block other clients for at most 1 ms (at full bandwidth).
+ Note that the send buffer is 16kB anyways. */
+ params.zero_copy_limit = bandwidth * 120;
+
+ /* check for aborted connections at the same rate */
+ params.error_check_interval = bandwidth * 120;
+ }
}
break;
@@ -749,9 +790,10 @@ int main(int argc, const char *argv[])
{
params.base = svn_dirent_dirname(config_filename, pool);
- SVN_INT_ERR(svn_config_read2(¶ms.cfg, config_filename,
+ SVN_INT_ERR(svn_config_read3(¶ms.cfg, config_filename,
TRUE, /* must_exist */
FALSE, /* section_names_case_sensitive */
+ FALSE, /* option_names_case_sensitive */
pool));
}
@@ -1086,6 +1128,7 @@ int main(int argc, const char *argv[])
particularly sophisticated strategy for a threaded server, it's
little different from forking one process per connection. */
#if APR_HAS_THREADS
+ shared_pool = attach_shared_pool(connection_pool);
status = apr_threadattr_create(&tattr, connection_pool);
if (status)
{
@@ -1105,9 +1148,9 @@ int main(int argc, const char *argv[])
thread_data = apr_palloc(connection_pool, sizeof(*thread_data));
thread_data->conn = conn;
thread_data->params = ¶ms;
- thread_data->pool = connection_pool;
+ thread_data->shared_pool = shared_pool;
status = apr_thread_create(&tid, tattr, serve_thread, thread_data,
- connection_pool);
+ shared_pool->pool);
if (status)
{
err = svn_error_wrap_apr(status, _("Can't create thread"));
@@ -1115,6 +1158,7 @@ int main(int argc, const char *argv[])
svn_error_clear(err);
exit(1);
}
+ release_shared_pool(shared_pool);
#endif
break;
Modified: subversion/branches/master-passphrase/subversion/svnsync/svnsync.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/svnsync/svnsync.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/svnsync/svnsync.c (original)
+++ subversion/branches/master-passphrase/subversion/svnsync/svnsync.c Fri May 10 14:58:47 2013
@@ -19,6 +19,7 @@
* ====================================================================
*/
+#include "svn_hash.h"
#include "svn_cmdline.h"
#include "svn_config.h"
#include "svn_pools.h"
@@ -490,7 +491,7 @@ remove_props_not_in_source(svn_ra_sessio
continue;
/* Delete property if the name can't be found in SOURCE_PROPS. */
- if (! apr_hash_get(source_props, propname, APR_HASH_KEY_STRING))
+ if (! svn_hash_gets(source_props, propname))
SVN_ERR(svn_ra_change_rev_prop2(session, rev, propname, NULL,
NULL, subpool));
}
@@ -533,7 +534,7 @@ filter_props(int *filtered_count, apr_ha
- matching the include pattern if provided */
if (!filter || !filter(propname))
{
- apr_hash_set(filtered, propname, APR_HASH_KEY_STRING, propval);
+ svn_hash_sets(filtered, propname, propval);
}
else
{
@@ -923,12 +924,9 @@ open_source_session(svn_ra_session_t **f
SVN_ERR(svn_ra_rev_proplist(to_session, 0, &props, pool));
- from_url_str = apr_hash_get(props, SVNSYNC_PROP_FROM_URL,
- APR_HASH_KEY_STRING);
- from_uuid_str = apr_hash_get(props, SVNSYNC_PROP_FROM_UUID,
- APR_HASH_KEY_STRING);
- *last_merged_rev = apr_hash_get(props, SVNSYNC_PROP_LAST_MERGED_REV,
- APR_HASH_KEY_STRING);
+ from_url_str = svn_hash_gets(props, SVNSYNC_PROP_FROM_URL);
+ from_uuid_str = svn_hash_gets(props, SVNSYNC_PROP_FROM_UUID);
+ *last_merged_rev = svn_hash_gets(props, SVNSYNC_PROP_LAST_MERGED_REV);
if (! from_url_str || ! from_uuid_str || ! *last_merged_rev)
return svn_error_create
@@ -1143,14 +1141,13 @@ fetch_props_func(apr_hash_t **props,
}
static svn_error_t *
-fetch_kind_func(svn_kind_t *kind,
+fetch_kind_func(svn_node_kind_t *kind,
void *baton,
const char *path,
svn_revnum_t base_revision,
apr_pool_t *scratch_pool)
{
struct replay_baton_t *rb = baton;
- svn_node_kind_t node_kind;
if (svn_path_is_url(path))
path = svn_uri_skip_ancestor(rb->to_root, path, scratch_pool);
@@ -1161,9 +1158,8 @@ fetch_kind_func(svn_kind_t *kind,
base_revision = rb->current_revision - 1;
SVN_ERR(svn_ra_check_path(rb->extra_to_session, path, base_revision,
- &node_kind, scratch_pool));
+ kind, scratch_pool));
- *kind = svn__kind_from_node_kind(node_kind, FALSE);
return SVN_NO_ERROR;
}
@@ -1239,9 +1235,9 @@ replay_rev_started(svn_revnum_t revision
have to set it to at least the empty string. If there's a svn:log
property on this revision, we will write the actual value in the
replay_rev_finished callback. */
- if (! apr_hash_get(filtered, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING))
- apr_hash_set(filtered, SVN_PROP_REVISION_LOG, APR_HASH_KEY_STRING,
- svn_string_create_empty(pool));
+ if (! svn_hash_gets(filtered, SVN_PROP_REVISION_LOG))
+ svn_hash_sets(filtered, SVN_PROP_REVISION_LOG,
+ svn_string_create_empty(pool));
/* If necessary, normalize encoding and line ending style. Add the number
of properties that required EOL normalization to the overall count
@@ -1817,18 +1813,15 @@ info_cmd(apr_getopt_t *os, void *b, apr_
SVN_ERR(svn_ra_rev_proplist(to_session, 0, &props, pool));
- from_url = apr_hash_get(props, SVNSYNC_PROP_FROM_URL,
- APR_HASH_KEY_STRING);
+ from_url = svn_hash_gets(props, SVNSYNC_PROP_FROM_URL);
if (! from_url)
return svn_error_createf
(SVN_ERR_BAD_URL, NULL,
_("Repository '%s' is not initialized for synchronization"), to_url);
- from_uuid = apr_hash_get(props, SVNSYNC_PROP_FROM_UUID,
- APR_HASH_KEY_STRING);
- last_merged_rev = apr_hash_get(props, SVNSYNC_PROP_LAST_MERGED_REV,
- APR_HASH_KEY_STRING);
+ from_uuid = svn_hash_gets(props, SVNSYNC_PROP_FROM_UUID);
+ last_merged_rev = svn_hash_gets(props, SVNSYNC_PROP_LAST_MERGED_REV);
/* Print the info. */
SVN_ERR(svn_cmdline_printf(pool, _("Source URL: %s\n"), from_url->data));
@@ -1898,7 +1891,7 @@ main(int argc, const char *argv[])
const char *password = NULL, *source_password = NULL, *sync_password = NULL;
apr_array_header_t *config_options = NULL;
const char *source_prop_encoding = NULL;
- svn_boolean_t force_interactive;
+ svn_boolean_t force_interactive = FALSE;
if (svn_cmdline_init("svnsync", stderr) != EXIT_SUCCESS)
{
@@ -2237,8 +2230,7 @@ main(int argc, const char *argv[])
"svnsync: ", "--config-option"));
}
- config = apr_hash_get(opt_baton.config, SVN_CONFIG_CATEGORY_CONFIG,
- APR_HASH_KEY_STRING);
+ config = svn_hash_gets(opt_baton.config, SVN_CONFIG_CATEGORY_CONFIG);
opt_baton.source_prop_encoding = source_prop_encoding;
Modified: subversion/branches/master-passphrase/subversion/svnsync/sync.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/svnsync/sync.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/svnsync/sync.c (original)
+++ subversion/branches/master-passphrase/subversion/svnsync/sync.c Fri May 10 14:58:47 2013
@@ -19,6 +19,7 @@
* ====================================================================
*/
+#include "svn_hash.h"
#include "svn_cmdline.h"
#include "svn_config.h"
#include "svn_pools.h"
@@ -116,7 +117,7 @@ svnsync_normalize_revprops(apr_hash_t *r
source_prop_encoding, pool, pool));
/* Replace the existing prop value. */
- apr_hash_set(rev_props, propname, APR_HASH_KEY_STRING, propval);
+ svn_hash_sets(rev_props, propname, propval);
if (was_normalized)
(*normalized_count)++; /* Count it. */
Modified: subversion/branches/master-passphrase/subversion/svnversion/svnversion.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/svnversion/svnversion.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/svnversion/svnversion.c (original)
+++ subversion/branches/master-passphrase/subversion/svnversion/svnversion.c Fri May 10 14:58:47 2013
@@ -28,6 +28,7 @@
#include "svn_version.h"
#include "private/svn_opt_private.h"
+#include "private/svn_cmdline_private.h"
#include "svn_private_config.h"
Modified: subversion/branches/master-passphrase/subversion/tests/cmdline/authz_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/tests/cmdline/authz_tests.py?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/tests/cmdline/authz_tests.py (original)
+++ subversion/branches/master-passphrase/subversion/tests/cmdline/authz_tests.py Fri May 10 14:58:47 2013
@@ -576,7 +576,8 @@ def authz_log_and_tracing_test(sbox):
if sbox.repo_url.startswith('http'):
expected_err2 = expected_err
else:
- expected_err2 = ".*svn: E220001: Item is not readable.*"
+ expected_err2 = ".*svn: E220001: Unreadable path encountered; " \
+ "access denied.*"
# if we do the same thing directly on the unreadable file, we get:
# svn: Item is not readable
@@ -1515,6 +1516,42 @@ def authz_svnserve_groups(sbox):
'-m', 'logmsg',
E_url, D_url)
+@Skip(svntest.main.is_ra_type_file)
+@Issue(4332)
+def authz_del_from_subdir(sbox):
+ "delete file without rights on the root"
+
+ sbox.build(create_wc = False)
+
+ write_authz_file(sbox, {"/": "* = ", "/A": "jrandom = rw"})
+
+ write_restrictive_svnserve_conf(sbox.repo_dir)
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'rm', sbox.repo_url + '/A/mu',
+ '-m', '')
+
+
+@XFail()
+@SkipUnless(svntest.main.is_ra_type_dav) # dontdothat is dav only
+@SkipUnless(svntest.main.is_os_windows) # until the buildbots are configured
+def log_diff_dontdothat(sbox):
+ "log --diff on dontdothat"
+ sbox.build(create_wc = False)
+
+ ddt_url = sbox.repo_url.replace('/svn-test-work/', '/ddt-test-work/')
+
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'log', sbox.repo_url,
+ '-c', 1, '--diff')
+
+ # We should expect a PASS or a proper error message instead of
+ # svn: E175009: XML parsing failed: (403 Forbidden)
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'log', ddt_url,
+ '-c', 1, '--diff')
+
+
########################################################################
# Run the tests
@@ -1545,7 +1582,9 @@ test_list = [ None,
wc_commit_error_handling,
upgrade_absent,
remove_subdir_with_authz_and_tc,
- authz_svnserve_groups
+ authz_svnserve_groups,
+ authz_del_from_subdir,
+ log_diff_dontdothat,
]
serial_only = True
Modified: subversion/branches/master-passphrase/subversion/tests/cmdline/autoprop_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/tests/cmdline/autoprop_tests.py?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/tests/cmdline/autoprop_tests.py (original)
+++ subversion/branches/master-passphrase/subversion/tests/cmdline/autoprop_tests.py Fri May 10 14:58:47 2013
@@ -635,7 +635,7 @@ def svn_prop_inheritable_autoprops_add_v
# again, which is not what we are here to test.
if os.name == 'posix':
os.chmod(os.path.join(sbox.wc_dir, 'D', 'rip.bat'), 0664)
-
+
os.chdir(sbox.wc_dir)
svntest.main.run_svn(None, 'add', '.', '--force', '--no-auto-props',
'--config-dir', config_dir)