From: Yves Lafon Date: Mon, 8 Jun 2020 14:08:06 +0000 (+0200) Subject: BUG/MINOR: cli: allow space escaping on the CLI X-Git-Tag: v2.1.8~69 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=94612ca539faeefb26307fd219cc765dc61d09ae;p=haproxy-2.1.git BUG/MINOR: cli: allow space escaping on the CLI It was not possible to escape spaces over the CLI, making impossible the insertion of new ACL entries with spaces from the CLI. This patch fixes the escaping of spaces over the CLI. It is now possible to launch "add acl agents.acl My\ User\ Agent" over the CLI. Could be backported in all stable branches. Should fix issue #400. (cherry picked from commit b08c6d06e712b148bf396dcf13f7da590a6104c9) Signed-off-by: Christopher Faulet --- diff --git a/src/cli.c b/src/cli.c index 3e653de..7b232a2 100644 --- a/src/cli.c +++ b/src/cli.c @@ -534,7 +534,18 @@ static int cli_parse_request(struct appctx *appctx) break; args[i] = p; - p += strcspn(p, " \t"); + while (1) { + p += strcspn(p, " \t\\"); + /* escaped chars using backlashes (\) */ + if (*p == '\\') { + if (!*++p) + break; + if (!*++p) + break; + } else { + break; + } + } *p++ = 0; /* unescape backslashes (\) */