summaryrefslogtreecommitdiffstats
path: root/apps/passwd.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-03-21 18:08:57 +0100
committerRichard Levitte <levitte@openssl.org>2016-03-31 13:32:01 +0200
commit923b1857decf4440b13b82f2aa7cf1189327d1a3 (patch)
tree6b6a6387610cdad0b7a1bdbb0b23da12ac80bc94 /apps/passwd.c
parentMake the '-in' option in apps/passwd.c less mandatory (diff)
downloadopenssl-923b1857decf4440b13b82f2aa7cf1189327d1a3.tar.xz
openssl-923b1857decf4440b13b82f2aa7cf1189327d1a3.zip
Fix "no-ui" configuration
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'apps/passwd.c')
-rw-r--r--apps/passwd.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/apps/passwd.c b/apps/passwd.c
index 7ae9e88880..98092bb04b 100644
--- a/apps/passwd.c
+++ b/apps/passwd.c
@@ -118,7 +118,10 @@ int passwd_main(int argc, char **argv)
char *infile = NULL, *salt = NULL, *passwd = NULL, **passwds = NULL;
char *salt_malloc = NULL, *passwd_malloc = NULL, *prog;
OPTION_CHOICE o;
- int in_stdin = 0, in_noverify = 0, pw_source_defined = 0;
+ int in_stdin = 0, pw_source_defined = 0;
+#ifndef OPENSSL_NO_UI
+ int in_noverify = 0;
+#endif
int passed_salt = 0, quiet = 0, table = 0, reverse = 0;
int ret = 1, usecrypt = 0, use1 = 0, useapr1 = 0;
size_t passwd_malloc_size = 0, pw_maxlen = 256;
@@ -142,7 +145,9 @@ int passwd_main(int argc, char **argv)
pw_source_defined = 1;
break;
case OPT_NOVERIFY:
+#ifndef OPENSSL_NO_UI
in_noverify = 1;
+#endif
break;
case OPT_QUIET:
quiet = 1;
@@ -232,18 +237,26 @@ int passwd_main(int argc, char **argv)
}
if ((in == NULL) && (passwds == NULL)) {
- /* build a null-terminated list */
- static char *passwds_static[2] = { NULL, NULL };
-
- passwds = passwds_static;
- if (in == NULL)
- if (EVP_read_pw_string
- (passwd_malloc, passwd_malloc_size, "Password: ",
- !(passed_salt || in_noverify)) != 0)
- goto end;
- passwds[0] = passwd_malloc;
+ if (1) {
+#ifndef OPENSSL_NO_UI
+ /* build a null-terminated list */
+ static char *passwds_static[2] = { NULL, NULL };
+
+ passwds = passwds_static;
+ if (in == NULL)
+ if (EVP_read_pw_string
+ (passwd_malloc, passwd_malloc_size, "Password: ",
+ !(passed_salt || in_noverify)) != 0)
+ goto end;
+ passwds[0] = passwd_malloc;
+ } else {
+#endif
+ BIO_printf(bio_err, "password required\n");
+ goto end;
+ }
}
+
if (in == NULL) {
assert(passwds != NULL);
assert(*passwds != NULL);