]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Make sure shared INBOX mailbox is always uppercased
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 22 Oct 2025 09:09:46 +0000 (12:09 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 22 Oct 2025 11:33:04 +0000 (11:33 +0000)
This fixes issues where if shared/user/INBOX was accessed without
uppercasing the INBOX, it wasn't handled consistently.

src/lib-storage/mail-storage.c

index 03a1824d5569b5c4787cc7782ff6cb4611a8ff7b..313854cdea1ebe89c9328c02ff9d450184da2356 100644 (file)
@@ -1146,6 +1146,21 @@ struct mailbox *mailbox_alloc(struct mailbox_list *list, const char *vname,
                        errstr = t_strdup(errstr);
                }
 
+               if ((new_list->ns->flags & NAMESPACE_FLAG_INBOX_ANY) != 0 &&
+                   str_begins(vname, new_list->ns->prefix, &suffix) &&
+                   strcasecmp(suffix, "INBOX") == 0 &&
+                   strcmp(suffix, "INBOX") != 0) {
+                       /* Accessing INBOX explicitly in a shared namespace -
+                          convert to uppercase. This is done regardless of the
+                          mail_shared_explicit_inbox setting, since even with
+                          "no" adding INBOX to the namespace prefix accesses
+                          the same INBOX. When accessing the shared INBOX
+                          as the namespace prefix, the uppercase INBOX is
+                          appended when getting the storage_name in mailbox
+                          list code. */
+                       vname = t_strconcat(new_list->ns->prefix, "INBOX", NULL);
+               }
+
                box = storage->v.mailbox_alloc(storage, new_list, vname, flags);
                if (open_error != 0) {
                        box->open_error = open_error;