Mercurial > dovecot > original-hg > dovecot-1.2
changeset 2508:467af814d5e2 HEAD
Command parameter errors weren't handled right. This was broken a few
commits ago..
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 28 Aug 2004 15:57:05 +0300 |
parents | 5ad6ccb8000b |
children | 146591955618 |
files | src/imap/client.c src/imap/client.h |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/client.c Sat Aug 28 15:45:42 2004 +0300 +++ b/src/imap/client.c Sat Aug 28 15:57:05 2004 +0300 @@ -163,6 +163,11 @@ client_disconnect_with_error(client, "Too many invalid IMAP commands."); } + + /* client_read_args() failures rely on this being set, so that the + command processing is stopped even while command function returns + FALSE. */ + client->cmd_param_error = TRUE; } int client_read_args(struct client *client, unsigned int count, @@ -236,6 +241,7 @@ client->cmd_name = NULL; client->cmd_func = NULL; client->cmd_uid = FALSE; + client->cmd_param_error = FALSE; p_clear(client->cmd_pool); imap_parser_reset(client->parser); @@ -266,7 +272,7 @@ { if (client->cmd_func != NULL) { /* command is being executed - continue it */ - if (client->cmd_func(client)) { + if (client->cmd_func(client) || client->cmd_param_error) { /* command execution was finished */ client->bad_counter = 0; _client_reset_command(client); @@ -314,8 +320,8 @@ _client_reset_command(client); } else { client->input_skip_line = TRUE; - if (client->cmd_func(client)) { - /* command execution was finished */ + if (client->cmd_func(client) || client->cmd_param_error) { + /* command execution was finished. */ client->bad_counter = 0; _client_reset_command(client); } else { @@ -382,7 +388,7 @@ if (client->command_pending) { o_stream_cork(client->output); - finished = client->cmd_func(client); + finished = client->cmd_func(client) || client->cmd_param_error; o_stream_uncork(client->output); if (finished) {
--- a/src/imap/client.h Sat Aug 28 15:45:42 2004 +0300 +++ b/src/imap/client.h Sat Aug 28 15:57:05 2004 +0300 @@ -40,6 +40,7 @@ unsigned int command_pending:1; unsigned int input_pending:1; unsigned int cmd_uid:1; /* used UID command */ + unsigned int cmd_param_error:1; unsigned int rawlog:1; unsigned int input_skip_line:1; /* skip all the data until we've found a new line */