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.
This commit is contained in:
Aurelien DARRAGON 2023-09-20 10:54:06 +02:00 committed by Christopher Faulet
parent 0b09727a22
commit 403fdee6a4

View 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");