Add generationQualifier OID (proposed by Fiel Cabral).
[openssl.git] / apps / crl.c
index b1c3325f21ec8e2d322d01c656765e8140bcb653..f25b1877b59ed9caf3ce62808d4d6748bbd01bc1 100644 (file)
@@ -120,9 +120,20 @@ int MAIN(int argc, char **argv)
                if ((bio_err=BIO_new(BIO_s_file())) != NULL)
                        BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
 
+       if (!load_config(bio_err, NULL))
+               goto end;
+
        if (bio_out == NULL)
                if ((bio_out=BIO_new(BIO_s_file())) != NULL)
+                       {
                        BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+                       {
+                       BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+                       bio_out = BIO_push(tmpbio, bio_out);
+                       }
+#endif
+                       }
 
        informat=FORMAT_PEM;
        outformat=FORMAT_PEM;
@@ -206,7 +217,7 @@ int MAIN(int argc, char **argv)
                {
 bad:
                for (pp=crl_usage; (*pp != NULL); pp++)
-                       BIO_printf(bio_err,*pp);
+                       BIO_printf(bio_err,"%s",*pp);
                goto end;
                }
 
@@ -227,7 +238,11 @@ bad:
                        X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
                ERR_clear_error();
 
-               X509_STORE_CTX_init(&ctx, store, NULL, NULL);
+               if(!X509_STORE_CTX_init(&ctx, store, NULL, NULL)) {
+                       BIO_printf(bio_err,
+                               "Error initialising X509 store\n");
+                       goto end;
+               }
 
                i = X509_STORE_get_by_subject(&ctx, X509_LU_X509, 
                                        X509_CRL_get_issuer(x), &xobj);
@@ -314,7 +329,15 @@ bad:
                }
 
        if (outfile == NULL)
+               {
                BIO_set_fp(out,stdout,BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+               {
+               BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+               out = BIO_push(tmpbio, out);
+               }
+#endif
+               }
        else
                {
                if (BIO_write_filename(out,outfile) <= 0)
@@ -340,14 +363,15 @@ bad:
        if (!i) { BIO_printf(bio_err,"unable to write CRL\n"); goto end; }
        ret=0;
 end:
-       BIO_free(out);
-       BIO_free(bio_out);
+       BIO_free_all(out);
+       BIO_free_all(bio_out);
        bio_out=NULL;
        X509_CRL_free(x);
        if(store) {
                X509_STORE_CTX_cleanup(&ctx);
                X509_STORE_free(store);
        }
+       apps_shutdown();
        EXIT(ret);
        }