]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proxy: dynamic-cookie CLIs require TCP or HTTP mode
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 20 Sep 2023 08:54:06 +0000 (10:54 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 6 Oct 2023 13:34:30 +0000 (15:34 +0200)
Prevent the use of "dynamic-cookie" related CLI commands if the backend
is not in TCP or HTTP mode.

src/proxy.c

index 714e70b5ae78998ba35fae6aa9bf8d32f89be7e2..f8bb876a08f13781dfdaf07d30ed1972bb0e54d4 100644 (file)
@@ -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");