]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cli: Set SE_FL_EOI flag for '_getsocks' and 'quit' commands
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 7 Apr 2023 15:58:21 +0000 (17:58 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 11 Apr 2023 05:43:26 +0000 (07:43 +0200)
An applet must never set SE_FL_EOS flag without SE_FL_EOI or SE_FL_ERROR
flags. Here, SE_FL_EOI flag was missing for "quit" or "_getsocks"
commands. Indeed, these commands are terminal.

This bug triggers a BUG_ON() recently added.

This patch is related to the issue #2107. It is 2.8-specific. No backport
needed.

src/cli.c

index 1b4276ff921ca760ab60f54c62c061a9ccd7be9f..0849cbe9a9d192c1a63945f887314d1840d62c38 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2172,6 +2172,7 @@ out:
                ha_warning("Cannot make the unix socket non-blocking\n");
                goto out;
        }
+       se_fl_set(appctx->sedesc, SE_FL_EOI);
        appctx->st0 = CLI_ST_END;
        free(cmsgbuf);
        free(tmpbuf);
@@ -2186,9 +2187,11 @@ static int cli_parse_simple(char **args, char *payload, struct appctx *appctx, v
        else if (*args[0] == 'p')
                /* prompt */
                appctx->st1 ^= APPCTX_CLI_ST1_PROMPT;
-       else if (*args[0] == 'q')
+       else if (*args[0] == 'q') {
                /* quit */
+               se_fl_set(appctx->sedesc, SE_FL_EOI);
                appctx->st0 = CLI_ST_END;
+       }
 
        return 1;
 }