From 3ee1eac27a2e3120fbdc60e12db091c082b8de21 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Wed, 5 Jul 2017 10:58:48 -0400 Subject: Standardize apps use of -rand, etc. Standardized the -rand flag and added a new one: -rand file... Always reads the specified files -writerand file Always writes to the file on exit For apps that use a config file, the RANDFILE config parameter reads the file at startup (to seed the RNG) and write to it on exit if the -writerand flag isn't used. Ensured that every app that took -rand also took -writerand, and made sure all of that agreed with all the documentation. Fix error reporting in write_file and -rand Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/3862) --- apps/passwd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apps/passwd.c') diff --git a/apps/passwd.c b/apps/passwd.c index 7ce40e058c..eb5a622af7 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -65,7 +65,8 @@ typedef enum OPTION_choice { OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_IN, OPT_NOVERIFY, OPT_QUIET, OPT_TABLE, OPT_REVERSE, OPT_APR1, - OPT_1, OPT_5, OPT_6, OPT_CRYPT, OPT_AIXMD5, OPT_SALT, OPT_STDIN + OPT_1, OPT_5, OPT_6, OPT_CRYPT, OPT_AIXMD5, OPT_SALT, OPT_STDIN, + OPT_R_ENUM, } OPTION_CHOICE; const OPTIONS passwd_options[] = { @@ -90,6 +91,7 @@ const OPTIONS passwd_options[] = { # ifndef OPENSSL_NO_DES {"crypt", OPT_CRYPT, '-', "Standard Unix password algorithm (default)"}, # endif + OPT_R_OPTIONS, {NULL} }; @@ -182,6 +184,10 @@ int passwd_main(int argc, char **argv) in_stdin = 1; pw_source_defined = 1; break; + case OPT_R_CASES: + if (!opt_rand(o)) + goto end; + break; } } argc = opt_num_rest(); -- cgit v1.2.3