From: Josef 'Jeff' Sipek Date: Wed, 11 Mar 2020 11:29:33 +0000 (+0200) Subject: imap: Use "unknown" for cmd_name when the command name is not known X-Git-Tag: 2.3.11.2~534 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23674e3e985190dfb5ea5dd88fd0970d5c7bcee1;p=thirdparty%2Fdovecot%2Fcore.git imap: Use "unknown" for cmd_name when the command name is not known --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 968da5e056..8ab402e4e5 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -908,7 +908,10 @@ struct client_command_context *client_command_alloc(struct client *client) void client_command_init_finished(struct client_command_context *cmd) { event_add_str(cmd->event, "cmd_tag", cmd->tag); - event_add_str(cmd->event, "cmd_name", t_str_ucase(cmd->name)); + /* use "unknown" until we checked that the command name is known/valid */ + event_add_str(cmd->event, "cmd_name", "unknown"); + /* the actual command name received from client - as-is */ + event_add_str(cmd->event, "cmd_input_name", cmd->name); } static struct client_command_context * @@ -1215,6 +1218,8 @@ static bool client_command_input(struct client_command_context *cmd) } else if ((command = command_find(cmd->name)) != NULL) { cmd->func = command->func; cmd->cmd_flags = command->flags; + /* valid command - overwrite the "unknown" string set earlier */ + event_add_str(cmd->event, "cmd_name", command->name); if (client_command_is_ambiguous(cmd)) { /* do nothing until existing commands are finished */ i_assert(cmd->state == CLIENT_COMMAND_STATE_WAIT_INPUT);