dovecot-1.2: imap: Fixed SELECT QRESYNC not to crash on mailbox ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 2 19:14:30 EET 2010


details:   http://hg.dovecot.org/dovecot-1.2/rev/b30af25c622d
changeset: 9625:b30af25c622d
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 02 17:14:24 2010 +0000
description:
imap: Fixed SELECT QRESYNC not to crash on mailbox close if a lot of changes were being sent.

diffstat:

 src/imap/cmd-select.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r 45769d0cc39c -r b30af25c622d src/imap/cmd-select.c
--- a/src/imap/cmd-select.c	Mon Oct 25 16:22:04 2010 +0100
+++ b/src/imap/cmd-select.c	Tue Nov 02 17:14:24 2010 +0000
@@ -252,11 +252,11 @@
 
 			ctx->cmd->func = cmd_select_continue;
 			ctx->cmd->context = ctx;
-			return FALSE;
+			return 0;
 		}
 	}
 
-	return imap_fetch_deinit(fetch_ctx);
+	return imap_fetch_deinit(fetch_ctx) < 0 ? -1 : 1;
 }
 
 static int
@@ -265,6 +265,7 @@
 	struct client *client = ctx->cmd->client;
 	struct mailbox_status status;
 	enum mailbox_open_flags open_flags = 0;
+	int ret;
 
 	if (readonly)
 		open_flags |= MAILBOX_OPEN_READONLY | MAILBOX_OPEN_KEEP_RECENT;
@@ -321,10 +322,12 @@
 	}
 
 	if (ctx->qresync_uid_validity == status.uidvalidity) {
-		if (select_qresync(ctx) < 0)
+		if ((ret = select_qresync(ctx)) < 0)
 			return -1;
+	} else {
+		ret = 1;
 	}
-	return 0;
+	return ret;
 }
 
 static void close_selected_mailbox(struct client *client)
@@ -393,6 +396,8 @@
 	}
 
 	ret = select_open(ctx, mailbox, readonly);
+	if (ret == 0)
+		return FALSE;
 	cmd_select_finish(ctx, ret);
 	return TRUE;
 }


More information about the dovecot-cvs mailing list