dovecot-2.0: quota: Log a warning if Maildir++ quota is enabled ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 6 21:49:33 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/6ea01abfaea9
changeset: 12260:6ea01abfaea9
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 06 19:49:31 2010 +0100
description:
quota: Log a warning if Maildir++ quota is enabled for non-Maildir storage.

diffstat:

 src/plugins/quota/quota-maildir.c |  29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 092c39cf86b9 -r 6ea01abfaea9 src/plugins/quota/quota-maildir.c
--- a/src/plugins/quota/quota-maildir.c	Wed Oct 06 19:35:17 2010 +0100
+++ b/src/plugins/quota/quota-maildir.c	Wed Oct 06 19:49:31 2010 +0100
@@ -618,16 +618,31 @@
 
 static bool maildirquota_limits_init(struct maildir_quota_root *root)
 {
-	if (!root->limits_initialized) {
-		root->limits_initialized = TRUE;
+	struct mailbox_list *list;
+	struct mail_storage *storage;
+	const char *name = "";
 
-		if (root->maildirsize_path == NULL) {
-			i_warning("quota maildir: No maildir namespaces, "
-				  "ignoring quota.");
-		}
+	if (root->limits_initialized)
+		return root->maildirsize_path != NULL;
+	root->limits_initialized = TRUE;
+
+	if (root->maildirsize_ns == NULL) {
+		i_assert(root->maildirsize_path == NULL);
+		return FALSE;
 	}
+	i_assert(root->maildirsize_path != NULL);
 
-	return root->maildirsize_path != NULL;
+	list = root->maildirsize_ns->list;
+	if (mailbox_list_get_storage(&list, &name, &storage) == 0 &&
+	    strcmp(storage->name, MAILDIR_STORAGE_NAME) != 0) {
+		/* non-maildir namespace, skip */
+		i_warning("quota: Namespace '%s' is not Maildir, "
+			  "skipping for Maildir++ quota",
+			  root->maildirsize_ns->prefix);
+		root->maildirsize_path = NULL;
+		return FALSE;
+	}
+	return TRUE;
 }
 
 static int maildirquota_read_limits(struct maildir_quota_root *root)


More information about the dovecot-cvs mailing list