From: Timo Sirainen Date: Tue, 8 Jul 2008 10:30:53 +0000 (+0530) Subject: quota: All backends now take noenforcing parameter. X-Git-Tag: 1.2.alpha1~190 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=65e14cef911d5d3fac8993c8a76911a587f05cd7;p=thirdparty%2Fdovecot%2Fcore.git quota: All backends now take noenforcing parameter. --HG-- branch : HEAD --- diff --git a/src/plugins/quota/quota-dict.c b/src/plugins/quota/quota-dict.c index 3166b52f1c..862b3277c8 100644 --- a/src/plugins/quota/quota-dict.c +++ b/src/plugins/quota/quota-dict.c @@ -40,11 +40,20 @@ static int dict_quota_init(struct quota_root *_root, const char *args) 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 --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index 7f512944f7..598d84e94a 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -91,7 +91,7 @@ struct quota_root *quota_root_init(struct quota *quota, const char *root_def) { struct quota_root *root; const struct quota_backend *backend; - const char *p, *args, *backend_name; + const char *p, *args, *backend_name, *const *tmp; /* [:[:]] */ p = strchr(root_def, ':'); @@ -144,11 +144,17 @@ struct quota_root *quota_root_init(struct quota *quota, const char *root_def) 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;