diff options
author | Bodo Möller <bodo@openssl.org> | 2000-11-17 09:03:02 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2000-11-17 09:03:02 +0000 |
commit | db70a3fd6eeb757b39aa565ed6e1cb569a831d2f (patch) | |
tree | 63ed73285d325029dcaaf233d3ad81ca857617ce /apps/passwd.c | |
parent | 28fd5c60deda00db51a3ada467aee6c565f416a2 (diff) | |
download | openssl-db70a3fd6eeb757b39aa565ed6e1cb569a831d2f.tar.gz |
Improve usability of 'openssl passwd' by including
password verification where it makes sense.
Diffstat (limited to 'apps/passwd.c')
-rw-r--r-- | apps/passwd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/passwd.c b/apps/passwd.c index 6851a9927d..c92ff40beb 100644 --- a/apps/passwd.c +++ b/apps/passwd.c @@ -50,6 +50,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, * -salt string - salt * -in file - read passwords from file * -stdin - read passwords from stdin + * -noverify - never verify when reading password from terminal * -quiet - no warnings * -table - format output as table * -reverse - switch table columns @@ -62,6 +63,7 @@ int MAIN(int argc, char **argv) int ret = 1; char *infile = NULL; int in_stdin = 0; + int in_noverify = 0; char *salt = NULL, *passwd = NULL, **passwds = NULL; char *salt_malloc = NULL, *passwd_malloc = NULL; size_t passwd_malloc_size = 0; @@ -128,6 +130,8 @@ int MAIN(int argc, char **argv) else badopt = 1; } + else if (strcmp(argv[i], "-noverify") == 0) + in_noverify = 1; else if (strcmp(argv[i], "-quiet") == 0) quiet = 1; else if (strcmp(argv[i], "-table") == 0) @@ -174,6 +178,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "-salt string use provided salt\n"); BIO_printf(bio_err, "-in file read passwords from file\n"); BIO_printf(bio_err, "-stdin read passwords from stdin\n"); + BIO_printf(bio_err, "-noverify never verify when reading password from terminal\n"); BIO_printf(bio_err, "-quiet no warnings\n"); BIO_printf(bio_err, "-table format output as table\n"); BIO_printf(bio_err, "-reverse switch table columns\n"); @@ -222,7 +227,7 @@ int MAIN(int argc, char **argv) passwds = passwds_static; if (in == NULL) - if (EVP_read_pw_string(passwd_malloc, passwd_malloc_size, "Password: ", 0) != 0) + if (EVP_read_pw_string(passwd_malloc, passwd_malloc_size, "Password: ", !(passed_salt || in_noverify)) != 0) goto err; passwds[0] = passwd_malloc; } |