You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2012/07/13 22:04:33 UTC
svn commit: r1361363 - in
/subversion/branches/master-passphrase/subversion/libsvn_subr: auth_store.h
config_auth_store.c
Author: cmpilato
Date: Fri Jul 13 20:04:33 2012
New Revision: 1361363
URL: http://svn.apache.org/viewvc?rev=1361363&view=rev
Log:
Oops! Finish the work I started on the 'master-passphrase' branch in
r1360284 by tweaking the config-based auth store to match the
interfaces modified in that revision, too.
* subversion/libsvn_subr/auth_store.h
(svn_auth__config_store_get): Accept a 'config_dir' parameter
instead of a 'config' object.
* subversion/libsvn_subr/config_auth_store.c
(config_store_open): Remove unused variable.
(config_store_get_cred_hash, config_store_set_cred_hash): Were
config_store_fetch and config_store_store. Tweak to conform to
the new (as of r1360284) interfaces and behaviors for callbacks of
these sorts.
(svn_auth__config_store_get): Update call to modified/new (as of
r1360284) interfaces.
Modified:
subversion/branches/master-passphrase/subversion/libsvn_subr/auth_store.h
subversion/branches/master-passphrase/subversion/libsvn_subr/config_auth_store.c
Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/auth_store.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/auth_store.h?rev=1361363&r1=1361362&r2=1361363&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/auth_store.h (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/auth_store.h Fri Jul 13 20:04:33 2012
@@ -185,7 +185,7 @@ svn_auth__pathetic_store_get(svn_auth__s
*/
svn_error_t *
svn_auth__config_store_get(svn_auth__store_t **auth_store_p,
- const svn_config_t *cfg,
+ const char *config_dir,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/config_auth_store.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/config_auth_store.c?rev=1361363&r1=1361362&r2=1361363&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/config_auth_store.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/config_auth_store.c Fri Jul 13 20:04:33 2012
@@ -42,95 +42,39 @@ config_store_open(void *baton,
svn_boolean_t create,
apr_pool_t *scratch_pool)
{
- const svn_config_t *cfg = baton;
return SVN_NO_ERROR;
}
/* Implements pathetic_store_fetch_t. */
static svn_error_t *
-config_store_fetch(const void **creds_p,
- void *baton,
- const char *cred_kind,
- const char *realmstring,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+config_store_get_cred_hash(apr_hash_t **cred_hash,
+ void *baton,
+ const char *cred_kind,
+ const char *realmstring,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
const char *config_dir = baton;
- apr_hash_t *cred_hash;
- SVN_ERR(svn_config_read_auth_data(&cred_hash, cred_kind, realmstring,
+ SVN_ERR(svn_config_read_auth_data(cred_hash, cred_kind, realmstring,
config_dir, scratch_pool));
-
- if (strcmp(cred_kind, SVN_AUTH_CRED_USERNAME) == 0)
- {
- svn_auth_cred_username_t *creds =
- apr_pcalloc(result_pool, sizeof(*creds));
- prop = apr_hash_get(cred_hash, "username", APR_HASH_KEY_STRING);
- if (prop)
- creds->username = prop->data;
- *creds_p = (const void *)creds;
- }
- else if (strcmp(cred_kind, SVN_AUTH_CRED_SIMPLE) == 0)
- {
- svn_auth_cred_simple_t *creds =
- apr_pcalloc(result_pool, sizeof(*creds));
- prop = apr_hash_get(cred_hash, "username", APR_HASH_KEY_STRING);
- if (prop)
- creds->username = prop->data;
- prop = apr_hash_get(cred_hash, "password", APR_HASH_KEY_STRING);
- if (prop)
- creds->username = prop->data;
- *creds_p = (const void *)creds;
- }
- else
- {
- *creds_p = NULL;
- }
-
return SVN_NO_ERROR;
}
/* Implements pathetic_store_store_t. */
static svn_error_t *
-config_store_store(svn_boolean_t *stored,
- void *baton,
- const char *cred_kind,
- const char *realmstring,
- const void *generic_creds,
- apr_pool_t *scratch_pool)
+config_store_set_cred_hash(svn_boolean_t *stored,
+ void *baton,
+ const char *cred_kind,
+ const char *realmstring,
+ apr_hash_t *cred_hash,
+ apr_pool_t *scratch_pool)
{
- const const *config_dir = baton;
- apr_hash_t *cred_hash = NULL;
-
- *stored = FALSE;
+ const char *config_dir = baton;
- if (strcmp(cred_kind, SVN_AUTH_CRED_USERNAME) == 0)
- {
- const svn_auth_cred_username_t *creds = generic_creds;
- cred_hash = apr_hash_make(scratch_pool);
- if (creds->username)
- apr_hash_set(cred_hash, "username", APR_HASH_KEY_STRING,
- svn_string_create(creds->username, scratch_pool));
- }
- else if (strcmp(cred_kind, SVN_AUTH_CRED_SIMPLE) == 0)
- {
- const svn_auth_cred_simple_t *creds = generic_creds;
- cred_hash = apr_hash_make(scratch_pool);
- if (creds->username)
- apr_hash_set(cred_hash, "username", APR_HASH_KEY_STRING,
- svn_string_create(creds->username, scratch_pool));
- if (creds->password)
- apr_hash_set(cred_hash, "password", APR_HASH_KEY_STRING,
- svn_string_create(creds->password, scratch_pool));
- }
-
- if (cred_hash)
- {
- SVN_ERR(svn_config_write_auth_data(cred_hash, cred_kind, realmstring,
- config_dir, scratch_pool));
- *stored = TRUE;
- }
-
+ SVN_ERR(svn_config_write_auth_data(cred_hash, cred_kind, realmstring,
+ config_dir, scratch_pool));
+ *stored = TRUE;
return SVN_NO_ERROR;
}
@@ -147,11 +91,12 @@ svn_auth__config_store_get(svn_auth__sto
svn_auth__store_t *auth_store;
SVN_ERR(svn_auth__store_create(&auth_store, result_pool));
- SVN_ERR(svn_auth__store_set_baton(auth_store, config_dir));
- SVN_ERR(svn_auth__store_set_open(auth_store, pathetic_store_open));
- SVN_ERR(svn_auth__store_set_fetch(auth_store, pathetic_store_fetch));
- SVN_ERR(svn_auth__store_set_store(auth_store, pathetic_store_store));
-
+ SVN_ERR(svn_auth__store_set_baton(auth_store, (void *)config_dir));
+ SVN_ERR(svn_auth__store_set_open(auth_store, config_store_open));
+ SVN_ERR(svn_auth__store_set_get_cred_hash(auth_store,
+ config_store_get_cred_hash));
+ SVN_ERR(svn_auth__store_set_set_cred_hash(auth_store,
+ config_store_set_cred_hash));
*auth_store_p = auth_store;
return SVN_NO_ERROR;