subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r1357825 - in /subversion/branches/master-passphrase/subversion: include/svn_config.h libsvn_subr/cmdline.c libsvn_subr/config_file.c
Date Thu, 05 Jul 2012 19:37:03 GMT
Author: cmpilato
Date: Thu Jul  5 19:37:02 2012
New Revision: 1357825

URL: http://svn.apache.org/viewvc?rev=1357825&view=rev
Log:
On the 'master-passphrase' branch, add the use-master-password runtime
configuration option and tie all the current auth providers to that
feature being disabled.  (This won't necessarily be the shipped
behavior, but for now it makes for an easy way for me to work without
my cached credentials getting in the way.)

* subversion/include/svn_config.h
  (SVN_CONFIG_OPTION_USE_MASTER_PASSWORD): New.

* subversion/libsvn_subr/config_file.c
  (svn_config_ensure): Add configuration template bits for a new
    'use-master-password' configuration option.

* subversion/libsvn_subr/cmdline.c
  (get_old_auth_providers): New function, cored near-verbatim from...
  (svn_cmdline_create_auth_baton): ...this one, which now only fetches
    the old auth provider when master passphrase support is disabled.

Modified:
    subversion/branches/master-passphrase/subversion/include/svn_config.h
    subversion/branches/master-passphrase/subversion/libsvn_subr/cmdline.c
    subversion/branches/master-passphrase/subversion/libsvn_subr/config_file.c

Modified: subversion/branches/master-passphrase/subversion/include/svn_config.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/include/svn_config.h?rev=1357825&r1=1357824&r2=1357825&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/include/svn_config.h (original)
+++ subversion/branches/master-passphrase/subversion/include/svn_config.h Thu Jul  5 19:37:02
2012
@@ -89,6 +89,7 @@ typedef struct svn_config_t svn_config_t
 
 #define SVN_CONFIG_CATEGORY_CONFIG          "config"
 #define SVN_CONFIG_SECTION_AUTH                 "auth"
+#define SVN_CONFIG_OPTION_USE_MASTER_PASSWORD       "use-master-password"
 #define SVN_CONFIG_OPTION_PASSWORD_STORES           "password-stores"
 #define SVN_CONFIG_OPTION_KWALLET_WALLET            "kwallet-wallet"
 #define SVN_CONFIG_OPTION_KWALLET_SVN_APPLICATION_NAME_WITH_PID "kwallet-svn-application-name-with-pid"

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/cmdline.c?rev=1357825&r1=1357824&r2=1357825&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/cmdline.c Thu Jul  5 19:37:02
2012
@@ -443,27 +443,20 @@ ssl_trust_unknown_server_cert
   return SVN_NO_ERROR;
 }
 
-svn_error_t *
-svn_cmdline_create_auth_baton(svn_auth_baton_t **ab,
-                              svn_boolean_t non_interactive,
-                              const char *auth_username,
-                              const char *auth_password,
-                              const char *config_dir,
-                              svn_boolean_t no_auth_cache,
-                              svn_boolean_t trust_server_cert,
-                              svn_config_t *cfg,
-                              svn_cancel_func_t cancel_func,
-                              void *cancel_baton,
-                              apr_pool_t *pool)
+static svn_error_t *
+get_old_auth_providers(apr_array_header_t **providers_p,
+                       svn_boolean_t non_interactive,
+                       const char *config_dir,
+                       svn_boolean_t trust_server_cert,
+                       svn_config_t *cfg,
+                       svn_cancel_func_t cancel_func,
+                       void *cancel_baton,
+                       apr_pool_t *pool)
 {
-  svn_boolean_t store_password_val = TRUE;
-  svn_boolean_t store_auth_creds_val = TRUE;
+  apr_array_header_t *providers;
   svn_auth_provider_object_t *provider;
   svn_cmdline_prompt_baton2_t *pb = NULL;
 
-  /* The whole list of registered providers */
-  apr_array_header_t *providers;
-
   /* Populate the registered providers with the platform-specific providers */
   SVN_ERR(svn_auth_get_platform_specific_client_providers(&providers,
                                                           cfg, pool));
@@ -561,6 +554,47 @@ svn_cmdline_create_auth_baton(svn_auth_b
       APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
     }
 
+  *providers_p = providers;
+  return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_cmdline_create_auth_baton(svn_auth_baton_t **ab,
+                              svn_boolean_t non_interactive,
+                              const char *auth_username,
+                              const char *auth_password,
+                              const char *config_dir,
+                              svn_boolean_t no_auth_cache,
+                              svn_boolean_t trust_server_cert,
+                              svn_config_t *cfg,
+                              svn_cancel_func_t cancel_func,
+                              void *cancel_baton,
+                              apr_pool_t *pool)
+{
+  svn_boolean_t store_password_val = TRUE;
+  svn_boolean_t store_auth_creds_val = TRUE;
+  svn_boolean_t use_master_password;
+
+  /* The whole list of registered providers */
+  apr_array_header_t *providers;
+
+  SVN_ERR(svn_config_get_bool(cfg, &use_master_password,
+                              SVN_CONFIG_SECTION_AUTH,
+                              SVN_CONFIG_OPTION_USE_MASTER_PASSWORD,
+                              FALSE));
+
+  if (use_master_password)
+    {
+      providers = apr_array_make(pool, 1,
+                                 sizeof(svn_auth_provider_object_t *));
+    }
+  else
+    {
+      SVN_ERR(get_old_auth_providers(&providers, non_interactive,
+                                     config_dir, trust_server_cert, cfg,
+                                     cancel_func, cancel_baton, pool));
+    }
+
   /* Build an authentication baton to give to libsvn_client. */
   svn_auth_open(ab, providers, pool);
 

Modified: subversion/branches/master-passphrase/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_subr/config_file.c?rev=1357825&r1=1357824&r2=1357825&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_subr/config_file.c Thu Jul  5
19:37:02 2012
@@ -1006,6 +1006,9 @@ svn_config_ensure(const char *config_dir
         ""                                                                   NL
         "### Section for authentication and authorization customizations."   NL
         "[auth]"                                                             NL
+        "### Enable encrypted storage of authentication credentials."        NL
+        "# use-master-password = no"                                         NL
+        "###"                                                                NL
         "### Set password stores used by Subversion. They should be"         NL
         "### delimited by spaces or commas. The order of values determines"  NL
         "### the order in which password stores are used."                   NL



Mime
View raw message