From: Timo Sirainen Date: Tue, 13 Aug 2024 11:46:08 +0000 (+0300) Subject: quota: Initialize quota plugin even without any quota settings X-Git-Tag: 2.4.1~687 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2dfbbcf4a9327a368b8a3ee653c36b1c2d4ee4c;p=thirdparty%2Fdovecot%2Fcore.git quota: Initialize quota plugin even without any quota settings After the following changes, it's not known whether there are quota settings, since they could be e.g. mailbox-specific. --- diff --git a/src/plugins/quota/quota-storage.c b/src/plugins/quota/quota-storage.c index bd2568b396..e3ed4f7b4e 100644 --- a/src/plugins/quota/quota-storage.c +++ b/src/plugins/quota/quota-storage.c @@ -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, "a, &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 * diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index d963bcbe71..b5a10329d9 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -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("a_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)