CLEANUP: ssl/cli: do not loop on unknown states in "add ssl crt-list" handler

The io_handler in "add ssl crt_list" is built around a "while" loop that
only makes forward progress and that doesn't handle its final state as
it's not supposed to be called again once reached. This makes the code
confusing because its construct implies an infinite loop for such a
state (or any other unhandled one). Let's just remove that unneeded loop.
This commit is contained in:
Willy Tarreau 2022-05-05 13:50:46 +02:00
parent 4fd9b4ddf0
commit 1b948ef426

View File

@ -1061,7 +1061,6 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
if (unlikely(cs_ic(cs)->flags & (CF_WRITE_ERROR|CF_SHUTW)))
goto error;
while (1) {
switch (appctx->st2) {
case SETCERT_ST_INIT:
/* This state just print the update message */
@ -1118,11 +1117,8 @@ static int cli_io_handler_add_crtlist(struct appctx *appctx)
}
entry->linenum = ++crtlist->linecount;
appctx->st2 = SETCERT_ST_FIN;
goto end;
}
}
end:
chunk_appendf(trash, "\n");
if (errcode & ERR_WARN)
chunk_appendf(trash, "%s", err);