dovecot: If client disconnects in the middle of sending command ...

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 6 19:45:05 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/5c6af3b74d5f
changeset: 6179:5c6af3b74d5f
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 06 19:45:01 2007 +0300
description:
If client disconnects in the middle of sending command parameters, don't
crash with "command didn't cancel itself" error.

diffstat:

1 file changed, 5 insertions(+), 1 deletion(-)
src/imap/client.c |    6 +++++-

diffs (23 lines):

diff -r 66971adb55e5 -r 5c6af3b74d5f src/imap/client.c
--- a/src/imap/client.c	Mon Aug 06 19:29:16 2007 +0300
+++ b/src/imap/client.c	Mon Aug 06 19:45:01 2007 +0300
@@ -62,7 +62,7 @@ void client_command_cancel(struct client
 
 	cmd->cancel = TRUE;
 	cmd_ret = cmd->func == NULL ? TRUE : cmd->func(cmd);
-	if (!cmd_ret) {
+	if (!cmd_ret && !cmd->param_error) {
 		if (cmd->client->output->closed)
 			i_panic("command didn't cancel itself: %s", cmd->name);
 	} else {
@@ -260,6 +260,10 @@ bool client_read_args(struct client_comm
 		return TRUE;
 	} else if (ret == -2) {
 		/* need more data */
+		if (cmd->client->input->closed) {
+			/* disconnected */
+			cmd->param_error = TRUE;
+		}
 		return FALSE;
 	} else {
 		/* error, or missing arguments */


More information about the dovecot-cvs mailing list