dovecot: Added noenforcing option to fs quota backend.

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 28 16:45:30 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/1d0521b7151d
changeset: 6874:1d0521b7151d
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 28 16:45:25 2007 +0200
description:
Added noenforcing option to fs quota backend.

diffstat:

3 files changed, 10 insertions(+)
src/plugins/quota/quota-fs.c      |    2 ++
src/plugins/quota/quota-private.h |    3 +++
src/plugins/quota/quota.c         |    5 +++++

diffs (40 lines):

diff -r 3069e66789b3 -r 1d0521b7151d src/plugins/quota/quota-fs.c
--- a/src/plugins/quota/quota-fs.c	Wed Nov 28 16:08:39 2007 +0200
+++ b/src/plugins/quota/quota-fs.c	Wed Nov 28 16:45:25 2007 +0200
@@ -97,6 +97,8 @@ static int fs_quota_init(struct quota_ro
 			root->user_disabled = TRUE;
 		else if (strcmp(*tmp, "inode_per_mail") == 0)
 			root->inode_per_mail = TRUE;
+		else if (strcmp(*tmp, "noenforcing") == 0)
+			_root->no_enforcing = TRUE;
 		else if (strncmp(*tmp, "mount=", 6) == 0) {
 			i_free(root->storage_mount_path);
 			root->storage_mount_path = i_strdup(*tmp + 6);
diff -r 3069e66789b3 -r 1d0521b7151d src/plugins/quota/quota-private.h
--- a/src/plugins/quota/quota-private.h	Wed Nov 28 16:08:39 2007 +0200
+++ b/src/plugins/quota/quota-private.h	Wed Nov 28 16:45:25 2007 +0200
@@ -75,6 +75,9 @@ struct quota_root {
 
 	/* Module-specific contexts. See quota_module_id. */
 	ARRAY_DEFINE(quota_module_contexts, void);
+
+	/* don't enforce quota when saving */
+	unsigned int no_enforcing:1;
 };
 
 struct quota_transaction_context {
diff -r 3069e66789b3 -r 1d0521b7151d src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Wed Nov 28 16:08:39 2007 +0200
+++ b/src/plugins/quota/quota.c	Wed Nov 28 16:45:25 2007 +0200
@@ -586,6 +586,11 @@ static int quota_transaction_set_limits(
 	/* find the lowest quota limits from all roots and use them */
 	roots = array_get(&ctx->quota->roots, &count);
 	for (i = 0; i < count; i++) {
+		if (roots[i]->no_enforcing) {
+			/* we don't care what the current quota is */
+			continue;
+		}
+
 		ret = quota_get_resource(roots[i], mailbox_name,
 					 QUOTA_NAME_STORAGE_BYTES,
 					 &current, &limit);


More information about the dovecot-cvs mailing list