]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Store command args to client command contexts for debugging purposes.
authorTimo Sirainen <tss@iki.fi>
Fri, 6 Feb 2009 18:39:48 +0000 (13:39 -0500)
committerTimo Sirainen <tss@iki.fi>
Fri, 6 Feb 2009 18:39:48 +0000 (13:39 -0500)
--HG--
branch : HEAD

src/imap/client.c
src/imap/client.h

index d579c7c546fa063cc2f9d73acf2811bc78db88e9..88d47d1d3950272d44264f0602224810c7dc2237 100644 (file)
@@ -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) {
index ab5b245cb7d7dc39206cc183ff72c3ec768e26ae..671455a22731a7812a828898a4a46c5c9a8fdcd7 100644 (file)
@@ -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;