hey there.  i noticed the patch request, so here it is.  as there is no
BIO_unlink/remove etc function, i've used the ansi c function remove,
which should be portable.  a bit heavy-handed of an approach, but then
again, so is apps/ca.c :).

note that if a cert is not committed, it is still saved.  i believe this to
be correct behavior.  if the cert is not signed, however, or on other
errors it is removed.

--- apps/ca.c   Sun May 19 12:31:10 2002
+++ ../src/cvs/openssl/apps/ca.c        Wed Jul 17 14:36:46 2002
@@ -291,6 +291,7 @@
        EVP_PKEY *pkey=NULL;
        int output_der = 0;
        char *outfile=NULL;
+       int created_outfile = 0;
        char *outdir=NULL;
        char *serialfile=NULL;
        char *extensions=NULL;
@@ -1029,6 +1030,7 @@
                                perror(outfile);
                                goto err;
                                }
+                       created_outfile = 1;
                        }
                else
                        {
@@ -1607,6 +1609,14 @@
        BIO_free_all(Sout);
        BIO_free_all(out);
        BIO_free_all(in);
+
+       if (created_outfile && ret)
+               {
+               if (remove(outfile) < 0)
+                       {
+                       BIO_printf(bio_err,"couldn't cleanup %s\n", outfile);
+                       }
+               }

        sk_X509_pop_free(cert_sk,X509_free);

-- 
nicholas black <[EMAIL PROTECTED]>
"its [sic] festering quietly in the glibc source tree where all large and
dubiously justifiable hacks seem to end up" - alan cox
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to