Fix build failure on Windows due to undefined cflags identifier
[oweals/openssl.git] / apps / ca.c
index 0cb498b9d967fd348ec83b7442e337ae2cbb07e0..1778f953d9ee55bd69c75f4ceeccfa18fb853482 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
 static const char *ca_usage[]={
 "usage: ca args\n",
 "\n",
-" -verbose        - Talk alot while doing things\n",
+" -verbose        - Talk a lot while doing things\n",
 " -config file    - A config file\n",
 " -name arg       - The particular CA definition to use\n",
 " -gencrl         - Generate a new CRL\n",
@@ -179,7 +179,7 @@ static const char *ca_usage[]={
 " -utf8           - input characters are UTF8 (default ASCII)\n",
 " -multivalue-rdn - enable support for multivalued RDNs\n",
 " -extensions ..  - Extension section (override value in config file)\n",
-" -extfile file   - Configuration file with X509v3 extentions to add\n",
+" -extfile file   - Configuration file with X509v3 extensions to add\n",
 " -crlexts ..     - CRL extension section (override value in config file)\n",
 #ifndef OPENSSL_NO_ENGINE
 " -engine e       - use engine e, possibly a hardware device.\n",
@@ -655,7 +655,7 @@ bad:
                        oid_bio=BIO_new_file(p,"r");
                        if (oid_bio == NULL) 
                                {
-                               /*
+                               /*-
                                BIO_printf(bio_err,"problems opening %s for extra oid's\n",p);
                                ERR_print_errors(bio_err);
                                */
@@ -709,7 +709,7 @@ bad:
                ERR_clear_error();
 #ifdef RL_DEBUG
        if (!p)
-               BIO_printf(bio_err, "DEBUG: unique_subject undefined\n", p);
+               BIO_printf(bio_err, "DEBUG: unique_subject undefined\n");
 #endif
 #ifdef RL_DEBUG
        BIO_printf(bio_err, "DEBUG: configured unique_subject is %d\n",
@@ -994,7 +994,7 @@ bad:
                }
 
        /*****************************************************************/
-       /* Read extentions config file                                   */
+       /* Read extensions config file                                   */
        if (extfile)
                {
                extconf = NCONF_new(NULL);
@@ -1628,12 +1628,14 @@ static int certify(X509 **xret, char *infile, EVP_PKEY *pkey, X509 *x509,
                {
                ok=0;
                BIO_printf(bio_err,"Signature verification problems....\n");
+               ERR_print_errors(bio_err);
                goto err;
                }
        if (i == 0)
                {
                ok=0;
                BIO_printf(bio_err,"Signature did not match the certificate request\n");
+               ERR_print_errors(bio_err);
                goto err;
                }
        else
@@ -2052,7 +2054,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;
 
@@ -2794,6 +2802,9 @@ char *make_revocation_str(int rev_type, char *rev_arg)
 
        revtm = X509_gmtime_adj(NULL, 0);
 
+       if (!revtm)
+               return NULL;
+
        i = revtm->length + 1;
 
        if (reason) i += strlen(reason) + 1;
@@ -2818,7 +2829,8 @@ char *make_revocation_str(int rev_type, char *rev_arg)
        return str;
        }
 
-/* Convert revocation field to X509_REVOKED entry 
+/*-
+ * Convert revocation field to X509_REVOKED entry 
  * return code:
  * 0 error
  * 1 OK