You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/10/15 00:59:48 UTC
svn commit: r1532126 - in /subversion/trunk/subversion:
libsvn_ra_svn/client.c tests/libsvn_ra/ra-test.c
Author: brane
Date: Mon Oct 14 22:59:47 2013
New Revision: 1532126
URL: http://svn.apache.org/r1532126
Log:
Pass the correct baton to the open-tunnel callback.
* subversion/libsvn_ra_svn/client.c (open_session):
Use callbakcs->tunnel_baton, not callbacks_baton, in the open-tunnel call.
* subversion/tests/libsvn_ra/ra-test.c: Add checks to make sure that the
tunnel baton and context get propagated through the callbacks.
Modified:
subversion/trunk/subversion/libsvn_ra_svn/client.c
subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
Modified: subversion/trunk/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_svn/client.c?rev=1532126&r1=1532125&r2=1532126&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/trunk/subversion/libsvn_ra_svn/client.c Mon Oct 14 22:59:47 2013
@@ -634,7 +634,7 @@ static svn_error_t *open_session(svn_ra_
apr_file_t *response;
SVN_ERR(callbacks->open_tunnel_func(
&request, &response, &tunnel_context,
- callbacks_baton, tunnel_name,
+ callbacks->tunnel_baton, tunnel_name,
uri->user, uri->hostname, uri->port,
pool));
if (callbacks->close_tunnel_func)
Modified: subversion/trunk/subversion/tests/libsvn_ra/ra-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_ra/ra-test.c?rev=1532126&r1=1532125&r2=1532126&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_ra/ra-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_ra/ra-test.c Mon Oct 14 22:59:47 2013
@@ -96,10 +96,14 @@ commit_changes(svn_ra_session_t *session
static svn_boolean_t last_tunnel_check;
static int tunnel_open_count;
+static void *check_tunnel_baton;
+static void *open_tunnel_context;
static svn_boolean_t
check_tunnel(void *tunnel_baton, const char *tunnel_name)
{
+ if (tunnel_baton != check_tunnel_baton)
+ abort();
last_tunnel_check = (0 == strcmp(tunnel_name, "test"));
return last_tunnel_check;
}
@@ -118,6 +122,8 @@ open_tunnel(apr_file_t **request, apr_fi
const char *args[] = { "svnserve", "-t", "-r", ".", NULL };
const char *svnserve;
+ SVN_TEST_ASSERT(tunnel_baton == check_tunnel_baton);
+
SVN_ERR(svn_dirent_get_absolute(&svnserve, "../../svnserve/svnserve", pool));
#ifdef WIN32
svnserve = apr_pstrcat(pool, svnserve, ".exe", NULL);
@@ -154,6 +160,7 @@ open_tunnel(apr_file_t **request, apr_fi
*request = proc->in;
*response = proc->out;
+ open_tunnel_context = *tunnel_context = &kind;
++tunnel_open_count;
return SVN_NO_ERROR;
}
@@ -163,6 +170,8 @@ close_tunnel(void *tunnel_context, void
const char *tunnel_name, const char *user,
const char *hostname, int port)
{
+ SVN_TEST_ASSERT(tunnel_context == open_tunnel_context);
+ SVN_TEST_ASSERT(tunnel_baton == check_tunnel_baton);
--tunnel_open_count;
return SVN_NO_ERROR;
}
@@ -247,6 +256,7 @@ check_tunnel_callback_test(const svn_tes
cbtable->check_tunnel_func = check_tunnel;
cbtable->open_tunnel_func = open_tunnel;
cbtable->close_tunnel_func = close_tunnel;
+ cbtable->tunnel_baton = check_tunnel_baton = &cbtable;
SVN_ERR(svn_cmdline_create_auth_baton(&cbtable->auth_baton,
TRUE /* non_interactive */,
"jrandom", "rayjandom",
@@ -256,6 +266,7 @@ check_tunnel_callback_test(const svn_tes
NULL, NULL, NULL, pool));
last_tunnel_check = TRUE;
+ open_tunnel_context = NULL;
err = svn_ra_open4(&session, NULL, "svn+foo://localhost/no-repo",
NULL, cbtable, NULL, NULL, pool);
svn_error_clear(err);
@@ -282,6 +293,7 @@ tunel_callback_test(const svn_test_opts_
cbtable->check_tunnel_func = check_tunnel;
cbtable->open_tunnel_func = open_tunnel;
cbtable->close_tunnel_func = close_tunnel;
+ cbtable->tunnel_baton = check_tunnel_baton = &cbtable;
SVN_ERR(svn_cmdline_create_auth_baton(&cbtable->auth_baton,
TRUE /* non_interactive */,
"jrandom", "rayjandom",
@@ -291,6 +303,7 @@ tunel_callback_test(const svn_test_opts_
NULL, NULL, NULL, pool));
last_tunnel_check = FALSE;
+ open_tunnel_context = NULL;
tunnel_open_count = 0;
connection_pool = svn_pool_create(pool);
err = svn_ra_open4(&session, NULL, url, NULL, cbtable, NULL, NULL,