Index: subversion/include/svn_cmdline.h =================================================================== --- subversion/include/svn_cmdline.h (revision 17457) +++ subversion/include/svn_cmdline.h (working copy) @@ -238,6 +238,7 @@ svn_error_t * svn_cmdline_setup_auth_baton (svn_auth_baton_t **ab, svn_boolean_t non_interactive, + svn_boolean_t prompt_username, const char *username, const char *password, const char *config_dir, Index: subversion/include/svn_auth.h =================================================================== --- subversion/include/svn_auth.h (revision 17457) +++ subversion/include/svn_auth.h (working copy) @@ -512,6 +512,11 @@ #define SVN_AUTH_PARAM_DEFAULT_PASSWORD SVN_AUTH_PARAM_PREFIX "password" /** @} */ +/** @brief The application doesn't query the os or cached creds + * for the username. Property value is irrelevant; only property's + * existence matters. */ +#define SVN_AUTH_PARAM_PROMPT_USERNAME SVN_AUTH_PARAM_PREFIX "prompt" + /** @brief The application doesn't want any providers to prompt * users. Property value is irrelevant; only property's existence * matters. */ Index: subversion/libsvn_subr/cmdline.c =================================================================== --- subversion/libsvn_subr/cmdline.c (revision 17457) +++ subversion/libsvn_subr/cmdline.c (working copy) @@ -325,6 +325,7 @@ svn_error_t * svn_cmdline_setup_auth_baton (svn_auth_baton_t **ab, svn_boolean_t non_interactive, + svn_boolean_t prompt_username, const char *auth_username, const char *auth_password, const char *config_dir, @@ -412,6 +413,14 @@ svn_auth_set_parameter(*ab, SVN_AUTH_PARAM_DEFAULT_PASSWORD, auth_password); + /* If --prompt-username specified on the command line, add + * property to auth_baton's run-time parameter hash so that + * the simple providers will ignore provided, os, and cached + * usernames and always prompt for the appropriate username. */ + if (prompt_username) + svn_auth_set_parameter(*ab, SVN_AUTH_PARAM_PROMPT_USERNAME, + prompt_username); + /* Same with the --non-interactive option. */ if (non_interactive) svn_auth_set_parameter(*ab, SVN_AUTH_PARAM_NON_INTERACTIVE, ""); Index: subversion/libsvn_subr/username_providers.c =================================================================== --- subversion/libsvn_subr/username_providers.c (revision 17457) +++ subversion/libsvn_subr/username_providers.c (working copy) @@ -54,11 +54,14 @@ const char *username = apr_hash_get (parameters, SVN_AUTH_PARAM_DEFAULT_USERNAME, APR_HASH_KEY_STRING); + svn_boolean_t prompt_username = !! apr_hash_get (parameters, + SVN_AUTH_PARAM_PROMPT_USERNAME, + APR_HASH_KEY_STRING); svn_boolean_t may_save = !! username; svn_error_t *err; /* If we don't have a usename yet, try the auth cache */ - if (! username) + if (! username && !prompt_username) { apr_hash_t *creds_hash = NULL; @@ -81,7 +84,7 @@ } /* If that failed, ask the OS for the username */ - if (! username) + if (! username && !prompt_username) username = svn_user_get_name (pool); if (username) Index: subversion/libsvn_subr/simple_providers.c =================================================================== --- subversion/libsvn_subr/simple_providers.c (revision 17457) +++ subversion/libsvn_subr/simple_providers.c (working copy) @@ -124,11 +124,14 @@ const char *password = apr_hash_get (parameters, SVN_AUTH_PARAM_DEFAULT_PASSWORD, APR_HASH_KEY_STRING); + svn_boolean_t prompt_username = !! apr_hash_get (parameters, + SVN_AUTH_PARAM_PROMPT_USERNAME, + APR_HASH_KEY_STRING); svn_boolean_t may_save = username || password; svn_error_t *err; /* If we don't have a usename and a password yet, we try the auth cache */ - if (! (username && password)) + if (! (username && password) && !prompt_username) { apr_hash_t *creds_hash = NULL; @@ -183,10 +186,10 @@ /* Ask the OS for the username if we have a password but no username. */ - if (password && ! username) + if (password && ! username && !prompt_username) username = svn_user_get_name (pool); - if (username && password) + if (username && password && !prompt_username) { svn_auth_cred_simple_t *creds = apr_pcalloc (pool, sizeof(*creds)); creds->username = username; @@ -442,8 +445,11 @@ SVN_AUTH_PARAM_NO_AUTH_CACHE, APR_HASH_KEY_STRING); + svn_boolean_t prompt_username = !! apr_hash_get (parameters, + SVN_AUTH_PARAM_PROMPT_USERNAME, + APR_HASH_KEY_STRING); SVN_ERR (prompt_for_simple_creds ((svn_auth_cred_simple_t **) credentials_p, - pb, parameters, realmstring, TRUE, + pb, parameters, realmstring, !prompt_username, ! no_auth_cache, pool)); ibaton->retries = 0; Index: subversion/clients/cmdline/cl.h =================================================================== --- subversion/clients/cmdline/cl.h (revision 17457) +++ subversion/clients/cmdline/cl.h (working copy) @@ -70,6 +70,7 @@ svn_cl__non_interactive_opt, svn_cl__notice_ancestry_opt, svn_cl__old_cmd_opt, + svn_cl__prompt_username_opt, svn_cl__relocate_opt, svn_cl__revprop_opt, svn_cl__stop_on_copy_opt, @@ -117,6 +118,7 @@ svn_stringbuf_t *filedata; /* contents of file used as option data */ const char *encoding; /* the locale/encoding of the data*/ svn_boolean_t help; /* print usage message */ + svn_boolean_t prompt_username; /* always prompt for username and password */ const char *auth_username; /* auth username */ /* UTF-8! */ const char *auth_password; /* auth password */ /* UTF-8! */ const char *extensions; /* subprocess extension args */ /* UTF-8! */ Index: subversion/clients/cmdline/main.c =================================================================== --- subversion/clients/cmdline/main.c (revision 17457) +++ subversion/clients/cmdline/main.c (working copy) @@ -93,6 +93,7 @@ {"version", svn_cl__version_opt, 0, N_("print client version info")}, {"verbose", 'v', 0, N_("print extra information")}, {"show-updates", 'u', 0, N_("display update information")}, + {"prompt-username",svn_cl__prompt_username_opt, 0, N_("always prompt for username and password")}, {"username", svn_cl__auth_username_opt, 1, N_("specify a username ARG")}, {"password", svn_cl__auth_password_opt, 1, @@ -170,6 +171,7 @@ */ /* Options for authentication. */ #define SVN_CL__AUTH_OPTIONS svn_cl__auth_username_opt, \ + svn_cl__prompt_username_opt, \ svn_cl__auth_password_opt, \ svn_cl__no_auth_cache_opt, \ svn_cl__non_interactive_opt @@ -1050,6 +1052,9 @@ if (err) return svn_cmdline_handle_exit_error (err, pool, "svn: "); break; + case svn_cl__prompt_username_opt: + opt_state.prompt_username = TRUE; + break; case svn_cl__auth_password_opt: err = svn_utf_cstring_to_utf8 (&opt_state.auth_password, opt_arg, pool); @@ -1408,6 +1413,7 @@ /* Set up Authentication stuff. */ if ((err = svn_cmdline_setup_auth_baton (&ab, opt_state.non_interactive, + opt_state.prompt_username, opt_state.auth_username, opt_state.auth_password, opt_state.config_dir,