dovecot-2.2: quota: Avoid assert-crash in Maildir++ quota if bac...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 29 14:29:21 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/b5b243739b67
changeset: 17668:b5b243739b67
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 29 17:27:24 2014 +0300
description:
quota: Avoid assert-crash in Maildir++ quota if backend doesn't support control dirs.
We'll delay looking up the control dir until we've checked that the storage
is Maildir.

diffstat:

 src/plugins/quota/quota-maildir.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (55 lines):

diff -r 256411741f0a -r b5b243739b67 src/plugins/quota/quota-maildir.c
--- a/src/plugins/quota/quota-maildir.c	Tue Jul 29 14:27:49 2014 +0300
+++ b/src/plugins/quota/quota-maildir.c	Tue Jul 29 17:27:24 2014 +0300
@@ -634,6 +634,7 @@
 {
 	struct mailbox_list *list;
 	struct mail_storage *storage;
+	const char *control_dir;
 
 	if (root->limits_initialized)
 		return root->maildirsize_path != NULL;
@@ -643,7 +644,6 @@
 		i_assert(root->maildirsize_path == NULL);
 		return FALSE;
 	}
-	i_assert(root->maildirsize_path != NULL);
 
 	list = root->maildirsize_ns->list;
 	if (mailbox_list_get_storage(&list, "", &storage) == 0 &&
@@ -658,6 +658,14 @@
 		root->maildirsize_path = NULL;
 		return FALSE;
 	}
+	if (root->maildirsize_path == NULL) {
+		if (!mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_CONTROL,
+						&control_dir))
+			i_unreached();
+		root->maildirsize_path =
+			p_strconcat(root->root.pool, control_dir,
+				    "/"MAILDIRSIZE_FILENAME, NULL);
+	}
 	return TRUE;
 }
 
@@ -817,18 +825,9 @@
 				   struct mail_namespace *ns)
 {
 	struct maildir_quota_root *root = (struct maildir_quota_root *)_root;
-	const char *control_dir;
 
-	if (root->maildirsize_path != NULL)
-		return;
-
-	if (!mailbox_list_get_root_path(ns->list, MAILBOX_LIST_PATH_TYPE_CONTROL,
-					&control_dir))
-		i_unreached();
-	root->maildirsize_ns = ns;
-	root->maildirsize_path =
-		p_strconcat(_root->pool, control_dir,
-			    "/"MAILDIRSIZE_FILENAME, NULL);
+	if (root->maildirsize_ns == NULL)
+		root->maildirsize_ns = ns;
 }
 
 static void


More information about the dovecot-cvs mailing list