From: Aurelien DARRAGON Date: Wed, 20 Sep 2023 08:54:06 +0000 (+0200) Subject: MINOR: proxy: dynamic-cookie CLIs require TCP or HTTP mode X-Git-Tag: v2.9-dev7~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=403fdee6a4494f0618af31ced7dcb349aa1e0e27;p=thirdparty%2Fhaproxy.git MINOR: proxy: dynamic-cookie CLIs require TCP or HTTP mode Prevent the use of "dynamic-cookie" related CLI commands if the backend is not in TCP or HTTP mode. --- diff --git a/src/proxy.c b/src/proxy.c index 714e70b5ae..f8bb876a08 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -2936,6 +2936,9 @@ static int cli_parse_enable_dyncookie_backend(char **args, char *payload, struct if (!px) return 1; + if (px->mode != PR_MODE_TCP && px->mode != PR_MODE_HTTP) + return cli_err(appctx, "Not available.\n"); + /* Note: this lock is to make sure this doesn't change while another * thread is in srv_set_dyncookie(). */ @@ -2968,6 +2971,9 @@ static int cli_parse_disable_dyncookie_backend(char **args, char *payload, struc if (!px) return 1; + if (px->mode != PR_MODE_TCP && px->mode != PR_MODE_HTTP) + return cli_err(appctx, "Not available.\n"); + /* Note: this lock is to make sure this doesn't change while another * thread is in srv_set_dyncookie(). */ @@ -3002,6 +3008,9 @@ static int cli_parse_set_dyncookie_key_backend(char **args, char *payload, struc if (!px) return 1; + if (px->mode != PR_MODE_TCP && px->mode != PR_MODE_HTTP) + return cli_err(appctx, "Not available.\n"); + if (!*args[4]) return cli_err(appctx, "String value expected.\n");