if (root->box_name == NULL && root->root_name == NULL)
root->box_name = "INBOX";
- /* we'll never try to enforce the quota - it's just a lot of
- unnecessary remote GETQUOTA calls. */
- _root->no_enforcing = TRUE;
return 0;
}
/* Module-specific contexts. See quota_module_id. */
ARRAY(void) quota_module_contexts;
- /* don't enforce quota when saving */
- bool no_enforcing:1;
/* quota is automatically updated. update() should be called but the
bytes won't be changed. count is still changed, because it's cheap
to do and it's internally used to figure out whether there have
DEF(STR, quota_args),
DEF(BOOL, quota_ignore),
DEF(BOOL, quota_ignore_unlimited),
+ DEF(BOOL, quota_enforce),
DEF(BOOL, quota_hidden),
DEF(SIZE, quota_storage_size),
DEF(UINT, quota_storage_percentage),
.quota_args = "",
.quota_ignore = FALSE,
.quota_ignore_unlimited = FALSE,
+ .quota_enforce = TRUE,
.quota_hidden = FALSE,
.quota_storage_size = SET_SIZE_UNLIMITED,
.quota_storage_percentage = 100,
.quota_exceeded_message = "Quota exceeded (mailbox for user is full)",
};
+static const struct setting_keyvalue quota_default_settings_keyvalue[] = {
+ /* imapc should never try to enforce the quota - it's just a lot of
+ unnecessary remote GETQUOTA calls. */
+ { "quota_imapc/quota_enforce", "no" },
+ { NULL, NULL }
+};
const struct setting_parser_info quota_setting_parser_info = {
.name = "quota",
.defines = quota_setting_defines,
.defaults = "a_default_settings,
+ .default_settings = quota_default_settings_keyvalue,
.struct_size = sizeof(struct quota_settings),
#ifndef CONFIG_BINARY
.check_func = quota_settings_check,
bool quota_ignore;
/* IF TRUE, quota is ignored only when quota is unlimited. */
bool quota_ignore_unlimited;
+ /* Whether to actually enforce quota limits. */
+ bool quota_enforce;
/* Quota root is hidden (to e.g. IMAP GETQUOTAROOT) */
bool quota_hidden;
/* Quota storage size is counted as:
static ARRAY(const struct quota_backend*) quota_backends;
-static void noenforcing_param_handler(struct quota_root *_root, const char *param_value);
-
-struct quota_param_parser quota_param_noenforcing = {.param_name = "noenforcing", .param_handler = noenforcing_param_handler};
-
static enum quota_alloc_result quota_default_test_alloc(
struct quota_transaction_context *ctx, uoff_t size,
const char **error_r);
const char **error_r)
{
const struct quota_param_parser default_params[] = {
- quota_param_noenforcing,
{.param_name = NULL}
};
return quota_parse_parameters(root, &args, error_r, default_params, TRUE);
bytes_limit = count_limit = 0;
if (!quota_root_is_visible(roots[i], ctx->box))
continue;
- else if (roots[i]->no_enforcing) {
+ else if (!roots[i]->set->quota_enforce) {
ignored = FALSE;
} else if (quota_root_get_rule_limits(roots[i], ctx->box->event,
&bytes_limit, &count_limit,
uint64_t bytes_limit, count_limit;
if (!quota_root_is_visible(roots[i], ctx->box) ||
- roots[i]->no_enforcing)
+ !roots[i]->set->quota_enforce)
continue;
if (quota_root_get_rule_limits(roots[i], ctx->box->event,
ctx->recalculate = recalculate;
}
-static void noenforcing_param_handler(struct quota_root *_root, const char *param_value ATTR_UNUSED)
-{
- _root->no_enforcing = TRUE;
-}
-
int quota_parse_parameters(struct quota_root *root, const char **args, const char **error_r,
const struct quota_param_parser *valid_params, bool fail_on_unknown)
{