Skip to content

Commit 621f9e4

Browse files
brongelliefm
authored andcommitted
annotate: don't allow everyone to write shared server entries
1 parent 7c90021 commit 621f9e4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Diff for: imap/annotate.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -2788,27 +2788,27 @@ static int write_entry(struct mailbox *mailbox,
27882788

27892789
keylen = make_key(mboxname, uid, entry, userid, key, sizeof(key));
27902790

2791-
if (mailbox) {
2792-
struct annotate_metadata oldmdata;
2793-
r = read_old_value(d, key, keylen, &oldval, &oldmdata);
2794-
if (r) goto out;
2791+
struct annotate_metadata oldmdata;
2792+
r = read_old_value(d, key, keylen, &oldval, &oldmdata);
2793+
if (r) goto out;
27952794

2796-
/* if the value is identical, don't touch the mailbox */
2797-
if (oldval.len == value->len && (!value->len || !memcmp(oldval.s, value->s, value->len)))
2798-
goto out;
2795+
/* if the value is identical, don't touch the mailbox */
2796+
if (oldval.len == value->len && (!value->len || !memcmp(oldval.s, value->s, value->len)))
2797+
goto out;
2798+
2799+
if (!maywrite) {
2800+
r = IMAP_PERMISSION_DENIED;
2801+
if (r) goto out;
2802+
}
27992803

2804+
if (mailbox) {
28002805
if (!ignorequota) {
28012806
quota_t qdiffs[QUOTA_NUMRESOURCES] = QUOTA_DIFFS_DONTCARE_INITIALIZER;
28022807
qdiffs[QUOTA_ANNOTSTORAGE] = value->len - (quota_t)oldval.len;
28032808
r = mailbox_quota_check(mailbox, qdiffs);
28042809
if (r) goto out;
28052810
}
28062811

2807-
if (!maywrite) {
2808-
r = IMAP_PERMISSION_DENIED;
2809-
if (r) goto out;
2810-
}
2811-
28122812
/* do the annot-changed here before altering the DB */
28132813
mailbox_annot_changed(mailbox, uid, entry, userid, &oldval, value, silent);
28142814

0 commit comments

Comments
 (0)