]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: All backends now take noenforcing parameter.
authorTimo Sirainen <tss@iki.fi>
Tue, 8 Jul 2008 10:30:53 +0000 (16:00 +0530)
committerTimo Sirainen <tss@iki.fi>
Tue, 8 Jul 2008 10:30:53 +0000 (16:00 +0530)
--HG--
branch : HEAD

src/plugins/quota/quota-dict.c
src/plugins/quota/quota.c

index 3166b52f1c34a80e4fee8bd110ec5283c5abb455..862b3277c8eccff00e87670257c213a155a026bc 100644 (file)
@@ -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 */
index 7f512944f71f900c1d9dfde2d41c3552ee22bbde..598d84e94afb031505060807ef18c2ff08c15f53 100644 (file)
@@ -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;
 
        /* <backend>[:<quota root name>[:<backend args>]] */
        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;