]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Remove quota_args setting
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 22 Aug 2024 09:23:46 +0000 (12:23 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:00 +0000 (10:40 +0200)
All backends have replaced the args with global settings.

src/plugins/quota/quota-count.c
src/plugins/quota/quota-fs.c
src/plugins/quota/quota-imapc.c
src/plugins/quota/quota-maildir.c
src/plugins/quota/quota-private.h
src/plugins/quota/quota-settings.c
src/plugins/quota/quota-settings.h
src/plugins/quota/quota.c
src/plugins/quota/quota.h

index 80633815bd6e0408563edd123def7510fda36dad..af7dfc7edbe1045e5cef9535c3b8dcfb53d7fbd4 100644 (file)
@@ -235,13 +235,13 @@ static struct quota_root *count_quota_alloc(void)
        return &root->root;
 }
 
-static int count_quota_init(struct quota_root *root, const char *args,
-                           const char **error_r)
+static int count_quota_init(struct quota_root *root,
+                           const char **error_r ATTR_UNUSED)
 {
        event_set_append_log_prefix(root->backend.event, "quota-count: ");
 
        root->auto_updating = TRUE;
-       return quota_root_default_init(root, args, error_r);
+       return 0;
 }
 
 static void count_quota_deinit(struct quota_root *_root)
index 176c1e117339f8deacdaaae1afa5d287f89a6331..4e7f7282f33d2a15c445b0acb9af0bd8a28b1a44 100644 (file)
@@ -145,8 +145,7 @@ static struct quota_root *fs_quota_alloc(void)
        return &root->root;
 }
 
-static int fs_quota_init(struct quota_root *_root, const char *args ATTR_UNUSED,
-                        const char **error_r)
+static int fs_quota_init(struct quota_root *_root, const char **error_r)
 {
        struct fs_quota_root *root = (struct fs_quota_root *)_root;
 
index 2f65aa65bd2663f50f4243f167c0ea0c9330afe9..42ede042c65e5e688d18e097fb961f7836c3e211 100644 (file)
@@ -86,8 +86,7 @@ static struct quota_root *imapc_quota_alloc(void)
        return &root->root;
 }
 
-static int imapc_quota_init(struct quota_root *_root, const char *args ATTR_UNUSED,
-                           const char **error_r)
+static int imapc_quota_init(struct quota_root *_root, const char **error_r)
 {
        struct imapc_quota_root *root = (struct imapc_quota_root *)_root;
 
index dbb5af7cee97d96082887bd4d687daa7089dc08c..e89553b52899d39e4dc046d82eed2903780f0848 100644 (file)
@@ -750,11 +750,11 @@ static struct quota_root *maildir_quota_alloc(void)
        return &root->root;
 }
 
-static int maildir_quota_init(struct quota_root *_root, const char *args,
-                             const char **error_r)
+static int maildir_quota_init(struct quota_root *_root,
+                             const char **error_r ATTR_UNUSED)
 {
        event_set_append_log_prefix(_root->backend.event, "quota-maildir: ");
-       return quota_root_default_init(_root, args, error_r);
+       return 0;
 }
 
 static void maildir_quota_deinit(struct quota_root *_root)
index 30f5bb242fa2e1be0cf6b3ced42a15fe191ba1b2..23f70ce2b160cd3a400f17b6bdc561a345bc0ad1 100644 (file)
@@ -31,8 +31,7 @@ struct quota {
 
 struct quota_backend_vfuncs {
        struct quota_root *(*alloc)(void);
-       int (*init)(struct quota_root *root, const char *args,
-                   const char **error_r);
+       int (*init)(struct quota_root *root, const char **error_r);
        void (*deinit)(struct quota_root *root);
 
        /* called once for each namespace */
@@ -133,8 +132,6 @@ void quota_add_user_namespace(struct quota *quota, const char *root_name,
                              struct mail_namespace *ns);
 void quota_remove_user_namespace(struct mail_namespace *ns);
 
-int quota_root_default_init(struct quota_root *root, const char *args,
-                           const char **error_r);
 struct quota *quota_get_mail_user_quota(struct mail_user *user);
 
 /* Returns 1 if values were returned successfully, 0 if we're recursing into
index a83b83d32119c40154c56367b48351a9a3dc611d..917dc6309cceb97eef925ba6d40cc7ae1ac8be5e 100644 (file)
@@ -24,7 +24,6 @@ static const struct setting_define quota_setting_defines[] = {
 
        DEF(STR, quota_name),
        DEF(STR, quota_driver),
-       DEF(STR, quota_args),
        DEF(BOOL, quota_ignore),
        DEF(BOOL, quota_ignore_unlimited),
        DEF(BOOL, quota_enforce),
@@ -60,7 +59,6 @@ static const struct quota_settings quota_default_settings = {
 
        .quota_name = "",
        .quota_driver = "count",
-       .quota_args = "",
        .quota_ignore = FALSE,
        .quota_ignore_unlimited = FALSE,
        .quota_enforce = TRUE,
index a059237a1fb70975e580265e79632f5e49a38071..131dc7f7d227c206552d3c2ebc18fbb70de35f3f 100644 (file)
@@ -20,7 +20,6 @@ struct quota_settings {
        /* Client-visible name of the quota root */
        const char *quota_name;
        const char *quota_driver;
-       const char *quota_args;
        /* If TRUE, quota is not tracked at all (for this mailbox). This is
           typically set only for specific mailboxes or namespaces. Note that
           this differs from unlimited quota, which still tracks the quota,
index b1a4f206a399e56dec9435159211b7fe8c899436..cc6ec84b7d54cd4fdc077aac8e958043f30e54bb 100644 (file)
@@ -141,15 +141,6 @@ static void quota_root_deinit(struct quota_root *root)
        pool_unref(&pool);
 }
 
-int quota_root_default_init(struct quota_root *root, const char *args,
-                           const char **error_r)
-{
-       const struct quota_param_parser default_params[] = {
-               {.param_name = NULL}
-       };
-       return quota_parse_parameters(root, &args, error_r, default_params, TRUE);
-}
-
 static int
 quota_root_settings_get(struct quota_root *root, struct event *set_event,
                        const struct quota_settings **set_r,
@@ -250,7 +241,7 @@ quota_root_init(struct quota *quota, struct event *set_event, const char *root_n
                root->set->quota_storage_size;
        root->count_limit = root->set->quota_message_count;
 
-       if (root->backend.v.init(root, root->set->quota_args, error_r) < 0) {
+       if (root->backend.v.init(root, error_r) < 0) {
                *error_r = t_strdup_printf("%s quota init failed: %s",
                                           root->backend.name, *error_r);
 
@@ -1278,54 +1269,3 @@ void quota_recalculate(struct quota_transaction_context *ctx,
 {
        ctx->recalculate = recalculate;
 }
-
-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)
-{
-       const char *tmp_param_name, *tmp_param_val;
-       size_t tmp_param_len;
-
-       while (*args != NULL && (*args)[0] != '\0') {
-               for (; valid_params->param_name != NULL; ++valid_params) {
-                       tmp_param_name = valid_params->param_name;
-                       tmp_param_len = strlen(valid_params->param_name);
-                       i_assert(*args != NULL);
-                       if (strncmp(*args, tmp_param_name, tmp_param_len) == 0) {
-                               tmp_param_val = NULL;
-                               *args += tmp_param_len;
-                               if (tmp_param_name[tmp_param_len - 1] == '=') {
-                                       const char *next_colon = strchr(*args, ':');
-                                       tmp_param_val = (next_colon == NULL)?
-                                               t_strdup(*args):
-                                               t_strdup_until(*args, next_colon);
-                                       *args = (next_colon == NULL) ? NULL : next_colon + 1;
-                               }
-                               else if ((*args)[0] == '\0' ||
-                                        (*args)[0] == ':') {
-                                       *args = ((*args)[0] == ':') ? *args + 1 : NULL;
-                                       /* in case parameter is a boolean second parameter
-                                        * string parameter value will be ignored by param_handler
-                                        * we just need some non-NULL value
-                                        * to indicate that argument is to be processed */
-                                       tmp_param_val = "";
-                               }
-                               if (tmp_param_val != NULL) {
-                                       valid_params->param_handler(root, tmp_param_val);
-                                       break;
-                               }
-                       }
-               }
-               if (valid_params->param_name == NULL) {
-                       if (fail_on_unknown) {
-                               *error_r = t_strdup_printf(
-                                       "Unknown parameter for backend %s: %s",
-                                       root->backend.name, *args);
-                               return -1;
-                       }
-                       else {
-                               break;
-                       }
-               }
-       }
-       return 0;
-}
index a8901a249cddf37c681f6a09716934f4d303859c..7cabca95aaea8ace50178ba84fec9ebe61d4f3e8 100644 (file)
@@ -123,8 +123,4 @@ void quota_recalculate(struct quota_transaction_context *ctx,
 /* Execute quota_over_scripts if needed. */
 void quota_over_status_check_startup(struct quota *quota);
 
-/* Common quota parameters parsing loop */
-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);
-
 #endif