]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: make sure "help", "prompt", "quit" are enabled at master level
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Mar 2021 16:03:33 +0000 (17:03 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Mar 2021 18:09:19 +0000 (19:09 +0100)
These 3 commands are functionally valid both in master and worker CLIs.
However, while they do have a valid handler, they are not permitted by
the code and work partially by chance in the master:
  - "prompt" and "quit" are intercepted by the request analyser
  - "help" triggers an error, which results in displaying the error
    message

Let's make sure they are permitted so that we don't count errors there and
that we can report appropriate help.

This bug has always been there but it doesn't have any functional effect
at the moment since "help" can only show the error message. As such, there
is no need to backport it.

src/cli.c

index 04c4e7a1962bdcdc70cd12bc62c607ec376ddae0..99cb9df8645df6fe3455dbc66bb72249e14dc1c3 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2795,9 +2795,9 @@ static struct applet mcli_applet = {
 
 /* register cli keywords */
 static struct cli_kw_list cli_kws = {{ },{
-       { { "help", NULL }, NULL, cli_parse_simple, NULL },
-       { { "prompt", NULL }, NULL, cli_parse_simple, NULL },
-       { { "quit", NULL }, NULL, cli_parse_simple, NULL },
+       { { "help", NULL }, NULL, cli_parse_simple, NULL, NULL, NULL, ACCESS_MASTER },
+       { { "prompt", NULL }, NULL, cli_parse_simple, NULL, NULL, NULL, ACCESS_MASTER },
+       { { "quit", NULL }, NULL, cli_parse_simple, NULL, NULL, NULL, ACCESS_MASTER },
        { { "set", "maxconn", "global",  NULL }, "set maxconn global : change the per-process maxconn setting", cli_parse_set_maxconn_global, NULL },
        { { "set", "rate-limit", NULL }, "set rate-limit : change a rate limiting value", cli_parse_set_ratelimit, NULL },
        { { "set", "severity-output",  NULL }, "set severity-output [none|number|string] : set presence of severity level in feedback information", cli_parse_set_severity_output, NULL, NULL },