]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl: Remove empty lines from "show ssl ocsp-response" output
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Fri, 17 Dec 2021 17:53:23 +0000 (18:53 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Mon, 20 Dec 2021 11:02:17 +0000 (12:02 +0100)
There were empty lines in the output of the CLI's "show ssl
ocsp-response" command (after the certificate ID and between two
certificates). This patch removes them since an empty line should mark
the end of the output.

Must be backported in 2.5.

doc/management.txt
src/ssl_sock.c

index a836bd8c390f0a09019708fc5dbb2e5fbf04da99..a5ecfa005af47016291d470642329a0814d66ba8 100644 (file)
@@ -3197,7 +3197,6 @@ show ssl ocsp-response [<id>]
     # Certificate IDs
       Certificate ID key : 303b300906052b0e03021a050004148a83e0060faff709ca7e9b95522a2e81635fda0a0414f652b0e435d5ea923851508f0adbe92d85de007a0202100a
         Certificate ID:
-
           Issuer Name Hash: 8A83E0060FAFF709CA7E9B95522A2E81635FDA0A
           Issuer Key Hash: F652B0E435D5EA923851508F0ADBE92D85DE007A
           Serial Number: 100A
index 2f030bab14379a13f25f5f4250fa2a82c2fe0343..57cb7c7f320e1079e402bed4963c4e88e76d2bc9 100644 (file)
@@ -7210,13 +7210,12 @@ static inline int ocsp_certid_print(BIO *bp, OCSP_CERTID *certid, int indent)
 
                BIO_printf(bp, "%*sCertificate ID:\n", indent, "");
                indent += 2;
-               BIO_printf(bp, "\n%*sIssuer Name Hash: ", indent, "");
+               BIO_printf(bp, "%*sIssuer Name Hash: ", indent, "");
                i2a_ASN1_STRING(bp, piNameHash, 0);
                BIO_printf(bp, "\n%*sIssuer Key Hash: ", indent, "");
                i2a_ASN1_STRING(bp, piKeyHash, 0);
                BIO_printf(bp, "\n%*sSerial Number: ", indent, "");
                i2a_ASN1_INTEGER(bp, pSerial);
-               BIO_printf(bp, "\n");
        }
        return 1;
 }
@@ -7276,6 +7275,9 @@ static int cli_io_handler_show_ocspresponse(struct appctx *appctx)
                /* Dump the CERTID info */
                ocsp_certid_print(bio, certid, 1);
                write = BIO_read(bio, tmp->area, tmp->size-1);
+               /* strip trailing LFs */
+               while (write > 0 && tmp->area[write-1] == '\n')
+                       write--;
                tmp->area[write] = '\0';
 
                chunk_appendf(trash, "%s\n", tmp->area);