William Orr <will@worrbase.com>


r1819093 | stsp | 2017-12-22 21:21:56 +0000 (Fri, 22 Dec 2017)

Introduce a new global option: --password-from-stdin

This new option makes Subversion's command line applications read a password
from standard input. It can be used as an alternative to the --password option
in order to provide passwords without leaking them to argv, which on Unix-like
systems can be viewed by anyone with tools such as ps(1).

Patch by: William Orr <will@worrbase.com>

* subversion/include/svn_io.h
  (svn_io_stdin_readline): Declare.

* subversion/libsvn_subr/io.c
  (svn_io_stdin_readline): New public API which reads a line of input from
   standard input.

* subversion/svn/cl.h
  (svn_cl__opt_state_t): Declare auth_password_from_stdin option.

* subversion/svn/svn.c,
  (svn_cl__longopt_t): Add opt_auth_password_from_stdin.
  (svn_cl__options): Add --password-from-stdin.
  (svn_cl__global_options): Add opt_auth_password_from_stdin. 
  (sub_main): Handle the new option.

* subversion/svnmucc/svnmucc.c
  (help): Add --password-from-stdin option to help text.
  (sub_main): Handle the new option.

* subversion/svnrdump/svnrdump.c
  (svn_svnrdump__longopt_t): Add opt_auth_password_from_stdin.
  (svnrdump__options, opt_baton_t): Add --password-from-stdin and --dumpfile.
  (opt_baton_t, replay_revisions, dump_cmp, load_cmd, sub_main): Add support
  for the new options. Since svnrdump has historically been reading dump file
  data from stdin the --password-from-stdin option requires --dumpfile.

* subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout:
   Adjust exected output.

* tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c
  (svn_min__longopt_t, svn_min__options): Add opt_auth_password_from_stdin.
  (svn_min__options): Add --password-from-stdin.
  (sub_main): Support the new options.

* tools/client-side/svnconflict/svnconflict.c
  (svnconflict_cmd_baton_t, global_options): Add opt_auth_password_from_stdin.
  (svnconflict_options): Add --password-from-stdin.
  (sub_main): Support the new options.