]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix subscription refresh when it autocreates a namespace
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 11 Sep 2025 18:37:38 +0000 (21:37 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 30 Sep 2025 05:48:46 +0000 (05:48 +0000)
If there's a shared/user/foo subscription, it might create shared/user/
namespace. In that case the subscription should go to shared/user/
namespace, not shared/.

src/lib-storage/list/mailbox-list-subscriptions.c

index 31e137d7bcb6878ab1dea14cc246198275e57633..272d764ad241acb0189bc19a223beb7a89c7293a 100644 (file)
@@ -66,6 +66,12 @@ mailbox_list_subscription_fill_one(struct mailbox_list *list,
                   one easy way is to just ask to join a reference and
                   pattern */
                (void)mailbox_list_join_refpattern(ns->list, ns_name, "");
+               /* If the namespace changes to the newly created one, start
+                  the lookup all over again. */
+               struct mail_namespace *ns2 =
+                       mail_namespace_find_unsubscribable(namespaces, ns_name);
+               if (ns != ns2)
+                       return mailbox_list_subscription_fill_one(list, src_list, name);
        }
 
        /* When listing pub/ namespace, skip over the namespace