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

RE: svn commit: r35055 - in trunk/subversion: include libsvn_auth_gnome_keyring libsvn_subr

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Wed, 7 Jan 2009 15:14:36 +0100

> -----Original Message-----
> From: Senthil Kumaran S [mailto:senthil_at_collab.net]
> Sent: woensdag 7 januari 2009 11:45
> To: svn_at_subversion.tigris.org
> Subject: svn commit: r35055 - in trunk/subversion: include
> libsvn_auth_gnome_keyring libsvn_subr
>
> Author: stylesen
> Date: Wed Jan 7 02:45:06 2009
> New Revision: 35055

Sorry, I found another issue with this patch. It registers a commandline prompt for gui users at another level.

>
> Log:
> Follow up r34977.
>
> Remove cmdline prompt added to a library function.
>
> * subversion/libsvn_subr/auth.c
> (): Include svn_cmdline.h
> (svn_auth_get_platform_specific_provider): Change parameters passed
> to GNOME
> Keyring provider function.
>
> * subversion/libsvn_subr/prompt.c
> (svn_cmdline_auth_unlock_prompt): New function to prompt for
> unlocking GNOME
> Keyring.
>
> * subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
> (unlock_prompt_provider_baton_t): New baton.
> (get_default_keyring_name): New function to return default keyring's
> name.
> (check_keyring_is_locked): New function to check whether a keyring is
> locked.
> (gnome_keyring_unlock_keyring): Modified to unlock the provided
> keyring with
> a password supplied.
> (gnome_keyring_password_get, gnome_keyring_password_set): Get default
> keyring name with the new function.
> (gnome_keyring_simple_first_creds, gnome_keyring_simple_save_creds):
> Check
> if the keyring is locked and throw a prompt in order to get the
> password
> and unlock it.
> (svn_auth_get_gnome_keyring_simple_provider): Change signature in
> order to
> accept a prompt function. Since this API was added for 1.6, the name
> remains the same.
>
> * subversion/include/svn_cmdline.h
> (svn_cmdline_auth_unlock_prompt): New function signature added.
>
> * subversion/include/svn_auth.h
> (svn_auth_unlock_prompt_func_t): New callback.
> (svn_auth_unlock_provider_func_t): New function type returning GNOME
> Keyring
> authentication provider.
> (svn_auth_get_gnome_keyring_simple_provider): Change signature.

> Modified: trunk/subversion/libsvn_subr/auth.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/auth.c?pa
> threv=35055&r1=35054&r2=35055
> =======================================================================
> =======
> --- trunk/subversion/libsvn_subr/auth.c Tue Jan 6 12:22:23 2009
> (r35054)
> +++ trunk/subversion/libsvn_subr/auth.c Wed Jan 7 02:45:06 2009
> (r35055)
> @@ -27,6 +27,7 @@
> #include "svn_config.h"
> #include "svn_private_config.h"
> #include "svn_dso.h"
> +#include "svn_cmdline.h"
>
> /* The good way to think of this machinery is as a set of tables.
>
> @@ -381,6 +382,7 @@ svn_auth_get_platform_specific_provider(
> apr_pool_t *pool)
> {
> *provider = NULL;
> + svn_cmdline_prompt_baton2_t *pb = NULL;
>
> if (apr_strnatcmp(provider_name, "gnome_keyring") == 0 ||
> apr_strnatcmp(provider_name, "kwallet") == 0)
> @@ -423,10 +425,22 @@ svn_auth_get_platform_specific_provider(
> {
> if (strcmp(provider_type, "simple") == 0)
> {
> - svn_auth_simple_provider_func_t provider_function;
> - provider_function =
> (svn_auth_simple_provider_func_t)
> - provider_function_symbol;
> - provider_function(provider, pool);
> + if (strcmp(provider_name, "gnome_keyring") == 0)
> + {
> + svn_auth_unlock_provider_func_t
> provider_function;
> + provider_function =
> (svn_auth_unlock_provider_func_t)
> + provider_function_symbol;
> + provider_function(provider,
> +
> svn_cmdline_auth_unlock_prompt,
> + pb, pool);
> + }
> + else
> + {
> + svn_auth_simple_provider_func_t
> provider_function;
> + provider_function =
> (svn_auth_simple_provider_func_t)
> + provider_function_symbol;
> + provider_function(provider, pool);
> + }
> }
> else if (strcmp(provider_type, "ssl_client_cert_pw") ==
> 0)
> {

This method is generic for gui clients and commandline clients. This method should get the prompt handler from above instead of just choosing a cmdline implementation for the prompt handler.

svn_auth_get_platform_specific_provider should not register cmdline handlers, or javahl, the python and ruby bindings must be changed to no longer use this method.

See also its documentation:
==========================
/** Create and return @a *provider, an authentication provider of type @c
 * svn_auth_provider_object_t, or return @a NULL if the provider is not
 * available for the requested platform or the requested provider is unknown.
 *
 * Valid @a provider_name values are: "gnome_keyring", "keychain", "kwallet"
 * and "windows".
 *
 * Valid @a provider_type values are: "simple", "ssl_client_cert_pw" and
 * "ssl_server_trust".
 *
 * Allocate @a *provider in @a pool.
 *
 * What actually happens is we invoke the appropriate provider function to
 * supply the @a provider, like so:
 *
 * svn_auth_get_<name>_<type>_provider(@a provider, @a pool);
 *
 * @since New in 1.6.
 */
svn_error_t *
svn_auth_get_platform_specific_provider(svn_auth_provider_object_t **provider,
                                        const char *provider_name,
                                        const char *provider_type,
                                        apr_pool_t *pool);

============================

It says nothing about being cmdline specific, but calling this method will register a cmdline prompt now.

The prompt handler should be part of the CLI client, not part of the generic library. I don't think this very svn cli specific code should be shared among all clients.

        Bert

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1009974
Received on 2009-01-07 15:47:03 CET

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