Fix x509.c so it creates serial number file again if no
authorDr. Stephen Henson <steve@openssl.org>
Sat, 13 Nov 2004 13:26:06 +0000 (13:26 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 13 Nov 2004 13:26:06 +0000 (13:26 +0000)
serial number is supplied on command line.

apps/x509.c

index d00511c78a7b1f2e04de96747eff37293abe51db..b2288b69c2fd09426a63d830b1d01bec02be4203 100644 (file)
@@ -606,9 +606,12 @@ bad:
                        sno = ASN1_INTEGER_new();
                        if (!sno || !rand_serial(NULL, sno))
                                goto end;
+                       if (!X509_set_serialNumber(x, sno)) 
+                               goto end;
+                       ASN1_INTEGER_free(sno);
+                       sno = NULL;
                        }
-
-               if (!X509_set_serialNumber(x, sno)) 
+               else if (!X509_set_serialNumber(x, sno)) 
                        goto end;
 
                if (!X509_set_issuer_name(x,req->req_info->subject)) goto end;