dovecot-1.2: quota: All backends now take noenforcing parameter.

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 8 13:31:14 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/7a6e72d2c599
changeset: 7971:7a6e72d2c599
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 08 16:00:53 2008 +0530
description:
quota: All backends now take noenforcing parameter.

diffstat:

2 files changed, 23 insertions(+), 8 deletions(-)
src/plugins/quota/quota-dict.c |   13 +++++++++++--
src/plugins/quota/quota.c      |   18 ++++++++++++------

diffs (61 lines):

diff -r bc5a85e2b11d -r 7a6e72d2c599 src/plugins/quota/quota-dict.c
--- a/src/plugins/quota/quota-dict.c	Tue Jul 08 15:47:31 2008 +0530
+++ b/src/plugins/quota/quota-dict.c	Tue Jul 08 16:00:53 2008 +0530
@@ -40,11 +40,20 @@ static int dict_quota_init(struct quota_
 	username = t_strdup_until(args, p);
 	args = p+1;
 
+	if (strncmp(args, "noenforcing:", 12) == 0) {
+		/* FIXME: pretty ugly in here. the parameters should have
+		   been designed to be extensible. do it in a future version */
+		_root->no_enforcing = TRUE;
+		args += 12;
+	}
+
 	if (*username == '\0')
 		username = getenv("USER");
 
-	if (getenv("DEBUG") != NULL)
-		i_info("dict quota: user = %s, uri = %s", username, args);
+	if (getenv("DEBUG") != NULL) {
+		i_info("dict quota: user=%s, uri=%s, enforcing=%d",
+		       username, args, _root->no_enforcing);
+	}
 
 	/* FIXME: we should use 64bit integer as datatype instead but before
 	   it can actually be used don't bother */
diff -r bc5a85e2b11d -r 7a6e72d2c599 src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Tue Jul 08 15:47:31 2008 +0530
+++ b/src/plugins/quota/quota.c	Tue Jul 08 16:00:53 2008 +0530
@@ -91,7 +91,7 @@ struct quota_root *quota_root_init(struc
 {
 	struct quota_root *root;
 	const struct quota_backend *backend;
-	const char *p, *args, *backend_name;
+	const char *p, *args, *backend_name, *const *tmp;
 
 	/* <backend>[:<quota root name>[:<backend args>]] */
 	p = strchr(root_def, ':');
@@ -144,11 +144,17 @@ struct quota_root *quota_root_init(struc
 			return NULL;
 		}
 	} else if (args != NULL) {
-		while (*args == ' ') args++;
-		if (*args != '\0') {
-			i_fatal("Quota root %s: backend %s "
-				"doesn't take any parameters (used: %s)",
-				root->name, backend_name, args);
+		tmp = t_strsplit_spaces(args, " ");
+		for (; *tmp != NULL; tmp++) {
+			if (strcmp(*tmp, "noenforcing") == 0)
+				root->no_enforcing = TRUE;
+			else
+				break;
+		}
+		if (*tmp != NULL) {
+			i_fatal("Quota root %s backend %s: "
+				"Unknown parameter: %s",
+				root->name, backend_name, *tmp);
 		}
 	}
 	return root;


More information about the dovecot-cvs mailing list