]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Don't allow IMAP METADATA to access Dovecot's private server attributes.
authorTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 10:40:41 +0000 (13:40 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 10:40:41 +0000 (13:40 +0300)
src/lib-imap-storage/imap-metadata.c

index 5d08bc3919f0fb9f6aab7770355698e1cc86597c..e1386e8fbcc0ae38ee383938b295ab7e9ad668e5 100644 (file)
@@ -100,14 +100,17 @@ imap_metadata_entry2key(struct imap_metadata_transaction *imtrans,
                i_assert((*key_r)[0] == '/');
                *key_r += 1;
        }
+       if (strncmp(*key_r, MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT,
+                   strlen(MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT)) == 0) {
+               /* Dovecot's internal attribute (mailbox or server).
+                  don't allow accessing this. */
+               return FALSE;
+       }
+       /* Add the server-prefix (after checking for the above internal
+          attribute). */
        if (key_prefix != NULL)
                *key_r = t_strconcat(key_prefix, *key_r, NULL);
-
-       /* skip over dovecot's internal attributes. (server metadata is handled
-          inside the private metadata.) */
-       return (imtrans->server ||
-               strncmp(*key_r, MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT,
-                   strlen(MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT)) != 0);
+       return TRUE;
 }
 
 static int