]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Added ignoreunlimited option to quota roots to disable tracking users with...
authorTimo Sirainen <tss@iki.fi>
Thu, 20 May 2010 08:02:11 +0000 (10:02 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 20 May 2010 08:02:11 +0000 (10:02 +0200)
--HG--
branch : HEAD

src/plugins/quota/quota-dict.c
src/plugins/quota/quota-maildir.c
src/plugins/quota/quota-private.h
src/plugins/quota/quota.c

index 8a5be534c09d81cb0462aba3d2879bbf8d089c7b..083920aeda7d13d5b77eff70a6cb9a2e4484a12c 100644 (file)
@@ -50,6 +50,11 @@ static int dict_quota_init(struct quota_root *_root, const char *args)
                        args += 12;
                        continue;
                }
+               if (strncmp(args, "ignoreunlimited:", 16) == 0) {
+                       _root->disable_unlimited_tracking = TRUE;
+                       args += 16;
+                       continue;
+               }
                if (strncmp(args, "ns=", 3) == 0) {
                        p = strchr(args, ':');
                        if (p == NULL)
index 6f003e18b761fb393686199bf11fc20aa53ba7da..dfcdc2f04a8a91122fa7289054ffe4750534e0b0 100644 (file)
@@ -715,6 +715,8 @@ static int maildir_quota_init(struct quota_root *_root, const char *args)
        for (tmp = t_strsplit(args, ":"); *tmp != NULL; tmp++) {
                if (strcmp(*tmp, "noenforcing") == 0)
                        _root->no_enforcing = TRUE;
+               else if (strcmp(*tmp, "ignoreunlimited") == 0)
+                       _root->disable_unlimited_tracking = TRUE;
                else if (strncmp(*tmp, "ns=", 3) == 0)
                        _root->ns_prefix = p_strdup(_root->pool, *tmp + 3);
                else {
index 13c8cafdbf4c6af25c4a1cbd3163505684df0b52..fbab6054a9e7c1e6f0ffbcd685fbaef5a4cc81a8 100644 (file)
@@ -117,6 +117,8 @@ struct quota_root {
 
        /* don't enforce quota when saving */
        unsigned int no_enforcing:1;
+       /* If user has unlimited quota, disable quota tracking */
+       unsigned int disable_unlimited_tracking:1;
 };
 
 struct quota_transaction_context {
index fec8cd79da0b012b12bdfa58f0b688f45d1657ea..ed9558788af3c25abadd59e144f59581fa9a73a4 100644 (file)
@@ -224,6 +224,8 @@ quota_root_init(struct quota_root_settings *root_set, struct quota *quota)
                for (; *tmp != NULL; tmp++) {
                        if (strcmp(*tmp, "noenforcing") == 0)
                                root->no_enforcing = TRUE;
+                       else if (strcmp(*tmp, "ignoreunlimited") == 0)
+                               root->disable_unlimited_tracking = TRUE;
                        else
                                break;
                }
@@ -233,6 +235,10 @@ quota_root_init(struct quota_root_settings *root_set, struct quota *quota)
                                root_set->name, root->backend.name, *tmp);
                }
        }
+       if (root_set->default_rule.bytes_limit == 0 &&
+           root_set->default_rule.count_limit == 0 &&
+           root->disable_unlimited_tracking)
+               return NULL;
        return root;
 }
 
@@ -261,7 +267,8 @@ struct quota *quota_init(struct quota_settings *quota_set,
        i_array_init(&quota->namespaces, count);
        for (i = 0; i < count; i++) {
                root = quota_root_init(root_sets[i], quota);
-               array_append(&quota->roots, &root, 1);
+               if (root != NULL)
+                       array_append(&quota->roots, &root, 1);
        }
        return quota;
 }