[dovecot-cvs] dovecot/src/imap client.c, 1.44, 1.45 client.h, 1.23, 1.24

cras at dovecot.org cras at dovecot.org
Sat Aug 28 15:57:07 EEST 2004


Update of /home/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv24471

Modified Files:
	client.c client.h 
Log Message:
Command parameter errors weren't handled right. This was broken a few
commits ago..



Index: client.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -d -r1.44 -r1.45
--- client.c	28 Aug 2004 09:32:30 -0000	1.44
+++ client.c	28 Aug 2004 12:57:05 -0000	1.45
@@ -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) {

Index: client.h
===================================================================
RCS file: /home/cvs/dovecot/src/imap/client.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- client.h	22 Aug 2004 11:48:55 -0000	1.23
+++ client.h	28 Aug 2004 12:57:05 -0000	1.24
@@ -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 */



More information about the dovecot-cvs mailing list