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

Re: [PATCH] issue #4375: provide --password-fd option

From: Stefan Sperling <stsp_at_apache.org>
Date: Sun, 17 Sep 2017 11:08:13 +0200

On Sun, Sep 17, 2017 at 01:06:14AM -0700, William Orr wrote:
> Hey,
>
> This is my first patch to subversion, so please bear with me.
>
> This looks to address a very commonly requested feature: providing an
> alternative for automated tools to provide a password to svn via piping
> it in over an fd (similar to gnupg).

Hi William,

This looks good to me in principle and I support the idea.

Will the implementation of read_pass_from_fd() compile and work on Win32?
We usually defer such operations to APR to avoid portability concerns.
However, APR does not seem to offer an API which wraps fdopen().
Whenever we bypass APR and use system APIs directly we need to support
at least Unix-like systems and Win32.

We cannot change the parameter list of svn_cmdline_create_auth_baton2().
The function is already part of a release, so changing it breaks our
ABI compatibility promise. Instead, we can add a new function called
svn_cmdline_create_auth_baton3() which has the additional parameter.
The svn_cmdline_create_auth_baton2() interface can be implemented
as a wrapper around our new version of this function.

Given that this is feature intends to support non-interactive usage,
I wonder if it should depend on the --non-interactive option as well?
And maybe we could then reduce the new option to --password-from-stdin?

Some tools already use stdin for a different purpose, though.
E.g. 'svnrdump load' reads a dump file from stdin. But if we also extended
such tools with an option to read their normal input from a file, we could
make this idea work. "svnadmin load" already supports the -F (--file)
option for this purpose. Scripts would have to pass the right combination
of options: --non-interactive --password-from-stdin -F /tmp/my-dump-file
If --password-from-stdin is used without --non-interactive and without
-F then the program should error out and complain.

This idea also solves the portability question, since svn_stream_for_stdin2()
or apr_file_open_flags_stdin() could be used to read a password from stdin.
And we wouldn't need a new revision of svn_cmdline_create_auth_baton2()
either because the client could pass the password as a string, as it
does for the --password option.

> One outstanding concern that I couldn't find addressed is clearing out
> memory that once contained passwords (like with memset_s or
> explicit_bzero). If I missed a technique for doing this that exists in
> svn already, please let me know so I can update the diff.

I don't think we have an API for that either, unfortunately. However,
the same portability concerns apply. In any case, it would be great to
have such an API available in APR.

Regards,
Stefan

> Tested on Fedora 25 x86_64 and OpenBSD 6.1 x86_64.
>
> Please CC me; I'm not on this list.
>
> [[[
> Introduce global opt --password-fd to allow applications to provide a
> password over an already-opened file descriptor.
>
> * subversion/include/svn_cmdline.h
> (svn_cmdline_create_auth_baton2): Add `auth_password_fd` argument
> * subversion/include/svn_error_codes.h
> (SVN_ERR_IO_PIPE_READ_ERROR): Undeprecate, as now used
> * subversion/libsvn_subr/cmdline.c
> (read_pass_from_fd): Add static function to get password from a file
> descriptor
> (svn_cmdline_create_auth_baton2): Add `auth_password_fd` arg and
> trigger read of fd if this arg is not -1
> * subversion/libsvn_subr/deprecated.c:
> (svn_cmdline_create_auth_baton): Add default val of -1 when calling
> `svn_cmdline_create_auth_baton2`
> * subversion/svn/svn.c
> (svn_cl__longopt_t): Add `opt_auth_password_fd` longopt
> (svn_cl__global_options): Add `opt_auth_password_fd` to global options
> (sub_main): Process global option `opt_auth_password_fd` and pass it
> to `svn_cmdline_create_auth_baton2`
> * subversion/svnmucc/svnmucc.c
> (sub_main): Process global option `opt_auth_password_fd` and pass it
> to `svn_cmdline_create_auth_baton2`
> * subversion/svnrdump/svnrdump.c
> (svn_svnrdump__longopt_t): add `opt_auth_password_fd`
> (svnrdump__options): add help message for `--password-fd`
> (init_client_context): Pass `auth_password_fd` to
> `svn_cmdline_create_auth_baton2`
> (sub_main): Process global option `opt_auth_password_fd` and pass it
> to `init_client_context`
> * subversion/svnsync/svnsync.c
> (svnsync__opt): Add `svnsync_opt_source_password_fd` and
> `svnsync_opt_sync_password_fd`
> (svnsync_options): Add help messages for `--source-password-fd` and
> `--sync-password-fd`
> (opt_baton_t): Add `source_password_fd` and `sync_password_fd`
> (sub_main): Process global option `--source-password-fd` and
> `--sync-password-fd` and pass it to `svn_cmdline_create_auth_baton2`
> invocations
> * subversion/tests/cmdline/atomic-ra-revprop-change.c
> (construct_auth_baton): Pass -1 as the `auth_password_fd`
> * subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout
> (): Add new `--password-fd` option to expected output
> * subversion/tests/libsvn_ra/ra-test.c
> (check_tunnel_callback_test): Pass -1 as the `auth_password_fd`
> (tunnel_callback_test): Pass -1 as the `auth_password_fd`
> (tunnel_run_checkout): Pass -1 as the `auth_password_fd`
> * subversion/tests/svn_test_main.c
> (svn_test__init_auth_baton): Pass -1 as the `auth_password_fd`
> * tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
> (svn_min__opt_state_t): Add `auth_password_fd`
> * tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c
> (svn_min__longopt_t) Add `opt_auth_password_fd`
> (sub_main) Process global option `--password-fd` and pass it to
> `svn_cmdline_create_auth_baton2` invocations
> * tools/client-side/svnconflict/svnconflict.c
> (svnconflict_opt_state_t): Add `auth_password_fd`
> (svnconflict_options): Add `--password-fd` documentation
> (svnconflict_global_options): Add `opt_auth_password_fd`
> (sub_main): Process global option `--password-fd` and pass it to
> `svn_cmdline_create_auth_baton2` invocations
> * tools/dev/svnmover/svnmover.c
> (sub_main): Process global option `--password-fd` and pass it to
> `svn_cmdline_create_auth_baton2` invocations
> ]]]

> Index: subversion/include/svn_cmdline.h
> ===================================================================
> --- subversion/include/svn_cmdline.h (revisi??n: 1808405)
> +++ subversion/include/svn_cmdline.h (copia de trabajo)
> @@ -356,6 +356,7 @@ svn_cmdline_create_auth_baton2(svn_auth_baton_t **
> svn_boolean_t non_interactive,
> const char *username,
> const char *password,
> + int password_fd,
> const char *config_dir,
> svn_boolean_t no_auth_cache,
> svn_boolean_t trust_server_cert_unknown_ca,
> Index: subversion/include/svn_error_codes.h
> ===================================================================
> --- subversion/include/svn_error_codes.h (revisi??n: 1808405)
> +++ subversion/include/svn_error_codes.h (copia de trabajo)
> @@ -296,7 +296,6 @@ SVN_ERROR_START
> SVN_ERR_IO_CATEGORY_START + 4,
> "Framing error in pipe protocol")
>
> - /** @deprecated Unused, slated for removal in the next major release. */
> SVN_ERRDEF(SVN_ERR_IO_PIPE_READ_ERROR,
> SVN_ERR_IO_CATEGORY_START + 5,
> "Read error in pipe")
> Index: subversion/libsvn_subr/cmdline.c
> ===================================================================
> --- subversion/libsvn_subr/cmdline.c (revisi??n: 1808405)
> +++ subversion/libsvn_subr/cmdline.c (copia de trabajo)
> @@ -516,6 +516,39 @@ struct trust_server_cert_non_interactive_baton {
> svn_boolean_t trust_server_cert_other_failure;
> };
>
> +static svn_error_t *
> +read_pass_from_fd(int fd, const char **password, apr_pool_t *pool)
> +{
> + SVN_ERR_ASSERT(fd != -1);
> +
> + svn_error_t *err = SVN_NO_ERROR;
> + size_t password_size = 0;
> + ssize_t password_len = 0;
> + char *ret = NULL;
> + FILE *desc = NULL;
> + svn_stringbuf_t *password_str = NULL;
> +
> + if (! (desc = fdopen(fd, "r")))
> + {
> + return svn_error_create(SVN_ERR_IO_PIPE_READ_ERROR, NULL, NULL);
> + }
> +
> + if ((password_len = getline(&ret, &password_size, desc)) == -1)
> + {
> + err = svn_error_create(SVN_ERR_IO_PIPE_READ_ERROR, NULL, NULL);
> + goto cleanup;
> + }
> +
> + password_str = svn_stringbuf_create(ret, pool);
> + svn_stringbuf_chop(password_str, 1);
> + *password = password_str->data;
> +
> + cleanup:
> + free(ret);
> +
> + return err;
> +}
> +
> /* This implements 'svn_auth_ssl_server_trust_prompt_func_t'.
>
> Don't actually prompt. Instead, set *CRED_P to valid credentials
> @@ -567,6 +600,7 @@ svn_cmdline_create_auth_baton2(svn_auth_baton_t **
> svn_boolean_t non_interactive,
> const char *auth_username,
> const char *auth_password,
> + int auth_password_fd,
> const char *config_dir,
> svn_boolean_t no_auth_cache,
> svn_boolean_t trust_server_cert_unknown_ca,
> @@ -584,6 +618,7 @@ svn_cmdline_create_auth_baton2(svn_auth_baton_t **
> svn_boolean_t store_auth_creds_val = TRUE;
> svn_auth_provider_object_t *provider;
> svn_cmdline_prompt_baton2_t *pb = NULL;
> + const char *password = NULL;
>
> /* The whole list of registered providers */
> apr_array_header_t *providers;
> @@ -701,8 +736,14 @@ svn_cmdline_create_auth_baton2(svn_auth_baton_t **
> /* Build an authentication baton to give to libsvn_client. */
> svn_auth_open(ab, providers, pool);
>
> - /* Place any default --username or --password credentials into the
> - auth_baton's run-time parameter hash. */
> + /* need to audit for places I set it to 0 */
> + if (auth_password_fd != -1 && auth_password == NULL)
> + {
> + SVN_ERR(read_pass_from_fd(auth_password_fd, &password, pool));
> + }
> +
> + /* Place any default --username, --password or credentials read from password
> + fd into the auth_baton's run-time parameter hash. */
> if (auth_username)
> svn_auth_set_parameter(*ab, SVN_AUTH_PARAM_DEFAULT_USERNAME,
> auth_username);
> @@ -709,6 +750,9 @@ svn_cmdline_create_auth_baton2(svn_auth_baton_t **
> if (auth_password)
> svn_auth_set_parameter(*ab, SVN_AUTH_PARAM_DEFAULT_PASSWORD,
> auth_password);
> + else if (password)
> + svn_auth_set_parameter(*ab, SVN_AUTH_PARAM_DEFAULT_PASSWORD,
> + password);
>
> /* Same with the --non-interactive option. */
> if (non_interactive)
> Index: subversion/libsvn_subr/deprecated.c
> ===================================================================
> --- subversion/libsvn_subr/deprecated.c (revisi??n: 1808405)
> +++ subversion/libsvn_subr/deprecated.c (copia de trabajo)
> @@ -1573,6 +1573,7 @@ svn_cmdline_create_auth_baton(svn_auth_baton_t **a
> non_interactive,
> auth_username,
> auth_password,
> + -1,
> config_dir,
> no_auth_cache,
> trust_server_cert,
> Index: subversion/svn/cl.h
> ===================================================================
> --- subversion/svn/cl.h (revisi??n: 1808405)
> +++ subversion/svn/cl.h (copia de trabajo)
> @@ -178,6 +178,7 @@ typedef struct svn_cl__opt_state_t
> svn_boolean_t help; /* print usage message */
> const char *auth_username; /* auth username */
> const char *auth_password; /* auth password */
> + int auth_password_fd; /* fd to read password from */
> const char *extensions; /* subprocess extension args */
> apr_array_header_t *targets; /* target list from file */
> svn_boolean_t xml; /* output in xml, e.g., "svn log --xml" */
> Index: subversion/svn/svn.c
> ===================================================================
> --- subversion/svn/svn.c (revisi??n: 1808405)
> +++ subversion/svn/svn.c (copia de trabajo)
> @@ -68,6 +68,7 @@
> use the short option letter as identifier. */
> typedef enum svn_cl__longopt_t {
> opt_auth_password = SVN_OPT_FIRST_LONGOPT_ID,
> + opt_auth_password_fd,
> opt_auth_username,
> opt_autoprops,
> opt_changelist,
> @@ -200,6 +201,8 @@ const apr_getopt_option_t svn_cl__options[] =
> N_("specify a password ARG (caution: on many operating\n"
> " "
> "systems, other users will be able to see this)")},
> + {"password-fd", opt_auth_password_fd, 1,
> + N_("specify an fd to read a password from ARG")},
> {"extensions", 'x', 1,
> N_("Specify differencing options for external diff or\n"
> " "
> @@ -495,7 +498,8 @@ const apr_getopt_option_t svn_cl__options[] =
> command to take these arguments allows scripts to just pass them
> willy-nilly to every invocation of 'svn') . */
> const int svn_cl__global_options[] =
> -{ opt_auth_username, opt_auth_password, opt_no_auth_cache, opt_non_interactive,
> +{ opt_auth_username, opt_auth_password, opt_auth_password_fd,
> + opt_no_auth_cache, opt_non_interactive,
> opt_force_interactive, opt_trust_server_cert,
> opt_trust_server_cert_failures,
> opt_config_dir, opt_config_options, 0
> @@ -1991,6 +1995,7 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_state.set_depth = svn_depth_unknown;
> opt_state.accept_which = svn_cl__accept_unspecified;
> opt_state.show_revs = svn_cl__show_revs_invalid;
> + opt_state.auth_password_fd = -1;
>
> /* No args? Show usage. */
> if (argc <= 1)
> @@ -2251,6 +2256,9 @@ sub_main(int *exit_code, int argc, const char *arg
> SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
> opt_arg, pool));
> break;
> + case opt_auth_password_fd:
> + SVN_ERR(svn_cstring_atoi(&opt_state.auth_password_fd, opt_arg));
> + break;
> case opt_encoding:
> opt_state.encoding = apr_pstrdup(pool, opt_arg);
> break;
> @@ -3044,6 +3052,7 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_state.non_interactive,
> opt_state.auth_username,
> opt_state.auth_password,
> + opt_state.auth_password_fd,
> opt_state.config_dir,
> opt_state.no_auth_cache,
> opt_state.trust_server_cert_unknown_ca,
> Index: subversion/svnbench/cl.h
> ===================================================================
> --- subversion/svnbench/cl.h (revisi??n: 1808405)
> +++ subversion/svnbench/cl.h (copia de trabajo)
> @@ -80,6 +80,7 @@ typedef struct svn_cl__opt_state_t
> svn_boolean_t help; /* print usage message */
> const char *auth_username; /* auth username */ /* UTF-8! */
> const char *auth_password; /* auth password */ /* UTF-8! */
> + int auth_password_fd; /* auth password fd */
> apr_array_header_t *targets; /* target list from file */ /* UTF-8! */
> svn_boolean_t no_auth_cache; /* do not cache authentication information */
> svn_boolean_t stop_on_copy; /* don't cross copies during processing */
> Index: subversion/svnbench/svnbench.c
> ===================================================================
> --- subversion/svnbench/svnbench.c (revisi??n: 1808405)
> +++ subversion/svnbench/svnbench.c (copia de trabajo)
> @@ -53,6 +53,7 @@
> use the short option letter as identifier. */
> typedef enum svn_cl__longopt_t {
> opt_auth_password = SVN_OPT_FIRST_LONGOPT_ID,
> + opt_auth_password_fd,
> opt_auth_username,
> opt_config_dir,
> opt_config_options,
> @@ -112,6 +113,7 @@ const apr_getopt_option_t svn_cl__options[] =
> {"verbose", 'v', 0, N_("print extra information")},
> {"username", opt_auth_username, 1, N_("specify a username ARG")},
> {"password", opt_auth_password, 1, N_("specify a password ARG")},
> + {"password-fd", opt_auth_password_fd, 1, N_("specify a password-fd ARG")},
> {"targets", opt_targets, 1,
> N_("pass contents of file ARG as additional args")},
> {"depth", opt_depth, 1,
> @@ -197,7 +199,8 @@ const apr_getopt_option_t svn_cl__options[] =
> command to take these arguments allows scripts to just pass them
> willy-nilly to every invocation of 'svn') . */
> const int svn_cl__global_options[] =
> -{ opt_auth_username, opt_auth_password, opt_no_auth_cache, opt_non_interactive,
> +{ opt_auth_username, opt_auth_password, opt_auth_password_fd,
> + opt_no_auth_cache, opt_non_interactive,
> opt_trust_server_cert, opt_trust_server_cert_failures,
> opt_config_dir, opt_config_options, 0
> };
> @@ -420,6 +423,7 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_state.revision_ranges =
> apr_array_make(pool, 0, sizeof(svn_opt_revision_range_t *));
> opt_state.depth = svn_depth_unknown;
> + opt_state.auth_password_fd = -1;
>
> /* No args? Show usage. */
> if (argc <= 1)
> @@ -625,6 +629,9 @@ sub_main(int *exit_code, int argc, const char *arg
> SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
> opt_arg, pool));
> break;
> + case opt_auth_password_fd:
> + SVN_ERR(svn_cstring_atoi(&opt_state.auth_password_fd, opt_arg));
> + break;
> case opt_stop_on_copy:
> opt_state.stop_on_copy = TRUE;
> break;
> @@ -929,6 +936,7 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_state.non_interactive,
> opt_state.auth_username,
> opt_state.auth_password,
> + opt_state.auth_password_fd,
> opt_state.config_dir,
> opt_state.no_auth_cache,
> opt_state.trust_server_cert_unknown_ca,
> Index: subversion/svnmucc/svnmucc.c
> ===================================================================
> --- subversion/svnmucc/svnmucc.c (revisi??n: 1808405)
> +++ subversion/svnmucc/svnmucc.c (copia de trabajo)
> @@ -480,7 +480,8 @@ sub_main(int *exit_code, int argc, const char *arg
> non_interactive_opt,
> force_interactive_opt,
> trust_server_cert_opt,
> - trust_server_cert_failures_opt
> + trust_server_cert_failures_opt,
> + password_fd_opt
> };
> static const apr_getopt_option_t options[] = {
> {"message", 'm', 1, ""},
> @@ -487,6 +488,7 @@ sub_main(int *exit_code, int argc, const char *arg
> {"file", 'F', 1, ""},
> {"username", 'u', 1, ""},
> {"password", 'p', 1, ""},
> + {"password-fd", password_fd_opt, 1, ""},
> {"root-url", 'U', 1, ""},
> {"revision", 'r', 1, ""},
> {"with-revprop", with_revprop_opt, 1, ""},
> @@ -527,6 +529,7 @@ sub_main(int *exit_code, int argc, const char *arg
> svn_client_ctx_t *ctx;
> struct log_message_baton lmb;
> int i;
> + int password_fd = -1;
>
> /* Check library versions */
> SVN_ERR(check_lib_versions());
> @@ -572,6 +575,8 @@ sub_main(int *exit_code, int argc, const char *arg
> case 'p':
> password = apr_pstrdup(pool, arg);
> break;
> + case password_fd_opt:
> + SVN_ERR(svn_cstring_atoi(&password_fd, arg));
> case 'U':
> SVN_ERR(svn_utf_cstring_to_utf8(&root_url, arg, pool));
> if (! svn_path_is_url(root_url))
> @@ -729,6 +734,7 @@ sub_main(int *exit_code, int argc, const char *arg
> non_interactive,
> username,
> password,
> + password_fd,
> config_dir,
> no_auth_cache,
> trust_unknown_ca,
> Index: subversion/svnrdump/svnrdump.c
> ===================================================================
> --- subversion/svnrdump/svnrdump.c (revisi??n: 1808405)
> +++ subversion/svnrdump/svnrdump.c (copia de trabajo)
> @@ -59,6 +59,7 @@ enum svn_svnrdump__longopt_t
> opt_config_option,
> opt_auth_username,
> opt_auth_password,
> + opt_auth_password_fd,
> opt_auth_nocache,
> opt_non_interactive,
> opt_skip_revprop,
> @@ -73,6 +74,7 @@ enum svn_svnrdump__longopt_t
> opt_config_option, \
> opt_auth_username, \
> opt_auth_password, \
> + opt_auth_password_fd, \
> opt_auth_nocache, \
> opt_trust_server_cert, \
> opt_trust_server_cert_failures, \
> @@ -114,6 +116,8 @@ static const apr_getopt_option_t svnrdump__options
> N_("specify a username ARG")},
> {"password", opt_auth_password, 1,
> N_("specify a password ARG")},
> + {"password-fd", opt_auth_password, 1,
> + N_("specify a password fd ARG")},
> {"non-interactive", opt_non_interactive, 0,
> N_("do no interactive prompting (default is to prompt\n"
> " "
> @@ -294,6 +298,7 @@ init_client_context(svn_client_ctx_t **ctx_p,
> svn_boolean_t non_interactive,
> const char *username,
> const char *password,
> + int password_fd,
> const char *config_dir,
> const char *repos_url,
> svn_boolean_t no_auth_cache,
> @@ -366,7 +371,8 @@ init_client_context(svn_client_ctx_t **ctx_p,
>
> /* Default authentication providers for non-interactive use */
> SVN_ERR(svn_cmdline_create_auth_baton2(&(ctx->auth_baton), non_interactive,
> - username, password, config_dir,
> + username, password, password_fd,
> + config_dir,
> no_auth_cache, trust_unknown_ca,
> trust_cn_mismatch, trust_expired,
> trust_not_yet_valid,
> @@ -760,6 +766,7 @@ sub_main(int *exit_code, int argc, const char *arg
> const char *config_dir = NULL;
> const char *username = NULL;
> const char *password = NULL;
> + int password_fd = -1;
> svn_boolean_t no_auth_cache = FALSE;
> svn_boolean_t trust_unknown_ca = FALSE;
> svn_boolean_t trust_cn_mismatch = FALSE;
> @@ -850,6 +857,8 @@ sub_main(int *exit_code, int argc, const char *arg
> case opt_auth_password:
> SVN_ERR(svn_utf_cstring_to_utf8(&password, opt_arg, pool));
> break;
> + case opt_auth_password_fd:
> + SVN_ERR(svn_cstring_atoi(&password_fd, opt_arg));
> case opt_auth_nocache:
> no_auth_cache = TRUE;
> break;
> @@ -1046,6 +1055,7 @@ sub_main(int *exit_code, int argc, const char *arg
> non_interactive,
> username,
> password,
> + password_fd,
> config_dir,
> opt_baton->url,
> no_auth_cache,
> Index: subversion/svnsync/svnsync.c
> ===================================================================
> --- subversion/svnsync/svnsync.c (revisi??n: 1808405)
> +++ subversion/svnsync/svnsync.c (copia de trabajo)
> @@ -59,8 +59,10 @@ enum svnsync__opt {
> svnsync_opt_auth_password,
> svnsync_opt_source_username,
> svnsync_opt_source_password,
> + svnsync_opt_source_password_fd,
> svnsync_opt_sync_username,
> svnsync_opt_sync_password,
> + svnsync_opt_sync_password_fd,
> svnsync_opt_config_dir,
> svnsync_opt_config_options,
> svnsync_opt_source_prop_encoding,
> @@ -84,8 +86,10 @@ enum svnsync__opt {
> svnsync_opt_trust_server_cert_failures_dst, \
> svnsync_opt_source_username, \
> svnsync_opt_source_password, \
> + svnsync_opt_source_password_fd, \
> svnsync_opt_sync_username, \
> svnsync_opt_sync_password, \
> + svnsync_opt_sync_password_fd, \
> svnsync_opt_config_dir, \
> svnsync_opt_config_options
>
> @@ -240,10 +244,14 @@ static const apr_getopt_option_t svnsync_options[]
> N_("connect to source repository with username ARG") },
> {"source-password", svnsync_opt_source_password, 1,
> N_("connect to source repository with password ARG") },
> + {"source-password-fd", svnsync_opt_source_password_fd, 1,
> + N_("connect to source repository with password from fd ARG") },
> {"sync-username", svnsync_opt_sync_username, 1,
> N_("connect to sync repository with username ARG") },
> {"sync-password", svnsync_opt_sync_password, 1,
> N_("connect to sync repository with password ARG") },
> + {"source-password-fd", svnsync_opt_sync_password_fd, 1,
> + N_("connect to sync repository with password from fd ARG") },
> {"config-dir", svnsync_opt_config_dir, 1,
> N_("read user configuration files from directory ARG")},
> {"config-option", svnsync_opt_config_options, 1,
> @@ -301,8 +309,10 @@ typedef struct opt_baton_t {
> svn_auth_baton_t *sync_auth_baton;
> const char *source_username;
> const char *source_password;
> + int source_password_fd;
> const char *sync_username;
> const char *sync_password;
> + int sync_password_fd;
> const char *config_dir;
> apr_hash_t *config;
> const char *source_prop_encoding;
> @@ -1973,6 +1983,7 @@ sub_main(int *exit_code, int argc, const char *arg
> apr_array_header_t *config_options = NULL;
> const char *source_prop_encoding = NULL;
> svn_boolean_t force_interactive = FALSE;
> + int source_password_fd = -1, sync_password_fd = -1;
>
> /* Check library versions */
> SVN_ERR(check_lib_versions());
> @@ -2071,6 +2082,10 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_err = svn_utf_cstring_to_utf8(&source_password, opt_arg, pool);
> break;
>
> + case svnsync_opt_source_password_fd:
> + opt_err = svn_cstring_atoi(&source_password_fd, opt_arg);
> + break;
> +
> case svnsync_opt_sync_username:
> opt_err = svn_utf_cstring_to_utf8(&sync_username, opt_arg, pool);
> break;
> @@ -2079,6 +2094,10 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_err = svn_utf_cstring_to_utf8(&sync_password, opt_arg, pool);
> break;
>
> + case svnsync_opt_sync_password_fd:
> + opt_err = svn_cstring_atoi(&sync_password_fd, opt_arg);
> + break;
> +
> case svnsync_opt_config_dir:
> {
> const char *path;
> @@ -2229,8 +2248,10 @@ sub_main(int *exit_code, int argc, const char *arg
> }
> opt_baton.source_username = source_username;
> opt_baton.source_password = source_password;
> + opt_baton.source_password_fd = source_password_fd;
> opt_baton.sync_username = sync_username;
> opt_baton.sync_password = sync_password;
> + opt_baton.sync_password_fd = sync_password_fd;
>
> /* Disallow mixing of --steal-lock and --disable-locking. */
> if (opt_baton.steal_lock && opt_baton.disable_locking)
> @@ -2351,6 +2372,7 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_baton.non_interactive,
> opt_baton.source_username,
> opt_baton.source_password,
> + opt_baton.source_password_fd,
> opt_baton.config_dir,
> opt_baton.no_auth_cache,
> opt_baton.src_trust.trust_server_cert_unknown_ca,
> @@ -2367,6 +2389,7 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_baton.non_interactive,
> opt_baton.sync_username,
> opt_baton.sync_password,
> + opt_baton.sync_password_fd,
> opt_baton.config_dir,
> opt_baton.no_auth_cache,
> opt_baton.dst_trust.trust_server_cert_unknown_ca,
> Index: subversion/tests/cmdline/atomic-ra-revprop-change.c
> ===================================================================
> --- subversion/tests/cmdline/atomic-ra-revprop-change.c (revisi??n: 1808405)
> +++ subversion/tests/cmdline/atomic-ra-revprop-change.c (copia de trabajo)
> @@ -60,7 +60,7 @@ construct_auth_baton(svn_auth_baton_t **auth_baton
> {
> SVN_ERR(svn_cmdline_create_auth_baton2(auth_baton_p,
> TRUE /* non_interactive */,
> - "jrandom", "rayjandom",
> + "jrandom", "rayjandom", -1,
> config_dir,
> TRUE /* no_auth_cache */,
> FALSE /* trust_server_cert */,
> Index: subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout
> ===================================================================
> --- subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout (revisi??n: 1808405)
> +++ subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout (copia de trabajo)
> @@ -134,6 +134,7 @@ Global options:
> --username ARG : specify a username ARG
> --password ARG : specify a password ARG (caution: on many operating
> systems, other users will be able to see this)
> + --password-fd ARG : specify an fd to read a password from ARG
> --no-auth-cache : do not cache authentication tokens
> --non-interactive : do no interactive prompting (default is to prompt
> only if standard input is a terminal device)
> @@ -224,6 +225,7 @@ Global options:
> --username ARG : specify a username ARG
> --password ARG : specify a password ARG (caution: on many operating
> systems, other users will be able to see this)
> + --password-fd ARG : specify an fd to read a password from ARG
> --no-auth-cache : do not cache authentication tokens
> --non-interactive : do no interactive prompting (default is to prompt
> only if standard input is a terminal device)
> Index: subversion/tests/libsvn_ra/ra-test.c
> ===================================================================
> --- subversion/tests/libsvn_ra/ra-test.c (revisi??n: 1808405)
> +++ subversion/tests/libsvn_ra/ra-test.c (copia de trabajo)
> @@ -344,7 +344,7 @@ check_tunnel_callback_test(const svn_test_opts_t *
> cbtable->tunnel_baton = b;
> SVN_ERR(svn_cmdline_create_auth_baton2(&cbtable->auth_baton,
> TRUE /* non_interactive */,
> - "jrandom", "rayjandom",
> + "jrandom", "rayjandom", -1,
> NULL,
> TRUE /* no_auth_cache */,
> FALSE /* trust_server_cert */,
> @@ -387,7 +387,7 @@ tunnel_callback_test(const svn_test_opts_t *opts,
> cbtable->tunnel_baton = b;
> SVN_ERR(svn_cmdline_create_auth_baton2(&cbtable->auth_baton,
> TRUE /* non_interactive */,
> - "jrandom", "rayjandom",
> + "jrandom", "rayjandom", -1,
> NULL,
> TRUE /* no_auth_cache */,
> FALSE /* trust_server_cert */,
> @@ -1557,7 +1557,7 @@ tunnel_run_checkout(const svn_test_opts_t *opts,
> cbtable->tunnel_baton = b;
> SVN_ERR(svn_cmdline_create_auth_baton2(&cbtable->auth_baton,
> TRUE /* non_interactive */,
> - "jrandom", "rayjandom",
> + "jrandom", "rayjandom", -1,
> NULL,
> TRUE /* no_auth_cache */,
> FALSE /* trust_server_cert */,
> Index: subversion/tests/svn_test_main.c
> ===================================================================
> --- subversion/tests/svn_test_main.c (revisi??n: 1808405)
> +++ subversion/tests/svn_test_main.c (copia de trabajo)
> @@ -754,7 +754,7 @@ svn_test__init_auth_baton(svn_auth_baton_t **ab,
>
> SVN_ERR(svn_cmdline_create_auth_baton2(ab,
> TRUE /* non_interactive */,
> - "jrandom", "rayjandom",
> + "jrandom", "rayjandom", -1,
> NULL,
> TRUE /* no_auth_cache */,
> TRUE /* trust_server_cert_unkown_ca */,
> Index: tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h
> ===================================================================
> --- tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h (revisi??n: 1808405)
> +++ tools/client-side/svn-mergeinfo-normalizer/mergeinfo-normalizer.h (copia de trabajo)
> @@ -56,6 +56,7 @@ typedef struct svn_min__opt_state_t
> svn_boolean_t help; /* print usage message */
> const char *auth_username; /* auth username */
> const char *auth_password; /* auth password */
> + int auth_password_fd; /* auth password fd */
> apr_array_header_t *targets;
> svn_boolean_t no_auth_cache; /* do not cache authentication information */
> svn_boolean_t dry_run; /* try operation but make no changes */
> Index: tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c
> ===================================================================
> --- tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c (revisi??n: 1808405)
> +++ tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c (copia de trabajo)
> @@ -68,6 +68,7 @@
> use the short option letter as identifier. */
> typedef enum svn_min__longopt_t {
> opt_auth_password = SVN_OPT_FIRST_LONGOPT_ID,
> + opt_auth_password_fd,
> opt_auth_username,
> opt_config_dir,
> opt_config_options,
> @@ -113,6 +114,8 @@ const apr_getopt_option_t svn_min__options[] =
> N_("specify a password ARG (caution: on many operating\n"
> " "
> "systems, other users will be able to see this)")},
> + {"password-fd", opt_auth_password_fd, 1,
> + N_("specify an fd to read a password from")},
> {"targets", opt_targets, 1,
> N_("pass contents of file ARG as additional args")},
> {"depth", opt_depth, 1,
> @@ -419,6 +422,7 @@ sub_main(int *exit_code, int argc, const char *arg
> apr_hash_t *cfg_hash;
>
> received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
> + opt_state.auth_password_fd = -1;
>
> /* Check library versions */
> SVN_ERR(check_lib_versions());
> @@ -528,6 +532,9 @@ sub_main(int *exit_code, int argc, const char *arg
> SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
> opt_arg, pool));
> break;
> + case opt_auth_password_fd:
> + SVN_ERR(svn_cstring_atoi(&opt_state.auth_password_fd, opt_arg));
> + break;
> case opt_no_auth_cache:
> opt_state.no_auth_cache = TRUE;
> break;
> @@ -825,6 +832,7 @@ sub_main(int *exit_code, int argc, const char *arg
> opt_state.non_interactive,
> opt_state.auth_username,
> opt_state.auth_password,
> + opt_state.auth_password_fd,
> opt_state.config_dir,
> opt_state.no_auth_cache,
> opt_state.trust_server_cert_unknown_ca,
> Index: tools/client-side/svnconflict/svnconflict.c
> ===================================================================
> --- tools/client-side/svnconflict/svnconflict.c (revisi??n: 1808405)
> +++ tools/client-side/svnconflict/svnconflict.c (copia de trabajo)
> @@ -60,6 +60,7 @@ typedef struct svnconflict_opt_state_t {
> svn_boolean_t help; /* print usage message */
> const char *auth_username; /* auth username */
> const char *auth_password; /* auth password */
> + int auth_password_fd; /* auth password fd */
> const char *config_dir; /* over-riding configuration directory */
> apr_array_header_t *config_options; /* over-riding configuration options */
> } svnconflict_opt_state_t;
> @@ -78,6 +79,7 @@ typedef struct svnconflict_cmd_baton_t
> use the short option letter as identifier. */
> typedef enum svnconflict_longopt_t {
> opt_auth_password = SVN_OPT_FIRST_LONGOPT_ID,
> + opt_auth_password_fd,
> opt_auth_username,
> opt_config_dir,
> opt_config_options,
> @@ -96,6 +98,8 @@ static const apr_getopt_option_t svnconflict_optio
> N_("specify a password ARG (caution: on many operating\n"
> " "
> "systems, other users will be able to see this)")},
> + {"password-fd", opt_auth_password_fd, 1,
> + N_("specify an fd to read a password from ARG")},
> {"config-dir", opt_config_dir, 1,
> N_("read user configuration files from directory ARG")},
> {"config-option", opt_config_options, 1,
> @@ -141,7 +145,8 @@ static svn_error_t * svnconflict_resolve_tree(apr_
>
> /* Options that apply to all commands. */
> static const int svnconflict_global_options[] =
> -{ opt_auth_username, opt_auth_password, opt_config_dir, opt_config_options, 0 };
> +{ opt_auth_username, opt_auth_password, opt_auth_password_fd,
> + opt_config_dir, opt_config_options, 0 };
>
> static const svn_opt_subcommand_desc2_t svnconflict_cmd_table[] =
> {
> @@ -641,6 +646,7 @@ sub_main(int *exit_code, int argc, const char *arg
> apr_hash_t *cfg_hash;
>
> received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
> + opt_state.auth_password_fd = -1;
>
> /* Check library versions */
> SVN_ERR(check_lib_versions());
> @@ -704,6 +710,9 @@ sub_main(int *exit_code, int argc, const char *arg
> SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
> opt_arg, pool));
> break;
> + case opt_auth_password_fd:
> + SVN_ERR(svn_cstring_atoi(&opt_state.auth_password_fd, opt_arg));
> + break;
> case opt_config_dir:
> SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
> opt_state.config_dir = svn_dirent_internal_style(utf8_opt_arg, pool);
> @@ -856,6 +865,7 @@ sub_main(int *exit_code, int argc, const char *arg
> TRUE, /* non-interactive */
> opt_state.auth_username,
> opt_state.auth_password,
> + opt_state.auth_password_fd,
> opt_state.config_dir,
> TRUE, /* no auth cache */
> FALSE, FALSE, FALSE, FALSE, FALSE, /* reject invalid SSL certs */
> Index: tools/dev/svnmover/svnmover.c
> ===================================================================
> --- tools/dev/svnmover/svnmover.c (revisi??n: 1808405)
> +++ tools/dev/svnmover/svnmover.c (copia de trabajo)
> @@ -4332,7 +4332,8 @@ sub_main(int *exit_code, int argc, const char *arg
> trust_server_cert_opt,
> trust_server_cert_failures_opt,
> ui_opt,
> - colour_opt
> + colour_opt,
> + auth_password_fd_opt
> };
> static const apr_getopt_option_t options[] = {
> {"verbose", 'v', 0, ""},
> @@ -4341,6 +4342,7 @@ sub_main(int *exit_code, int argc, const char *arg
> {"file", 'F', 1, ""},
> {"username", 'u', 1, ""},
> {"password", 'p', 1, ""},
> + {"password-fd", auth_password_fd_opt, 1, ""},
> {"root-url", 'U', 1, ""},
> {"revision", 'r', 1, ""},
> {"branch-id", 'B', 1, ""},
> @@ -4387,6 +4389,7 @@ sub_main(int *exit_code, int argc, const char *arg
> const char *log_msg;
> svn_tristate_t coloured_output = svn_tristate_false;
> svnmover_wc_t *wc;
> + int password_fd = -1;
>
> /* Check library versions */
> SVN_ERR(check_lib_versions());
> @@ -4431,6 +4434,9 @@ sub_main(int *exit_code, int argc, const char *arg
> case 'p':
> password = apr_pstrdup(pool, arg);
> break;
> + case auth_password_fd_opt:
> + password_fd = svn_cstring_atoi(&password_fd, arg);
> + break;
> case 'U':
> SVN_ERR(svn_utf_cstring_to_utf8(&anchor_url, arg, pool));
> if (! svn_path_is_url(anchor_url))
> @@ -4587,6 +4593,7 @@ sub_main(int *exit_code, int argc, const char *arg
> non_interactive,
> username,
> password,
> + password_fd,
> config_dir,
> no_auth_cache,
> trust_unknown_ca,
Received on 2017-09-17 11:08:35 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.