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

Re: svn commit: r1658123 - in /subversion/trunk/subversion: bindings/javahl/native/OperationContext.cpp bindings/javahl/native/Prompter.cpp bindings/javahl/native/Prompter.h libsvn_auth_gnome_keyring/gnome_keyring.c

From: Mark Phippard <markphip_at_gmail.com>
Date: Sat, 7 Feb 2015 20:48:12 -0500

What might this be useful for? Non-GUI apps? I assume this will not break the current functionality, which finally works as of 1.8.11.

Mark

> On Feb 7, 2015, at 8:32 PM, rhuijben_at_apache.org wrote:
>
> Author: rhuijben
> Date: Sun Feb 8 01:32:07 2015
> New Revision: 1658123
>
> URL: http://svn.apache.org/r1658123
> Log:
> Expose the Gnome keyring unlock prompt to the JavaHL C++ code.
> (Exposing it to JavaHL itself is a different step where brane might
> have better ideas)
>
> * subversion/bindings/javahl/native/OperationContext.cpp
> (OperationContext::getAuthBaton):
> Hook gnome prompt if we have a prompter implementation.
>
> * subversion/bindings/javahl/native/Prompter.cpp
> (Prompter::get_gnome_keyring_unlock,
> Prompter::gnome_keyring_unlock_prompt): New function.
>
> * subversion/bindings/javahl/native/Prompter.h
> (Prompter::get_gnome_keyring_unlock,
> Prompter::gnome_keyring_unlock_prompt): New function.
>
> * subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
> (ensure_gnome_keyring_is_unlocked): Allow prompt func to not provide a
> password, similar to our other credential callbacks. This makes it easier
> for bindings to conditionally handle the prompt.
>
> Modified:
> subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp
> subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
> subversion/trunk/subversion/bindings/javahl/native/Prompter.h
> subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
>
> Modified: subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp?rev=1658123&r1=1658122&r2=1658123&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp (original)
> +++ subversion/trunk/subversion/bindings/javahl/native/OperationContext.cpp Sun Feb 8 01:32:07 2015
> @@ -218,6 +218,27 @@ OperationContext::getAuthBaton(SVN::Pool
> /* Build an authentication baton to give to libsvn_client. */
> svn_auth_open(&ab, providers, pool);
>
> + if (m_prompter.get())
> + {
> + svn_auth_gnome_keyring_unlock_prompt_func_t unlock_cb;
> + void *unlock_baton;
> +
> + m_prompter->get_gnome_keyring_unlock(&unlock_cb, &unlock_baton,
> + in_pool);
> +
> + if (unlock_cb)
> + {
> + svn_auth_set_parameter(
> + ab,
> + SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
> + unlock_cb);
> + svn_auth_set_parameter(
> + ab,
> + SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
> + unlock_baton);
> + }
> + }
> +
> /* Place any default --username or --password credentials into the
> * auth_baton's run-time parameter hash. ### Same with --no-auth-cache? */
> if (!m_userName.empty())
>
> Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp?rev=1658123&r1=1658122&r2=1658123&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp (original)
> +++ subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp Sun Feb 8 01:32:07 2015
> @@ -138,6 +138,16 @@ Prompter::get_provider_client_ssl_passwo
> return provider;
> }
>
> +void
> +Prompter::get_gnome_keyring_unlock(
> + svn_auth_gnome_keyring_unlock_prompt_func_t *cb,
> + void **baton,
> + SVN::Pool &in_pool)
> +{
> + *cb = gnome_keyring_unlock_prompt;
> + *baton = this;
> +}
> +
> svn_error_t *Prompter::simple_prompt(
> svn_auth_cred_simple_t **cred_p,
> void *baton,
> @@ -221,6 +231,18 @@ svn_error_t *Prompter::ssl_client_cert_p
> return err;
> }
>
> +svn_error_t *Prompter::gnome_keyring_unlock_prompt(
> + char **keyring_password,
> + const char *keyring_name,
> + void *baton,
> + apr_pool_t *pool)
> +{
> + /* ### TODO: Forward to Java */
> +
> + *keyring_password = NULL; /* Don't attempt an unlock */
> + return SVN_NO_ERROR;
> +}
> +
> svn_error_t *Prompter::plaintext_prompt(
> svn_boolean_t *may_save_plaintext,
> const char *realmstring,
>
> Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.h?rev=1658123&r1=1658122&r2=1658123&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/bindings/javahl/native/Prompter.h (original)
> +++ subversion/trunk/subversion/bindings/javahl/native/Prompter.h Sun Feb 8 01:32:07 2015
> @@ -60,6 +60,11 @@ public:
> svn_auth_provider_object_t *get_provider_client_ssl(SVN::Pool &in_pool);
> svn_auth_provider_object_t *get_provider_client_ssl_password(SVN::Pool &in_pool);
>
> + void get_gnome_keyring_unlock(
> + svn_auth_gnome_keyring_unlock_prompt_func_t *cb,
> + void **baton,
> + SVN::Pool &in_pool);
> +
> protected:
> explicit Prompter(::Java::Env env, jobject jprompter);
>
> @@ -144,6 +149,12 @@ protected:
> svn_boolean_t may_save,
> apr_pool_t *pool);
>
> + static svn_error_t *gnome_keyring_unlock_prompt(
> + char **keyring_password,
> + const char *keyring_name,
> + void *baton,
> + apr_pool_t *pool);
> +
> protected:
> virtual svn_error_t *dispatch_plaintext_prompt(
> ::Java::Env env,
>
> Modified: subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c?rev=1658123&r1=1658122&r2=1658123&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c (original)
> +++ subversion/trunk/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c Sun Feb 8 01:32:07 2015
> @@ -129,19 +129,22 @@ ensure_gnome_keyring_is_unlocked(svn_boo
> svn_hash_gets(parameters,
> SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON);
>
> - char *keyring_password;
> -
> if (unlock_prompt_func && check_keyring_is_locked(default_keyring))
> {
> + char *keyring_password;
> +
> SVN_ERR((*unlock_prompt_func)(&keyring_password,
> default_keyring,
> unlock_prompt_baton,
> scratch_pool));
>
> /* If keyring is locked give up and try the next provider. */
> - if (! unlock_gnome_keyring(default_keyring, keyring_password,
> - scratch_pool))
> - return SVN_NO_ERROR;
> + if (keyring_password)
> + {
> + if (! unlock_gnome_keyring(default_keyring, keyring_password,
> + scratch_pool))
> + return SVN_NO_ERROR;
> + }
> }
> }
> else
>
>
Received on 2015-02-08 10:51:09 CET

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

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