summaryrefslogtreecommitdiffstats
path: root/apps/req.c
diff options
context:
space:
mode:
authorPaul Yang <yang.yang@baishancloud.com>2017-11-21 22:37:23 +0800
committerRichard Levitte <levitte@openssl.org>2017-12-08 12:48:18 +0100
commitb1c05a504964a01ca54bd37e11c1ebac0f6fafdc (patch)
tree8ec7763c077b514ff14cc506a706fffdb53cf550 /apps/req.c
parentd68a0eaf45f12392065f3cf716a1a2682d55d3ce (diff)
Fix some issues in apps/req
1. the 'ignore -days' warning should not be printed without '-x509' 2. the 'ignore -days' warning should terminate with new-line Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4767)
Diffstat (limited to 'apps/req.c')
-rw-r--r--apps/req.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/req.c b/apps/req.c
index 8dcfbced23..989a6ad7cd 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -159,7 +159,7 @@ int req_main(int argc, char **argv)
char *template = default_config_file, *keyout = NULL;
const char *keyalg = NULL;
OPTION_CHOICE o;
- int ret = 1, x509 = 0, days = 30, i = 0, newreq = 0, verbose = 0;
+ int ret = 1, x509 = 0, days = 0, i = 0, newreq = 0, verbose = 0;
int pkey_type = -1, private = 0;
int informat = FORMAT_PEM, outformat = FORMAT_PEM, keyform = FORMAT_PEM;
int modulus = 0, multirdn = 0, verify = 0, noout = 0, text = 0;
@@ -334,7 +334,7 @@ int req_main(int argc, char **argv)
goto opthelp;
if (days && !x509)
- BIO_printf(bio_err, "Ignoring -days; not generating a certificate");
+ BIO_printf(bio_err, "Ignoring -days; not generating a certificate\n");
if (x509 && infile == NULL)
newreq = 1;
@@ -617,6 +617,10 @@ int req_main(int argc, char **argv)
if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req)))
goto end;
+ if (days == 0) {
+ /* set default days if it's not specified */
+ days = 30;
+ }
if (!set_cert_times(x509ss, NULL, NULL, days))
goto end;
if (!X509_set_subject_name