From: Timo Sirainen Date: Mon, 7 Sep 2015 13:23:40 +0000 (+0300) Subject: lib-storage: Allow MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT to use get=NULL X-Git-Tag: 2.2.19.rc1~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8f12bf524412d1ca2e60cc694a2b9487ed206d1;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Allow MAIL_ATTRIBUTE_INTERNAL_RANK_DEFAULT to use get=NULL 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.) --- diff --git a/src/lib-storage/mailbox-attribute.c b/src/lib-storage/mailbox-attribute.c index c5252ada87..cd1547d13f 100644 --- a/src/lib-storage/mailbox-attribute.c +++ b/src/lib-storage/mailbox-attribute.c @@ -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;