]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
fixed multiline output bug in crl command, ensuring use of global variable to set...
authoraaSchwager <aaronschwager@comcast.net>
Sat, 22 Mar 2025 22:13:22 +0000 (15:13 -0700)
committerMatt Caswell <matt@openssl.org>
Mon, 14 Apr 2025 14:10:20 +0000 (15:10 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
(Merged from https://github.com/openssl/openssl/pull/27124)

crypto/x509/t_crl.c
test/certs/cyrillic_crl.utf8

index e77a77978a831668f3034c31b53ca5f2d12abb3e..3b58152c5e6919d2033874ce16186948857ecfe6 100644 (file)
@@ -45,22 +45,28 @@ int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag)
     const ASN1_BIT_STRING *sig;
     long l;
     int i;
+    char mlch = ' ';
+    int nmindent = 0;
+
+    if ((nmflag & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
+        mlch = '\n';
+        nmindent = 8;
+    }
 
     BIO_printf(out, "Certificate Revocation List (CRL):\n");
     l = X509_CRL_get_version(x);
     if (l >= X509_CRL_VERSION_1 && l <= X509_CRL_VERSION_2)
-        BIO_printf(out, "%8sVersion %ld (0x%lx)\n", "", l + 1, (unsigned long)l);
+        BIO_printf(out, "%4sVersion %ld (0x%lx)\n", "", l + 1, (unsigned long)l);
     else
-        BIO_printf(out, "%8sVersion unknown (%ld)\n", "", l);
+        BIO_printf(out, "%4sVersion unknown (%ld)\n", "", l);
     X509_CRL_get0_signature(x, &sig, &sig_alg);
-    BIO_puts(out, "    ");
     X509_signature_print(out, sig_alg, NULL);
-    BIO_printf(out, "%8sIssuer: ", "");
-    X509_NAME_print_ex(out, X509_CRL_get_issuer(x), 0, nmflag);
+    BIO_printf(out, "%4sIssuer:%c", "", mlch);
+    X509_NAME_print_ex(out, X509_CRL_get_issuer(x), nmindent, nmflag);
     BIO_puts(out, "\n");
-    BIO_printf(out, "%8sLast Update: ", "");
+    BIO_printf(out, "%4sLast Update: ", "");
     ASN1_TIME_print(out, X509_CRL_get0_lastUpdate(x));
-    BIO_printf(out, "\n%8sNext Update: ", "");
+    BIO_printf(out, "\n%4sNext Update: ", "");
     if (X509_CRL_get0_nextUpdate(x))
         ASN1_TIME_print(out, X509_CRL_get0_nextUpdate(x));
     else
@@ -68,7 +74,7 @@ int X509_CRL_print_ex(BIO *out, X509_CRL *x, unsigned long nmflag)
     BIO_printf(out, "\n");
 
     X509V3_extensions_print(out, "CRL extensions",
-                            X509_CRL_get0_extensions(x), 0, 8);
+                            X509_CRL_get0_extensions(x), 0, 4);
 
     rev = X509_CRL_get_REVOKED(x);
 
index c36a3fd0f07a45ab4a77a7be9e446a773fcc2a7f..6f483770e3f0eb5e697849cfc35918ddd9b1705e 100644 (file)
@@ -1,12 +1,12 @@
 Certificate Revocation List (CRL):
-        Version 2 (0x1)
-        Signature Algorithm: sha256WithRSAEncryption
-        Issuer: C=RU, ST=Москва, O=Я, OU=Я, CN=Дмитрий Белявский, emailAddress=beldmit@example.com
-        Last Update: Apr 24 13:25:31 2017 GMT
-        Next Update: May 24 13:25:31 2017 GMT
-        CRL extensions:
-            X509v3 CRL Number: 
-                1
+    Version 2 (0x1)
+    Signature Algorithm: sha256WithRSAEncryption
+    Issuer: C=RU, ST=Москва, O=Я, OU=Я, CN=Дмитрий Белявский, emailAddress=beldmit@example.com
+    Last Update: Apr 24 13:25:31 2017 GMT
+    Next Update: May 24 13:25:31 2017 GMT
+    CRL extensions:
+        X509v3 CRL Number: 
+            1
 No Revoked Certificates.
     Signature Algorithm: sha256WithRSAEncryption
     Signature Value: