]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Rename quota_set_resource() error_r to client_error_r
authorMartti Rannanjärvi <martti.rannanjarvi@open-xchange.com>
Mon, 21 Jan 2019 08:50:24 +0000 (10:50 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 21 Mar 2019 08:02:39 +0000 (10:02 +0200)
Don't pass on the error from dict_init() to client, though.

src/plugins/imap-quota/imap-quota-plugin.c
src/plugins/quota/quota.c
src/plugins/quota/quota.h

index d59ffc9e1007ccf93df07c565f5dd7a5dd09cf4d..7863419b627ac20ca4fb62139ae6fd0325703d09 100644 (file)
@@ -192,7 +192,7 @@ static bool cmd_setquota(struct client_command_context *cmd)
        struct quota_root *root;
        struct mail_user *owner;
         const struct imap_arg *args, *list_args;
-       const char *root_name, *name, *value_str, *error;
+       const char *root_name, *name, *value_str, *client_error;
        uint64_t value;
 
        /* <quota root> <resource limits> */
@@ -223,8 +223,8 @@ static bool cmd_setquota(struct client_command_context *cmd)
                        return TRUE;
                }
 
-               if (quota_set_resource(root, name, value, &error) < 0) {
-                       client_send_command_error(cmd, error);
+               if (quota_set_resource(root, name, value, &client_error) < 0) {
+                       client_send_command_error(cmd, client_error);
                        return TRUE;
                }
        }
index 6058982841fac55c8b9b76dd949706ff10446b1b..70b7c3ea3ad49034089b9fbb9788e3bccb18d3a4 100644 (file)
@@ -816,13 +816,13 @@ quota_get_resource(struct quota_root *root, const char *mailbox_name,
 }
 
 int quota_set_resource(struct quota_root *root, const char *name,
-                      uint64_t value, const char **error_r)
+                      uint64_t value, const char **client_error_r)
 {
        struct dict_transaction_context *trans;
        const char *key, *error;
 
        if (root->set->limit_set == NULL) {
-               *error_r = MAIL_ERRSTR_NO_PERMISSION;
+               *client_error_r = MAIL_ERRSTR_NO_PERMISSION;
                return -1;
        }
        if (strcasecmp(name, QUOTA_NAME_STORAGE_KILOBYTES) == 0)
@@ -832,7 +832,8 @@ int quota_set_resource(struct quota_root *root, const char *name,
        else if (strcasecmp(name, QUOTA_NAME_MESSAGES) == 0)
                key = "messages";
        else {
-               *error_r = t_strdup_printf("Unsupported resource name: %s", name);
+               *client_error_r = t_strdup_printf(
+                       "Unsupported resource name: %s", name);
                return -1;
        }
 
@@ -845,8 +846,11 @@ int quota_set_resource(struct quota_root *root, const char *name,
                if (mail_user_get_home(root->quota->user, &set.home_dir) <= 0)
                        set.home_dir = NULL;
                if (dict_init(root->set->limit_set, &set,
-                             &root->limit_set_dict, error_r) < 0)
+                             &root->limit_set_dict, &error) < 0) {
+                       i_error("dict_init() failed: %s", error);
+                       *client_error_r = "Internal quota limit update error";
                        return -1;
+               }
        }
 
        trans = dict_transaction_begin(root->limit_set_dict);
@@ -854,7 +858,7 @@ int quota_set_resource(struct quota_root *root, const char *name,
        dict_set(trans, key, dec2str(value));
        if (dict_transaction_commit(&trans, &error) < 0) {
                i_error("dict_transaction_commit() failed: %s", error);
-               *error_r = "Internal quota limit update error";
+               *client_error_r = "Internal quota limit update error";
                return -1;
        }
        return 0;
index 29a48f403adce50f3ac2df27dec70d6f3c07bbb1..8de2d8ef6f2d753def78d9e8e52c15f96f707e94 100644 (file)
@@ -113,7 +113,7 @@ quota_get_resource(struct quota_root *root, const char *mailbox_name,
                   const char **error_r);
 /* Returns 0 if OK, -1 if error (eg. permission denied, invalid name). */
 int quota_set_resource(struct quota_root *root, const char *name,
-                      uint64_t value, const char **error_r);
+                      uint64_t value, const char **client_error_r);
 
 /* Start a new quota transaction. */
 struct quota_transaction_context *quota_transaction_begin(struct mailbox *box);