From: Timo Sirainen Date: Fri, 6 Feb 2009 18:39:48 +0000 (-0500) Subject: imap: Store command args to client command contexts for debugging purposes. X-Git-Tag: 1.2.beta1~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b85f482638c09ecfc56897d08d37477c5c92ffe9;p=thirdparty%2Fdovecot%2Fcore.git imap: Store command args to client command contexts for debugging purposes. --HG-- branch : HEAD --- diff --git a/src/imap/client.c b/src/imap/client.c index d579c7c546..88d47d1d39 100644 --- a/src/imap/client.c +++ b/src/imap/client.c @@ -9,6 +9,7 @@ #include "ostream.h" #include "var-expand.h" #include "imap-resp-code.h" +#include "imap-util.h" #include "mail-namespace.h" #include "commands.h" @@ -300,6 +301,7 @@ void client_send_command_error(struct client_command_context *cmd, bool client_read_args(struct client_command_context *cmd, unsigned int count, unsigned int flags, const struct imap_arg **args_r) { + string_t *str; int ret; i_assert(count <= INT_MAX); @@ -309,6 +311,11 @@ bool client_read_args(struct client_command_context *cmd, unsigned int count, /* all parameters read successfully */ i_assert(cmd->client->input_lock == NULL || cmd->client->input_lock == cmd); + + str = t_str_new(256); + imap_args_to_str(str, *args_r); + cmd->args = p_strdup(cmd->pool, str_c(str)); + cmd->client->input_lock = NULL; return TRUE; } else if (ret == -2) { diff --git a/src/imap/client.h b/src/imap/client.h index ab5b245cb7..671455a227 100644 --- a/src/imap/client.h +++ b/src/imap/client.h @@ -48,8 +48,14 @@ struct client_command_context { struct client *client; pool_t pool; + /* IMAP command tag */ const char *tag; + /* Name of this command */ const char *name; + /* Parameters for this command. These are generated from parsed IMAP + arguments, so they may not be exactly the same as how client sent + them. */ + const char *args; enum command_flags cmd_flags; command_func_t *func;