apps/x509: Fix -CAfile option being neglected with -new or -in
[openssl.git] / apps / x509.c
index 28558736041b95d9dd0b9f07bbfd94e89ccf0a8b..182730be9624f085797b416d3628ec6451fd4678 100644 (file)
@@ -730,7 +730,7 @@ int x509_main(int argc, char **argv)
         }
         if ((x = X509_new_ex(app_get0_libctx(), app_get0_propq())) == NULL)
             goto end;
-        if (sno == NULL) {
+        if (CAfile == NULL && sno == NULL) {
             sno = ASN1_INTEGER_new();
             if (sno == NULL || !rand_serial(NULL, sno))
                 goto end;