dovecot-2.2: lib-storage: Make sure mailbox_get_open_status() ca...

dovecot at dovecot.org dovecot at dovecot.org
Fri Feb 22 10:32:18 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/8740056e9b2f
changeset: 15886:8740056e9b2f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Feb 22 10:32:05 2013 +0200
description:
lib-storage: Make sure mailbox_get_open_status() can't be used with items that can fail.

diffstat:

 src/lib-storage/mail-storage.c |  1 +
 src/lib-storage/mail-storage.h |  4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diffs (25 lines):

diff -r 994298d9c3d5 -r 8740056e9b2f src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri Feb 22 10:31:38 2013 +0200
+++ b/src/lib-storage/mail-storage.c	Fri Feb 22 10:32:05 2013 +0200
@@ -1479,6 +1479,7 @@
 			     struct mailbox_status *status_r)
 {
 	i_assert(box->opened);
+	i_assert((items & MAILBOX_STATUS_FAILING_ITEMS) == 0);
 
 	mailbox_get_status_set_defaults(box, status_r);
 	if (box->v.get_status(box, items, status_r) < 0)
diff -r 994298d9c3d5 -r 8740056e9b2f src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Fri Feb 22 10:31:38 2013 +0200
+++ b/src/lib-storage/mail-storage.h	Fri Feb 22 10:32:05 2013 +0200
@@ -78,6 +78,10 @@
 	STATUS_LAST_CACHED_SEQ	= 0x800,
 	STATUS_CHECK_OVER_QUOTA	= 0x1000, /* return error if over quota */
 	STATUS_HIGHESTPVTMODSEQ	= 0x2000,
+	/* status items that must not be looked up with
+	   mailbox_get_open_status(), because they can return failure. */
+#define MAILBOX_STATUS_FAILING_ITEMS \
+	(STATUS_LAST_CACHED_SEQ | STATUS_CHECK_OVER_QUOTA)
 };
 
 enum mailbox_metadata_items {


More information about the dovecot-cvs mailing list