Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7971:7a6e72d2c599 HEAD
quota: All backends now take noenforcing parameter.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 08 Jul 2008 16:00:53 +0530 |
parents | bc5a85e2b11d |
children | 97f3adc9ac61 |
files | src/plugins/quota/quota-dict.c src/plugins/quota/quota.c |
diffstat | 2 files changed, 23 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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 */
--- 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 *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 @@ 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;