[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Client Context not working for Commits

From: Bottomley, Peter <PBottomley_at_t-tales.com>
Date: Mon, 13 Oct 2008 12:25:50 +0100

Hi,

 

Whilst writing my own SVN Client application, I have been implementing
(successfully) all the usual SVN functionality, (Checkout, Update etc.);
however when I tried to run a svn_client_commit4 call, the code crashed
within this call.

 

After debugging into the commit method it appeared that the issue was
with the svn_client_ctx_t I was passing in.

 

I am using the same code to generate a basic svn_client_ctx_t object for
all of the various functions, and I'm pretty sure the issue is with the
authentication bits.

 

This is the context generation code I am using at the mo, which works
with update / list / checkout but not with commit.

 

CODE:

 

////////////////////////////////////////////////////////////////////////
////

 

 

svn_error_t * SVNManager::SetUpClientContext (svn_client_ctx_t **ctx,
apr_pool_t *pool)

{

      /* Allocate the context, using apr_pcalloc to ensure it is zeroed
out. */

      *ctx = (svn_client_ctx_t *)apr_pcalloc (pool, sizeof (*ctx));

 

      /* read in the client's config options. */

      SVN_ERR (svn_config_get_config(&(*ctx)->config, NULL, pool));

 

      // Set up the Authentication Baton:

      {

            svn_auth_baton_t *auth_baton;

 

            // Add the providers.

            apr_array_header_t *providers = apr_array_make (pool, 10,
sizeof (svn_auth_provider_object_t *));

 

            svn_auth_provider_object_t *provider;

            svn_client_get_windows_simple_provider (&provider, pool);

            APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) =
provider;

            svn_client_get_simple_provider (&provider, pool);

            APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) =
provider;

            svn_client_get_username_provider (&provider, pool);

            APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) =
provider;

 

            /* The server-cert, client-cert, and client-cert-password
providers. */

            svn_client_get_ssl_server_trust_file_provider (&provider,
pool);

            APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) =
provider;

            svn_client_get_ssl_client_cert_file_provider (&provider,
pool);

            APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) =
provider;

            svn_client_get_ssl_client_cert_pw_file_provider (&provider,
pool);

            APR_ARRAY_PUSH (providers, svn_auth_provider_object_t *) =
provider;

 

            svn_auth_open (&auth_baton, providers, pool);

 

            // Set the username and password from the stored values.

            svn_auth_set_parameter(auth_baton,
SVN_AUTH_PARAM_DEFAULT_USERNAME,

                  g_username.c_str());

            svn_auth_set_parameter(auth_baton,
SVN_AUTH_PARAM_DEFAULT_PASSWORD,

                  g_password.c_str());

 

 

            // Fill in the context data.

            (*ctx)->auth_baton = auth_baton;

            (*ctx)->cancel_func = NULL;

            (*ctx)->cancel_baton = NULL;

 

            (*ctx)->conflict_func = NULL;

            (*ctx)->conflict_baton = NULL;

 

// (*ctx)->log_msg_func = NULL;

            (*ctx)->log_msg_baton = NULL;

            (*ctx)->log_msg_func2 = NULL;

            (*ctx)->log_msg_baton2 = NULL;

            (*ctx)->log_msg_func3 = NULL;

            (*ctx)->log_msg_baton3 = NULL;

 

            (*ctx)->notify_func = NULL;

            (*ctx)->notify_baton = NULL;

            (*ctx)->notify_func2 = NULL;

            (*ctx)->notify_baton2 = NULL;

 

            (*ctx)->progress_func = NULL;

            (*ctx)->progress_baton = NULL;

      }

      return NULL;

}

 

////////////////////////////////////////////////////////////////////////
////

 

 

 

 

As you can see, the username and password are just being set as defaults
and are not encrytped at the mo.

There are no callback functions currently, however I have written
functions for them all and they make no difference.

 

Is there something I am missing that is required for commits?

 

 

Please help! Thanks.

 

Pete.

 

 

 

 

 

 

 
Received on 2008-10-13 13:26:18 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.