Skip to content

Commit

Permalink
fixup! apps: ca,req,x509: Add explicit start and end dates options
Browse files Browse the repository at this point in the history
apps: Fix formatting
Signed-off-by: Stephan Wurm <atomisirsi@gsklan.de>
  • Loading branch information
Atomisirsi committed Apr 4, 2024
1 parent ba18108 commit 7be6702
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions apps/ca.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,10 +889,9 @@ int ca_main(int argc, char **argv)
BIO_printf(bio_err, "cannot lookup how many days to certify for\n");
goto end;
}
if (days != 0 && enddate != NULL) {
if (days != 0 && enddate != NULL)
BIO_printf(bio_err,
"Warning: -enddate or -not_after option overriding -days option\n");
}
"Warning: -enddate or -not_after option overriding -days option\n");

if (rand_ser) {
if ((serial = BN_new()) == NULL || !rand_serial(serial, NULL)) {
Expand Down
6 changes: 3 additions & 3 deletions apps/lib/apps.c
Original file line number Diff line number Diff line change
Expand Up @@ -3281,8 +3281,8 @@ int check_cert_time_string(const char *time, const char *desc)
|| ASN1_TIME_set_string_X509(NULL, time))
return 1;
BIO_printf(bio_err,
"%s is invalid, it should be \"today\" or have format [CC]YYMMDDHHMMSSZ\n",
desc);
"%s is invalid, it should be \"today\" or have format [CC]YYMMDDHHMMSSZ\n",
desc);
return 0;
}

Expand Down Expand Up @@ -3319,7 +3319,7 @@ int set_cert_times(X509 *x, const char *startdate, const char *enddate,
}
if (ASN1_TIME_compare(X509_get0_notAfter(x), X509_get0_notBefore(x)) < 0) {
BIO_printf(bio_err, "%s: end date before start date\n",
strict_compare_times ? "Error" : "Warning");
strict_compare_times ? "Error" : "Warning");
if (strict_compare_times)
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/req.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,9 @@ int req_main(int argc, char **argv)

if (!X509_set_issuer_name(new_x509, issuer))
goto end;
if (days == UNSET_DAYS) {
if (days == UNSET_DAYS)
days = DEFAULT_DAYS;
} else if (not_after != NULL)
else if (not_after != NULL)
BIO_printf(bio_err,"Warning: -not_after option overriding -days option\n");
if (!set_cert_times(new_x509, not_before, not_after, days, 1))
goto end;
Expand Down
4 changes: 2 additions & 2 deletions apps/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,9 @@ int x509_main(int argc, char **argv)
BIO_printf(bio_err, "Cannot use -preserve_dates with -days option\n");
goto err;
}
if (days == UNSET_DAYS) {
if (days == UNSET_DAYS)
days = DEFAULT_DAYS;
} else if (not_after != NULL)
else if (not_after != NULL)
BIO_printf(bio_err, "Warning: -not_after option overriding -days option\n");

if (!app_passwd(passinarg, NULL, &passin, NULL)) {
Expand Down

0 comments on commit 7be6702

Please sign in to comment.