diff -ur dovecot-1.0.5/src/imap/client.c dovecot-1.0.5-debugcmd/src/imap/client.c |
--- dovecot-1.0.5/src/imap/client.c | 2007-08-25 04:35:29.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/imap/client.c | 2007-10-11 11:54:22.000000000 +1300 |
@@ -13,6 +13,8 @@ |
|
extern struct mail_storage_callbacks mail_storage_callbacks; |
|
+char **imap_debug_client_commands_arr; |
+ |
static struct client *my_client; /* we don't need more than one currently */ |
static struct timeout *to_idle; |
|
@@ -21,6 +23,10 @@ |
{ |
| struct client *client; |
|
+ | imap_debug_client_commands_arr = NULL; |
+ | if (getenv("IMAP_DEBUG_CLIENT_COMMANDS") != NULL) |
+ | | imap_debug_client_commands_arr = t_strsplit_spaces(getenv("IMAP_DEBUG_CLIENT_COMMANDS"), ", "); |
+ |
| /* always use nonblocking I/O */ |
| net_set_nonblock(fd_in, TRUE); |
| net_set_nonblock(fd_out, TRUE); |
@@ -337,6 +343,8 @@ |
|
static bool client_handle_input(struct client_command_context *cmd) |
{ |
+ | int i; |
+ |
| struct client *client = cmd->client; |
|
if (cmd->func != NULL) { |
@@ -385,6 +393,15 @@ |
| } else { |
| | /* find the command function */ |
| | cmd->func = command_find(cmd->name); |
+ |
+ | | if (imap_debug_client_commands_arr != NULL) { |
+ | | | for (i = 0; imap_debug_client_commands_arr[i] != NULL; i++) { |
+ | | | | if (strcasecmp(cmd->name, imap_debug_client_commands_arr[i]) == 0) { |
+ | | | | | i_info("Client command: %s", cmd->name); |
+ | | | | | break; |
+ | | | | } |
+ | | | } |
+ | | } |
| } |
|
| client->input_skip_line = TRUE; |
diff -ur dovecot-1.0.5/src/master/mail-process.c dovecot-1.0.5-debugcmd/src/master/mail-process.c |
--- dovecot-1.0.5/src/master/mail-process.c | 2007-07-21 19:02:34.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/master/mail-process.c | 2007-10-11 11:54:22.000000000 +1300 |
@@ -252,6 +252,10 @@ |
| | env_put("MAILDIR_COPY_PRESERVE_FILENAME=1"); |
| if (set->mail_debug) |
| | env_put("DEBUG=1"); |
+ | if (*set->pop3_debug_client_commands != '\0') |
+ | | env_put(t_strconcat("POP3_DEBUG_CLIENT_COMMANDS=", set->pop3_debug_client_commands, NULL)); |
+ | if (*set->imap_debug_client_commands != '\0') |
+ | | env_put(t_strconcat("IMAP_DEBUG_CLIENT_COMMANDS=", set->imap_debug_client_commands, NULL)); |
| if (set->mail_full_filesystem_access) |
| | env_put("FULL_FILESYSTEM_ACCESS=1"); |
| if (set->pop3_no_flag_updates) |
diff -ur dovecot-1.0.5/src/master/master-settings-defs.c dovecot-1.0.5-debugcmd/src/master/master-settings-defs.c |
--- dovecot-1.0.5/src/master/master-settings-defs.c | 2007-07-16 07:51:07.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/master/master-settings-defs.c | 2007-10-11 11:54:22.000000000 +1300 |
@@ -66,6 +66,8 @@ |
| DEF(SET_INT, mail_cache_min_mail_count), |
| DEF(SET_INT, mailbox_idle_check_interval), |
| DEF(SET_BOOL, mail_debug), |
+ | DEF(SET_STR, pop3_debug_client_commands), |
+ | DEF(SET_STR, imap_debug_client_commands), |
| DEF(SET_BOOL, mail_full_filesystem_access), |
| DEF(SET_INT, mail_max_keyword_length), |
| DEF(SET_BOOL, mail_save_crlf), |
diff -ur dovecot-1.0.5/src/master/master-settings.c dovecot-1.0.5-debugcmd/src/master/master-settings.c |
--- dovecot-1.0.5/src/master/master-settings.c | 2007-07-16 07:51:07.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/master/master-settings.c | 2007-10-11 11:54:22.000000000 +1300 |
@@ -215,6 +215,8 @@ |
| MEMBER(mail_cache_min_mail_count) 0, |
| MEMBER(mailbox_idle_check_interval) 30, |
| MEMBER(mail_debug) FALSE, |
+ | MEMBER(pop3_debug_client_commands) "", |
+ | MEMBER(imap_debug_client_commands) "", |
| MEMBER(mail_full_filesystem_access) FALSE, |
| MEMBER(mail_max_keyword_length) 50, |
| MEMBER(mail_save_crlf) FALSE, |
diff -ur dovecot-1.0.5/src/master/master-settings.h dovecot-1.0.5-debugcmd/src/master/master-settings.h |
--- dovecot-1.0.5/src/master/master-settings.h | 2007-07-16 07:51:07.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/master/master-settings.h | 2007-10-11 11:54:22.000000000 +1300 |
@@ -74,6 +74,8 @@ |
| unsigned int mail_cache_min_mail_count; |
| unsigned int mailbox_idle_check_interval; |
| bool mail_debug; |
+ | const char *pop3_debug_client_commands; |
+ | const char *imap_debug_client_commands; |
| bool mail_full_filesystem_access; |
| unsigned int mail_max_keyword_length; |
| bool mail_save_crlf; |
diff -ur dovecot-1.0.5/src/pop3/client.c dovecot-1.0.5-debugcmd/src/pop3/client.c |
--- dovecot-1.0.5/src/pop3/client.c | 2007-08-25 04:58:50.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/pop3/client.c | 2007-10-11 11:54:22.000000000 +1300 |
@@ -385,6 +385,10 @@ |
| | return; |
| } |
|
+ | pop3_debug_client_commands_arr = NULL; |
+ | if (getenv("POP3_DEBUG_CLIENT_COMMANDS") != NULL) |
+ | | pop3_debug_client_commands_arr = t_strsplit_spaces(getenv("POP3_DEBUG_CLIENT_COMMANDS"), ", "); |
+ |
| o_stream_cork(client->output); |
| while (!client->output->closed && |
| (line = i_stream_next_line(client->input)) != NULL) { |
diff -ur dovecot-1.0.5/src/pop3/commands.c dovecot-1.0.5-debugcmd/src/pop3/commands.c |
--- dovecot-1.0.5/src/pop3/commands.c | 2007-05-19 23:14:04.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/pop3/commands.c | 2007-10-11 11:54:22.000000000 +1300 |
@@ -668,11 +668,22 @@ |
int client_command_execute(struct client *client, |
| | | const char *name, const char *args) |
{ |
+ | int i; |
+ |
| /* keep the command uppercased */ |
| name = t_str_ucase(name); |
|
| while (*args == ' ') args++; |
|
+ | if (pop3_debug_client_commands_arr != NULL) { |
+ | | for (i = 0; pop3_debug_client_commands_arr[i] != NULL; i++) { |
+ | | | if (strcasecmp(name, pop3_debug_client_commands_arr[i]) == 0) { |
+ | | | | i_info("Client command: %s %s", name, args); |
+ | | | | break; |
+ | | | } |
+ | | } |
+ | } |
+ |
| switch (*name) { |
| case 'C': |
| | if (strcmp(name, "CAPA") == 0) |
diff -ur dovecot-1.0.5/src/pop3/common.h dovecot-1.0.5-debugcmd/src/pop3/common.h |
--- dovecot-1.0.5/src/pop3/common.h | 2007-05-19 23:14:04.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/pop3/common.h | 2007-10-11 11:54:22.000000000 +1300 |
@@ -21,6 +21,7 @@ |
extern bool enable_last_command, no_flag_updates, reuse_xuidl, lock_session; |
extern const char *uidl_format, *logout_format; |
extern enum uidl_keys uidl_keymask; |
+extern char **pop3_debug_client_commands_arr; |
|
extern void (*hook_mail_storage_created)(struct mail_storage *storage); |
extern void (*hook_client_created)(struct client **client); |
diff -ur dovecot-1.0.5/src/pop3/main.c dovecot-1.0.5-debugcmd/src/pop3/main.c |
--- dovecot-1.0.5/src/pop3/main.c | 2007-07-16 07:58:50.000000000 +1200 |
+++ dovecot-1.0.5-debugcmd/src/pop3/main.c | 2007-10-11 11:54:22.000000000 +1300 |
@@ -48,6 +48,7 @@ |
bool lock_session = FALSE; |
const char *uidl_format, *logout_format; |
enum uidl_keys uidl_keymask; |
+char **pop3_debug_client_commands_arr; |
|
static void sig_die(int signo, void *context __attr_unused__) |
{ |