]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: remove attribute accessibility checks
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Tue, 13 Sep 2016 11:49:41 +0000 (07:49 -0400)
committerGitLab <gitlab@git.dovecot.net>
Wed, 14 Sep 2016 11:43:35 +0000 (14:43 +0300)
index_storage_attribute_{set,get} should assume that the caller performed
due diligence and checked whether or not the user is allowed to store under
the key.

src/lib-storage/index/index-attribute.c
src/lib-storage/index/index-storage.h

index a9903256eb008fd48003c98eaa122712709c8dba..0f03e2411ef9294108e1a224c65134c53f4591d2 100644 (file)
@@ -192,7 +192,7 @@ index_storage_attribute_get_dict_trans(struct mailbox_transaction_context *t,
 int index_storage_attribute_set(struct mailbox_transaction_context *t,
                                enum mail_attribute_type type, const char *key,
                                const struct mail_attribute_value *value,
-                               bool internal_attribute)
+                               bool unused ATTR_UNUSED)
 {
        struct dict_transaction_context *dtrans;
        const char *mailbox_prefix;
@@ -200,13 +200,6 @@ int index_storage_attribute_set(struct mailbox_transaction_context *t,
        time_t ts = value->last_change != 0 ? value->last_change : ioloop_time;
        int ret = 0;
 
-       if (!internal_attribute &&
-           !MAILBOX_ATTRIBUTE_KEY_IS_USER_ACCESSIBLE(key)) {
-               mail_storage_set_error(t->box->storage, MAIL_ERROR_PARAMS,
-                       "Internal attributes cannot be changed directly");
-               return -1;
-       }
-
        if (index_storage_attribute_get_dict_trans(t, type, &dtrans,
                                                   &mailbox_prefix) < 0)
                return -1;
@@ -234,7 +227,7 @@ int index_storage_attribute_set(struct mailbox_transaction_context *t,
 int index_storage_attribute_get(struct mailbox *box,
                                enum mail_attribute_type type, const char *key,
                                struct mail_attribute_value *value_r,
-                               bool internal_attribute)
+                               bool unused ATTR_UNUSED)
 {
        struct dict *dict;
        const char *mailbox_prefix, *error;
@@ -242,10 +235,6 @@ int index_storage_attribute_get(struct mailbox *box,
 
        memset(value_r, 0, sizeof(*value_r));
 
-       if (!internal_attribute &&
-           !MAILBOX_ATTRIBUTE_KEY_IS_USER_ACCESSIBLE(key))
-               return 0;
-
        if (index_storage_get_dict(box, type, &dict, &mailbox_prefix) < 0)
                return -1;
 
index 9f5f8662e1e52435601f70d1935edd1e80c49655..0d8388fc51a6256ba5ab0ef7e19e02ed3135cec9 100644 (file)
@@ -114,11 +114,11 @@ int index_mailbox_get_physical_size(struct mailbox *box,
 int index_storage_attribute_set(struct mailbox_transaction_context *t,
                                enum mail_attribute_type type, const char *key,
                                const struct mail_attribute_value *value,
-                               bool internal_attribute);
+                               bool unused);
 int index_storage_attribute_get(struct mailbox *box,
                                enum mail_attribute_type type, const char *key,
                                struct mail_attribute_value *value_r,
-                               bool internal_attribute);
+                               bool unused);
 struct mailbox_attribute_iter *
 index_storage_attribute_iter_init(struct mailbox *box,
                                  enum mail_attribute_type type,