On Wed, Sep 15, 2010 at 11:34 AM, Bert Huijben <b...@qqmail.nl> wrote:
>
>
>> -----Original Message-----
>> From: hwri...@apache.org [mailto:hwri...@apache.org]
>> Sent: woensdag 15 september 2010 11:18
>> To: comm...@subversion.apache.org
>> Subject: svn commit: r997237 - in
>> /subversion/trunk/subversion/bindings/javahl/native: ClientContext.cpp
>> ClientContext.h SVNClient.cpp
>>
>> Author: hwright
>> Date: Wed Sep 15 09:17:34 2010
>> New Revision: 997237
>>
>> URL: http://svn.apache.org/viewvc?rev=997237&view=rev
>> Log:
>> Revert r997228.  Apparently, some of the improved error handling added
>> in that
>> revision wasn't to friendly with the tests.  It will require further
>> digging,
>> but I'm reverting in the intrim.
>>
>> Modified:
>>
>> subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp
>>     subversion/trunk/subversion/bindings/javahl/native/ClientContext.h
>>     subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
>>
>> Modified:
>> subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp
>> URL:
>> http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javah
>> l/native/ClientContext.cpp?rev=997237&r1=997236&r2=997237&view=diff
>> =======================================================================
>> =======
>> ---
>> subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp
>> (original)
>> +++
>> subversion/trunk/subversion/bindings/javahl/native/ClientContext.cpp
>> Wed Sep 15 09:17:34 2010
>> @@ -97,20 +97,20 @@ ClientContext::~ClientContext()
>>      env->DeleteGlobalRef(m_jctx);
>>  }
>>
>> -svn_error_t *
>> -ClientContext::getContext(svn_client_ctx_t **ctx, CommitMessage
>> *message)
>> +svn_client_ctx_t *
>> +ClientContext::getContext(CommitMessage *message)
>>  {
>>      SVN::Pool *requestPool = JNIUtil::getRequestPool();
>>      apr_pool_t *pool = requestPool->pool();
>>      svn_auth_baton_t *ab;
>> -
>> -    *ctx = persistentCtx;
>> +    svn_client_ctx_t *ctx = persistentCtx;
>> +    //SVN_JNI_ERR(svn_client_create_context(&ctx, pool), NULL);
>>
>>      const char *configDir = m_configDir.c_str();
>>      if (m_configDir.length() == 0)
>>          configDir = NULL;
>> -    SVN_ERR(svn_config_get_config(&((*ctx)->config), configDir,
>> pool));
>> -    svn_config_t *config = (svn_config_t *) apr_hash_get((*ctx)-
>> >config,
>> +    SVN_JNI_ERR(svn_config_get_config(&(ctx->config), configDir,
>> pool), NULL);
>> +    svn_config_t *config = (svn_config_t *) apr_hash_get(ctx->config,
>>
>> SVN_CONFIG_CATEGORY_CONFIG,
>>
>> APR_HASH_KEY_STRING);
>>
>> @@ -118,8 +118,10 @@ ClientContext::getContext(svn_client_ctx
>>      apr_array_header_t *providers;
>>
>>      /* Populate the registered providers with the platform-specific
>> providers */
>> -
>> SVN_ERR(svn_auth_get_platform_specific_client_providers(&providers,
>> -                                                            config,
>> pool));
>> +
>> SVN_JNI_ERR(svn_auth_get_platform_specific_client_providers(&providers,
>> +
>> config,
>> +                                                                pool),
>> +                NULL);
>
>
> This doesn't look right (in the old and new code). If you use a client 
> session multiple time, you shouldn't recreate the auth baton on every 
> invocation, but only if there is a reason to recreate.
>
> The auth baton also handles some caching for the auth providers. (At least it 
> stores the used passwords that weren't saved to disk, but I think it also 
> stores some context state for a few providers)

The reason we have to recreate the auth baton is because the user
could change the various prompters in between invocations of client
APIs.  If the prompter was immutable, we wouldn't have to do this.

(There may be a clever way of coding around it, I just haven't gotten
there yet.)

-Hyrum

Reply via email to