mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
BUG/MEDIUM: mworker/cli: fix pipelined modes on master CLI
Since commit3d93ecc
("BUG/MAJOR: cli: Restore non-interactive mode behavior with pipelined commands") and commit598c7f16
("BUG/MEDIUM: cli: Warn if pipelined commands are delimited by a \n"), the pipelined command on the master CLI are either broken or emit warnings depending on which version. The reason is that mode applied on the master CLI are saved on the in the current CLI session, and then reinserted for each pipelined command, however, these commande were inserted as new lines. For example: "@1; expert-mode on; debug dev log foo; debug dev log bar" Would be sent as: "expert mode on\ndebug dev log foo" "expert mode on\ndebug dev log bar" This patch fixes the issue by using the new ci_insert() function which inserts a string instead of a newline, and the command are now suffixed by ';' upon insertion allowing a correct pipelined command chain. This must be backported with the previous commit introducing ci_insert() in every stable version. This is broken since the 3.0 version, but it emits a warning in every version below, because598c7f164
was backported.
This commit is contained in:
parent
b2a8e8731d
commit
b75edf2f11
32
src/cli.c
32
src/cli.c
@ -2918,36 +2918,36 @@ int pcli_parse_request(struct stream *s, struct channel *req, char **errmsg, int
|
||||
|
||||
/* the mcli-debug-mode is only sent to the applet of the master */
|
||||
if ((s->pcli_flags & ACCESS_MCLI_DEBUG) && *next_pid <= 0) {
|
||||
ci_insert_line2(req, 0, "mcli-debug-mode on -", strlen("mcli-debug-mode on -"));
|
||||
ret += strlen("mcli-debug-mode on -") + 2;
|
||||
ci_insert(req, 0, "mcli-debug-mode on -;", strlen("mcli-debug-mode on -;"));
|
||||
ret += strlen("mcli-debug-mode on -;");
|
||||
}
|
||||
if (s->pcli_flags & ACCESS_EXPERIMENTAL) {
|
||||
ci_insert_line2(req, 0, "experimental-mode on -", strlen("experimental-mode on -"));
|
||||
ret += strlen("experimental-mode on -") + 2;
|
||||
ci_insert(req, 0, "experimental-mode on -;", strlen("experimental-mode on -;"));
|
||||
ret += strlen("experimental-mode on -;");
|
||||
}
|
||||
if (s->pcli_flags & ACCESS_EXPERT) {
|
||||
ci_insert_line2(req, 0, "expert-mode on -", strlen("expert-mode on -"));
|
||||
ret += strlen("expert-mode on -") + 2;
|
||||
ci_insert(req, 0, "expert-mode on -;", strlen("expert-mode on -;"));
|
||||
ret += strlen("expert-mode on -;");
|
||||
}
|
||||
if (s->pcli_flags & ACCESS_MCLI_SEVERITY_STR) {
|
||||
const char *cmd = "set severity-output string -";
|
||||
ci_insert_line2(req, 0, cmd, strlen(cmd));
|
||||
ret += strlen(cmd) + 2;
|
||||
const char *cmd = "set severity-output string -;";
|
||||
ci_insert(req, 0, cmd, strlen(cmd));
|
||||
ret += strlen(cmd);
|
||||
}
|
||||
if (s->pcli_flags & ACCESS_MCLI_SEVERITY_NB) {
|
||||
const char *cmd = "set severity-output number -";
|
||||
ci_insert_line2(req, 0, cmd, strlen(cmd));
|
||||
ret += strlen(cmd) + 2;
|
||||
const char *cmd = "set severity-output number -;";
|
||||
ci_insert(req, 0, cmd, strlen(cmd));
|
||||
ret += strlen(cmd);
|
||||
}
|
||||
|
||||
if (pcli_has_level(s, ACCESS_LVL_ADMIN)) {
|
||||
goto end;
|
||||
} else if (pcli_has_level(s, ACCESS_LVL_OPER)) {
|
||||
ci_insert_line2(req, 0, "operator -", strlen("operator -"));
|
||||
ret += strlen("operator -") + 2;
|
||||
ci_insert(req, 0, "operator -;", strlen("operator -;"));
|
||||
ret += strlen("operator -;");
|
||||
} else if (pcli_has_level(s, ACCESS_LVL_USER)) {
|
||||
ci_insert_line2(req, 0, "user -", strlen("user -"));
|
||||
ret += strlen("user -") + 2;
|
||||
ci_insert(req, 0, "user -;", strlen("user -;"));
|
||||
ret += strlen("user -;");
|
||||
}
|
||||
}
|
||||
end:
|
||||
|
Loading…
Reference in New Issue
Block a user