[dovecot-cvs] dovecot/src/imap client.c, 1.67.2.4, 1.67.2.5 cmd-idle.c, 1.30.2.3, 1.30.2.4

tss at dovecot.org tss at dovecot.org
Wed Dec 20 16:35:27 UTC 2006


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv23980

Modified Files:
      Tag: branch_1_0
	client.c cmd-idle.c 
Log Message:
Fixed potential hang problems.



Index: client.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/client.c,v
retrieving revision 1.67.2.4
retrieving revision 1.67.2.5
diff -u -d -r1.67.2.4 -r1.67.2.5
--- client.c	18 Nov 2006 21:34:20 -0000	1.67.2.4
+++ client.c	20 Dec 2006 16:35:24 -0000	1.67.2.5
@@ -330,9 +330,17 @@
 		/* command is being executed - continue it */
 		if (cmd->func(cmd) || cmd->param_error) {
 			/* command execution was finished */
-                        client->bad_counter = 0;
+			if (!cmd->param_error)
+				client->bad_counter = 0;
 			_client_reset_command(client);
 			return TRUE;
+		} else {
+			/* unfinished */
+			if (client->command_pending) {
+				o_stream_set_flush_pending(client->output,
+							   TRUE);
+			}
+			return FALSE;
 		}
 		return FALSE;
 	}
@@ -377,19 +385,7 @@
 	} else {
 		i_assert(!client->disconnected);
 
-		client->input_skip_line = TRUE;
-		if (cmd->func(cmd) || cmd->param_error) {
-			/* command execution was finished. */
-                        client->bad_counter = 0;
-			_client_reset_command(client);
-		} else {
-			/* unfinished */
-			if (client->command_pending) {
-				o_stream_set_flush_pending(client->output,
-							   TRUE);
-			}
-			return FALSE;
-		}
+		client_handle_input(cmd);
 	}
 
 	return TRUE;

Index: cmd-idle.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-idle.c,v
retrieving revision 1.30.2.3
retrieving revision 1.30.2.4
diff -u -d -r1.30.2.3 -r1.30.2.4
--- cmd-idle.c	18 Nov 2006 21:29:56 -0000	1.30.2.3
+++ cmd-idle.c	20 Dec 2006 16:35:24 -0000	1.30.2.4
@@ -32,6 +32,7 @@
 static void idle_finish(struct cmd_idle_context *ctx, bool done_ok)
 {
 	struct client *client = ctx->client;
+	size_t size;
 
 	if (ctx->idle_to != NULL)
 		timeout_remove(&ctx->idle_to);
@@ -66,7 +67,9 @@
 	client->bad_counter = 0;
 	_client_reset_command(client);
 
-	if (client->input_pending)
+	/* we may have read something else besides "DONE" into the buffer */
+	(void)i_stream_get_data(client->input, &size);
+	if (size > 0)
 		_client_input(client);
 }
 



More information about the dovecot-cvs mailing list