Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3)

Unified Diff: subversion/libsvn_subr/simple_providers.c

Issue 989: kwallet final branch SVN Base: http://svn.collab.net/repos/svn/trunk
Patch Set: Created 3 months, 2 weeks ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side by-side-diff with in-line comments
Download patch
Index: subversion/libsvn_subr/simple_providers.c
===================================================================
--- subversion/libsvn_subr/simple_providers.c (.../trunk) (revision 31195)
+++ subversion/libsvn_subr/simple_providers.c (.../branches/kwallet) (revision 31195)
@@ -2,7 +2,7 @@
* simple_providers.c: providers for SVN_AUTH_CRED_SIMPLE
*
* ====================================================================
- * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ * Copyright (c) 2003-2006, 2008 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -29,6 +29,8 @@
#include "svn_config.h"
#include "svn_user.h"
+#include "private/svn_auth_private.h"
+
#include "svn_private_config.h"
/*-----------------------------------------------------------------------*/
@@ -42,11 +44,12 @@
/* If you add a password type for a provider which stores
* passwords on disk in encrypted form, remember to update
- * simple_save_creds_helper. Otherwise it will be assumed
- * that your provider stores passwords in plaintext. */
+ * svn_auth__simple_save_creds_helper. Otherwise it will be
+ * assumed that your provider stores passwords in plaintext. */
#define SVN_AUTH__SIMPLE_PASSWORD_TYPE "simple"
#define SVN_AUTH__WINCRYPT_PASSWORD_TYPE "wincrypt"
#define SVN_AUTH__KEYCHAIN_PASSWORD_TYPE "keychain"
+#define SVN_AUTH__KWALLET_PASSWORD_TYPE "kwallet"
sussman 2008/05/15 15:14:41 Uhoh, this same constant is defined in kwallet.cpp
/* Baton type for the simple provider. */
typedef struct
@@ -60,34 +63,8 @@
} simple_provider_baton_t;
-/* A function that stores PASSWORD (or some encrypted version thereof)
- either directly in CREDS, or externally using REALMSTRING and USERNAME
- as keys into the external store. If NON_INTERACTIVE is set, the user
- must not be involved in the storage process. POOL is used for any
- necessary allocation. */
-typedef svn_boolean_t (*password_set_t)(apr_hash_t *creds,
- const char *realmstring,
- const char *username,
- const char *password,
- svn_boolean_t non_interactive,
- apr_pool_t *pool);
-
-/* A function that stores in *PASSWORD (potentially after decrypting it)
- the user's password. It might be obtained directly from CREDS, or
- from an external store, using REALMSTRING and USERNAME as keys.
- If NON_INTERACTIVE is set, the user must not be involved in the
- retrieval process. POOL is used for any necessary allocation. */
-typedef svn_boolean_t (*password_get_t)(const char **password,
- apr_hash_t *creds,
- const char *realmstring,
- const char *username,
- svn_boolean_t non_interactive,
- apr_pool_t *pool);
-
-
-
-/* Implementation of password_get_t that retrieves the plaintext password
- from CREDS. */
+/* Implementation of svn_auth__password_get_t that retrieves
+ the plaintext password from CREDS. */
static svn_boolean_t
simple_password_get(const char **password,
apr_hash_t *creds,
@@ -107,8 +84,8 @@
return FALSE;
}
-/* Implementation of password_set_t that store the plaintext password
- in CREDS. */
+/* Implementation of svn_auth__password_set_t that stores
+ the plaintext password in CREDS. */
static svn_boolean_t
simple_password_set(apr_hash_t *creds,
const char *realmstring,
@@ -128,15 +105,15 @@
CREDENTIALS. PASSWORD_GET is used to obtain the password value.
PASSTYPE identifies the type of the cached password. CREDENTIALS are
allocated from POOL. */
-static svn_error_t *
-simple_first_creds_helper(void **credentials,
- void **iter_baton,
- void *provider_baton,
- apr_hash_t *parameters,
- const char *realmstring,
- password_get_t password_get,
- const char *passtype,
- apr_pool_t *pool)
+svn_error_t *
+svn_auth__simple_first_creds_helper(void **credentials,
+ void **iter_baton,
+ void *provider_baton,
+ apr_hash_t *parameters,
+ const char *realmstring,
+ svn_auth__password_get_t password_get,
+ const char *passtype,
+ apr_pool_t *pool)
{
const char *config_dir = apr_hash_get(parameters,
SVN_AUTH_PARAM_CONFIG_DIR,
@@ -235,15 +212,15 @@
a set of CREDENTIALS to the simple auth provider's username and
password cache. PASSWORD_SET is used to store the password.
PASSTYPE identifies the type of the cached password. Allocates from POOL. */
-static svn_error_t *
-simple_save_creds_helper(svn_boolean_t *saved,
- void *credentials,
- void *provider_baton,
- apr_hash_t *parameters,
- const char *realmstring,
- password_set_t password_set,
- const char *passtype,
- apr_pool_t *pool)
+svn_error_t *
+svn_auth__simple_save_creds_helper(svn_boolean_t *saved,
+ void *credentials,
+ void *provider_baton,
+ apr_hash_t *parameters,
+ const char *realmstring,
+ svn_auth__password_set_t password_set,
+ const char *passtype,
+ apr_pool_t *pool)
{
svn_auth_cred_simple_t *creds = credentials;
apr_hash_t *creds_hash = NULL;
@@ -292,7 +269,8 @@
* ahead and store it to disk. Else determine whether saving
* in plaintext is OK. */
if (strcmp(passtype, SVN_AUTH__WINCRYPT_PASSWORD_TYPE) == 0
- || strcmp(passtype, SVN_AUTH__KEYCHAIN_PASSWORD_TYPE) == 0)
+ || strcmp(passtype, SVN_AUTH__KEYCHAIN_PASSWORD_TYPE) == 0
+ || strcmp(passtype, SVN_AUTH__KWALLET_PASSWORD_TYPE) == 0)
sussman 2008/05/15 15:14:41 This isn't your fault, Arfrever, but I worry about
{
may_save_password = TRUE;
}
@@ -416,12 +394,14 @@
const char *realmstring,
apr_pool_t *pool)
{
- return simple_first_creds_helper(credentials,
- iter_baton, provider_baton,
- parameters, realmstring,
- simple_password_get,
- SVN_AUTH__SIMPLE_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_first_creds_helper(credentials,
+ iter_baton,
+ provider_baton,
+ parameters,
+ realmstring,
+ simple_password_get,
+ SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+ pool);
}
/* Save (unencrypted) credentials to the simple provider's cache. */
@@ -433,11 +413,13 @@
const char *realmstring,
apr_pool_t *pool)
{
- return simple_save_creds_helper(saved, credentials, provider_baton,
- parameters, realmstring,
- simple_password_set,
- SVN_AUTH__SIMPLE_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_save_creds_helper(saved, credentials,
+ provider_baton,
+ parameters,
+ realmstring,
+ simple_password_set,
+ SVN_AUTH__SIMPLE_PASSWORD_TYPE,
+ pool);
}
static const svn_auth_provider_t simple_provider = {
@@ -703,8 +685,8 @@
return FALSE;
}
-/* Implementation of password_set_t that encrypts the incoming
- password using the Windows CryptoAPI. */
+/* Implementation of svn_auth__password_set_t that encrypts
+ the incoming password using the Windows CryptoAPI. */
static svn_boolean_t
windows_password_encrypter(apr_hash_t *creds,
const char *realmstring,
@@ -750,8 +732,9 @@
return crypted;
}
-/* Implementation of password_get_t that decrypts the incoming
- password using the Windows CryptoAPI and verifies its validity. */
+/* Implementation of svn_auth__password_get_t that decrypts
+ the incoming password using the Windows CryptoAPI and verifies its
+ validity. */
static svn_boolean_t
windows_password_decrypter(const char **out,
apr_hash_t *creds,
@@ -813,12 +796,14 @@
const char *realmstring,
apr_pool_t *pool)
{
- return simple_first_creds_helper(credentials,
- iter_baton, provider_baton,
- parameters, realmstring,
- windows_password_decrypter,
- SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_first_creds_helper(credentials,
+ iter_baton,
+ provider_baton,
+ parameters,
+ realmstring,
+ windows_password_decrypter,
+ SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
+ pool);
}
/* Save encrypted credentials to the simple provider's cache. */
@@ -830,11 +815,13 @@
const char *realmstring,
apr_pool_t *pool)
{
- return simple_save_creds_helper(saved, credentials, provider_baton,
- parameters, realmstring,
- windows_password_encrypter,
- SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_save_creds_helper(saved, credentials,
+ provider_baton,
+ parameters,
+ realmstring,
+ windows_password_encrypter,
+ SVN_AUTH__WINCRYPT_PASSWORD_TYPE,
+ pool);
}
static const svn_auth_provider_t windows_simple_provider = {
@@ -884,8 +871,8 @@
* the same Subversion auth provider-based app run concurrently.
*/
-/* Implementation of password_set_t that stores the password
- in the OS X KeyChain. */
+/* Implementation of svn_auth__password_set_t that stores
+ the password in the OS X KeyChain. */
static svn_boolean_t
keychain_password_set(apr_hash_t *creds,
const char *realmstring,
@@ -925,8 +912,8 @@
return status == 0;
}
-/* Implementation of password_get_t that retrieves the password
- from the OS X KeyChain. */
+/* Implementation of svn_auth__password_get_t that retrieves
+ the password from the OS X KeyChain. */
static svn_boolean_t
keychain_password_get(const char **password,
apr_hash_t *creds,
@@ -966,12 +953,14 @@
const char *realmstring,
apr_pool_t *pool)
{
- return simple_first_creds_helper(credentials,
- iter_baton, provider_baton,
- parameters, realmstring,
- keychain_password_get,
- SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_first_creds_helper(credentials,
+ iter_baton,
+ provider_baton,
+ parameters,
+ realmstring,
+ keychain_password_get,
+ SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+ pool);
}
/* Save encrypted credentials to the simple provider's cache. */
@@ -983,11 +972,13 @@
const char *realmstring,
apr_pool_t *pool)
{
- return simple_save_creds_helper(saved, credentials, provider_baton,
- parameters, realmstring,
- keychain_password_set,
- SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_save_creds_helper(saved, credentials,
+ provider_baton,
+ parameters,
+ realmstring,
+ keychain_password_set,
+ SVN_AUTH__KEYCHAIN_PASSWORD_TYPE,
+ pool);
}
static const svn_auth_provider_t keychain_simple_provider = {
« subversion/libsvn_subr/cmdline.c ('k') | no next file »

Powered by Google App Engine
This is Rietveld r294