]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Allow MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT to use get=NULL
authorTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 13:23:40 +0000 (16:23 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 13:23:40 +0000 (16:23 +0300)
This is useful for registering internal attributes whose only purpose is to
be able to set/get them via dict. (Because normally the dict access would be
denied completely.)

src/lib-storage/mailbox-attribute.c

index c5252ada87d3f21c1b3e807f8b2b6b0d0818ce37..cd1547d13fef5258adfba194d477f5edf739f2cf 100644 (file)
@@ -282,8 +282,12 @@ mailbox_attribute_get_common(struct mailbox_transaction_context *t,
        if (iattr != NULL) {
                switch (iattr->rank) {
                case MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT:              
-                       if ((ret = iattr->get(t, key, value_r)) < 0)
-                               return ret;
+                       if (iattr->get == NULL)
+                               ret = 0;
+                       else {
+                               if ((ret = iattr->get(t, key, value_r)) < 0)
+                                       return ret;
+                       }
                        if (ret > 0) {
                                value_r->flags |= MAIL_ATTRIBUTE_VALUE_FLAG_READONLY;
                                return 1;