fix printout of expiry days if -enddate is used in ca
authorDr. Stephen Henson <steve@openssl.org>
Tue, 20 Nov 2012 15:22:15 +0000 (15:22 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Tue, 20 Nov 2012 15:22:15 +0000 (15:22 +0000)
apps/ca.c

index 0cb498b9d967fd348ec83b7442e337ae2cbb07e0..5d488e2fac1478ff934807a18d95c48402140a67 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -2052,7 +2052,13 @@ again2:
 
        if (enddate == NULL)
                X509_time_adj_ex(X509_get_notAfter(ret),days, 0, NULL);
-       else ASN1_TIME_set_string(X509_get_notAfter(ret),enddate);
+       else
+               {
+               int tdays;
+               ASN1_TIME_set_string(X509_get_notAfter(ret),enddate);
+               ASN1_TIME_diff(&tdays, NULL, NULL, X509_get_notAfter(ret));
+               days = tdays;
+               }
 
        if (!X509_set_subject_name(ret,subject)) goto err;