]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Initialize quota plugin even without any quota settings
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 13 Aug 2024 11:46:08 +0000 (14:46 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:13 +0000 (12:34 +0200)
After the following changes, it's not known whether there are quota
settings, since they could be e.g. mailbox-specific.

src/plugins/quota/quota-storage.c
src/plugins/quota/quota.c

index bd2568b39606e15f164eaaf1af3ab932234a8ad0..e3ed4f7b4efa8776183c9601d61bf5153d11987a 100644 (file)
@@ -673,7 +673,7 @@ void quota_mail_user_created(struct mail_user *user)
        const char *error;
        int ret;
 
-       if ((ret = quota_user_read_settings(user, &set, &error)) > 0) {
+       if ((ret = quota_user_read_settings(user, &set, &error)) == 0) {
                if (quota_init(set, user, &quota, &error) < 0) {
                        quota_settings_deinit(&set);
                        ret = -1;
@@ -685,17 +685,13 @@ void quota_mail_user_created(struct mail_user *user)
                        "Failed to initialize quota: %s", error);
                return;
        }
-       if (ret > 0) {
-               quser = p_new(user->pool, struct quota_user, 1);
-               quser->module_ctx.super = *v;
-               user->vlast = &quser->module_ctx.super;
-               v->deinit = quota_user_deinit;
-               quser->quota = quota;
+       quser = p_new(user->pool, struct quota_user, 1);
+       quser->module_ctx.super = *v;
+       user->vlast = &quser->module_ctx.super;
+       v->deinit = quota_user_deinit;
+       quser->quota = quota;
 
-               MODULE_CONTEXT_SET(user, quota_user_module, quser);
-       } else {
-               e_debug(user->event, "quota: No quota setting - plugin disabled");
-       }
+       MODULE_CONTEXT_SET(user, quota_user_module, quser);
 }
 
 static struct quota_root *
index d963bcbe71892da28c054c7679e657e6a37c58e5..b5a10329d946fd7b29d6093407558ce66fb875b4 100644 (file)
@@ -343,14 +343,9 @@ int quota_user_read_settings(struct mail_user *user,
                if (i_snprintf(root_name, sizeof(root_name), "quota%d", i) < 0)
                        i_unreached();
        }
-       if (quota_set->max_mail_size == 0 &&
-           array_count(&quota_set->root_sets) == 0) {
-               pool_unref(&pool);
-               return 0;
-       }
 
        *set_r = quota_set;
-       return 1;
+       return 0;
 }
 
 void quota_settings_deinit(struct quota_legacy_settings **_quota_set)