Author: danielsh
Date: Sat Jul 24 09:36:36 2010
New Revision: 978835
URL: http://svn.apache.org/viewvc?rev=978835&view=rev
Log:
On the 'atomic-revprop' branch:
Teach the utility wrapper to authenticate as jrandom:rayjandom.
* subversion/tests/cmdline/atomic-ra-revprop-change.c
(aborting_prompt_func):
New helper, primarily to avoid a segfault in a "Can't happen" case.
(construct_auth_baton):
New helper, authenticates as jrandom:rayjandom.
(change_rev_prop):
Construct an auth_baton and pass it to svn_ra_open3().
Modified:
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
Modified:
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
URL:
http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c?rev=978835&r1=978834&r2=978835&view=diff
==============================================================================
---
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
(original)
+++
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
Sat Jul 24 09:36:36 2010
@@ -35,6 +35,45 @@
#include "svn_private_config.h"
+/* implements svn_auth_simple_prompt_func_t */
+static svn_error_t *
+aborting_prompt_func(svn_auth_cred_simple_t **cred,
+ void *baton,
+ const char *realm,
+ const char *username,
+ svn_boolean_t may_save,
+ apr_pool_t *pool)
+{
+ /* Oops, the jrandom:rayjandom we passed for SVN_AUTH_PARAM_DEFAULT_* failed,
+ and the prompt provider has retried.
+ */
+ SVN_ERR_MALFUNCTION();
+}
+
+static svn_error_t *
+construct_auth_baton(svn_auth_baton_t **auth_baton_p,
+ apr_pool_t *result_pool)
+{
+ apr_array_header_t *providers;
+ svn_auth_provider_object_t *simple_provider;
+ svn_auth_baton_t *auth_baton;
+
+ /* A bit of dancing just to pass jrandom:rayjandom. */
+ providers = apr_array_make(pool, 1, sizeof(svn_auth_provider_object_t *)),
+ svn_auth_get_simple_prompt_provider(&simple_provider,
+ aborting_prompt_func, NULL,
+ 0, pool);
+ APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = simple_provider;
+ svn_auth_open(&auth_baton, providers, pool);
+ svn_auth_set_parameter(auth_baton,
+ SVN_AUTH_PARAM_DEFAULT_USERNAME, "jrandom");
+ svn_auth_set_parameter(auth_baton,
+ SVN_AUTH_PARAM_DEFAULT_PASSWORD, "rayjandom");
+
+ *auth_baton_p = auth_baton;
+ return SVN_NO_ERROR;
+}
+
static svn_error_t *
change_rev_prop(const char *url,
svn_revnum_t revision,
@@ -43,11 +82,11 @@ change_rev_prop(const char *url,
const svn_string_t *old_value,
apr_pool_t *pool)
{
- svn_ra_session_t *sess;
svn_ra_callbacks2_t *callbacks;
+ svn_ra_session_t *sess;
SVN_ERR(svn_ra_create_callbacks(&callbacks, pool));
- /* No need to fill callbacks->auth_baton or any other callbacks. */
+ SVN_ERR(construct_auth_baton(&callbacks->auth_baton, pool));
SVN_ERR(svn_ra_open3(&sess, url, NULL, callbacks, NULL /* baton */,
NULL /* config */, pool));