Change pkcs12 so the certificates coming from -in do not get tossed if
authorRichard Levitte <levitte@openssl.org>
Wed, 12 Dec 2001 16:49:02 +0000 (16:49 +0000)
committerRichard Levitte <levitte@openssl.org>
Wed, 12 Dec 2001 16:49:02 +0000 (16:49 +0000)
-certfile is given as well.

apps/pkcs12.c

index cd9c02808ac292947d24f9b591501b2dced0e307..0e2bd6dbcd18e6ff63b34d8104da2cc807af4491 100644 (file)
@@ -459,10 +459,16 @@ int MAIN(int argc, char **argv)
 
        /* Add any more certificates asked for */
        if (certfile) {
-               if(!(certs = load_certs(bio_err, certfile, FORMAT_PEM, NULL, e,
-                       "certificates from certfile"))) {
+               STACK_OF(X509) *morecerts=NULL;
+               if(!(morecerts = load_certs(bio_err, certfile, FORMAT_PEM,
+                                           NULL, e,
+                                           "certificates from certfile"))) {
                        goto export_end;
                }
+               while(sk_X509_num(morecerts) > 0) {
+                       sk_X509_push(certs, sk_X509_shift(morecerts));
+               }
+               sk_X509_free(morecerts);
        }
 
 #ifdef CRYPTO_MDEBUG