BUG/MINOR: cli: fix CLI handler "set anon global-key" call

Anonymization mode has two CLI handlers "set anon <on|off>" and "set
anon global-key". The last one only requires admin level. However, as
cli_find_kw() is implemented, only the first handler will be retrieved
as they both start with the same prefix "set anon".

This has the effect to execute the wrong handler for "set anon
global-key" with an error message about an invalid keyword. To fix this,
handlers definition have been separated for both "set anon on" and "set
anon off" commands. This allows to have minimal changes while keeping
the same "set anon" prefix for each commands.

Also take this opportunity to fix a reference to a non-existing "set
global-key" CLI handler in the documentation.

This must be backported up to 2.7.
This commit is contained in:
Amaury Denoyelle 2023-03-03 17:11:10 +01:00
parent c8a0efbda8
commit dd3a33f863
2 changed files with 4 additions and 3 deletions

View File

@ -3433,8 +3433,8 @@ anonkey <key>
This sets the global anonymizing key to <key>, which must be a 32-bit number
between 0 and 4294967295. This is the key that will be used by default by CLI
commands when anonymized mode is enabled. This key may also be set at runtime
from the CLI command "set global-key". See also command line argument "-dC"
in the management manual.
from the CLI command "set anon global-key". See also command line argument
"-dC" in the management manual.
quick-exit
This speeds up the old process exit upon reload by skipping the releasing of

View File

@ -3143,7 +3143,8 @@ static struct cli_kw_list cli_kws = {{ },{
{ { "expert-mode", NULL }, NULL, cli_parse_expert_experimental_mode, NULL, NULL, NULL, ACCESS_MASTER }, // not listed
{ { "experimental-mode", NULL }, NULL, cli_parse_expert_experimental_mode, NULL, NULL, NULL, ACCESS_MASTER }, // not listed
{ { "mcli-debug-mode", NULL }, NULL, cli_parse_expert_experimental_mode, NULL, NULL, NULL, ACCESS_MASTER_ONLY }, // not listed
{ { "set", "anon", NULL }, "set anon <setting> [value] : change the anonymized mode setting", cli_parse_set_anon, NULL, NULL },
{ { "set", "anon", "on" }, "set anon on [value] : activate the anonymized mode", cli_parse_set_anon, NULL, NULL },
{ { "set", "anon", "off" }, "set anon off : deactivate the anonymized mode", cli_parse_set_anon, NULL, NULL },
{ { "set", "anon", "global-key", NULL }, "set anon global-key <value> : change the global anonymizing key", cli_parse_set_global_key, NULL, NULL },
{ { "set", "maxconn", "global", NULL }, "set maxconn global <value> : change the per-process maxconn setting", cli_parse_set_maxconn_global, NULL },
{ { "set", "rate-limit", NULL }, "set rate-limit <setting> <value> : change a rate limiting value", cli_parse_set_ratelimit, NULL },