dovecot-2.0: quota: Added ignoreunlimited option to quota roots ...

dovecot at dovecot.org dovecot at dovecot.org
Thu May 20 11:02:14 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/e688d58b0112
changeset: 11348:e688d58b0112
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 20 10:02:11 2010 +0200
description:
quota: Added ignoreunlimited option to quota roots to disable tracking users with unlimited quota.

diffstat:

 src/plugins/quota/quota-dict.c    |  5 +++++
 src/plugins/quota/quota-maildir.c |  2 ++
 src/plugins/quota/quota-private.h |  2 ++
 src/plugins/quota/quota.c         |  9 ++++++++-
 4 files changed, 17 insertions(+), 1 deletions(-)

diffs (72 lines):

diff -r 295e12b91054 -r e688d58b0112 src/plugins/quota/quota-dict.c
--- a/src/plugins/quota/quota-dict.c	Thu May 20 10:01:43 2010 +0200
+++ b/src/plugins/quota/quota-dict.c	Thu May 20 10:02:11 2010 +0200
@@ -50,6 +50,11 @@
 			args += 12;
 			continue;
 		}
+		if (strncmp(args, "ignoreunlimited:", 16) == 0) {
+			_root->disable_unlimited_tracking = TRUE;
+			args += 16;
+			continue;
+		}
 		if (strncmp(args, "ns=", 3) == 0) {
 			p = strchr(args, ':');
 			if (p == NULL)
diff -r 295e12b91054 -r e688d58b0112 src/plugins/quota/quota-maildir.c
--- a/src/plugins/quota/quota-maildir.c	Thu May 20 10:01:43 2010 +0200
+++ b/src/plugins/quota/quota-maildir.c	Thu May 20 10:02:11 2010 +0200
@@ -715,6 +715,8 @@
 	for (tmp = t_strsplit(args, ":"); *tmp != NULL; tmp++) {
 		if (strcmp(*tmp, "noenforcing") == 0)
 			_root->no_enforcing = TRUE;
+		else if (strcmp(*tmp, "ignoreunlimited") == 0)
+			_root->disable_unlimited_tracking = TRUE;
 		else if (strncmp(*tmp, "ns=", 3) == 0)
 			_root->ns_prefix = p_strdup(_root->pool, *tmp + 3);
 		else {
diff -r 295e12b91054 -r e688d58b0112 src/plugins/quota/quota-private.h
--- a/src/plugins/quota/quota-private.h	Thu May 20 10:01:43 2010 +0200
+++ b/src/plugins/quota/quota-private.h	Thu May 20 10:02:11 2010 +0200
@@ -117,6 +117,8 @@
 
 	/* don't enforce quota when saving */
 	unsigned int no_enforcing:1;
+	/* If user has unlimited quota, disable quota tracking */
+	unsigned int disable_unlimited_tracking:1;
 };
 
 struct quota_transaction_context {
diff -r 295e12b91054 -r e688d58b0112 src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Thu May 20 10:01:43 2010 +0200
+++ b/src/plugins/quota/quota.c	Thu May 20 10:02:11 2010 +0200
@@ -224,6 +224,8 @@
 		for (; *tmp != NULL; tmp++) {
 			if (strcmp(*tmp, "noenforcing") == 0)
 				root->no_enforcing = TRUE;
+			else if (strcmp(*tmp, "ignoreunlimited") == 0)
+				root->disable_unlimited_tracking = TRUE;
 			else
 				break;
 		}
@@ -233,6 +235,10 @@
 				root_set->name, root->backend.name, *tmp);
 		}
 	}
+	if (root_set->default_rule.bytes_limit == 0 &&
+	    root_set->default_rule.count_limit == 0 &&
+	    root->disable_unlimited_tracking)
+		return NULL;
 	return root;
 }
 
@@ -261,7 +267,8 @@
 	i_array_init(&quota->namespaces, count);
 	for (i = 0; i < count; i++) {
 		root = quota_root_init(root_sets[i], quota);
-		array_append(&quota->roots, &root, 1);
+		if (root != NULL)
+			array_append(&quota->roots, &root, 1);
 	}
 	return quota;
 }


More information about the dovecot-cvs mailing list