From 3e94f5d4b6ee7f19ead9925df080e31b60910ef5 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Fri, 3 Jun 2022 10:46:40 +0200 Subject: [PATCH] BUG/MINOR: ssl_ckch: Dump cert transaction only once if show command yield 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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ssl_ckch.c b/src/ssl_ckch.c index 88f8ad01ad..5a75f7997f 100644 --- a/src/ssl_ckch.c +++ b/src/ssl_ckch.c @@ -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) { -- 2.39.5