]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl_ckch: Dump cert transaction only once if show command yield
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 3 Jun 2022 08:46:40 +0000 (10:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 3 Jun 2022 09:20:41 +0000 (11:20 +0200)
When loaded SSL certificates are displayed via "show ssl cert" command, the
in-progess transaction, if any, is also displayed. However, if the command
yield, the transaction is re-displayed again and again.

To fix the issue, old_ckchs field is used to remember the transaction was
already displayed.

This patch must be backported as far as 2.2.

src/ssl_ckch.c

index 88f8ad01ad7b4b34dc18b9712e5f7f03a4f4ab7f..5a75f7997f2263988340149441b17bb264e369de 100644 (file)
@@ -1327,12 +1327,13 @@ static int cli_io_handler_show_cert(struct appctx *appctx)
        if (trash == NULL)
                return 1;
 
-       if (!ctx->old_ckchs) {
-               if (ckchs_transaction.old_ckchs) {
-                       ckchs = ckchs_transaction.old_ckchs;
-                       chunk_appendf(trash, "# transaction\n");
-                       chunk_appendf(trash, "*%s\n", ckchs->path);
-               }
+       if (!ctx->old_ckchs && ckchs_transaction.old_ckchs) {
+               ckchs = ckchs_transaction.old_ckchs;
+               chunk_appendf(trash, "# transaction\n");
+               chunk_appendf(trash, "*%s\n", ckchs->path);
+               if (applet_putchk(appctx, trash) == -1)
+                       goto yield;
+               ctx->old_ckchs = ckchs_transaction.old_ckchs;
        }
 
        if (!ctx->cur_ckchs) {