]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Fix using global mailbox settings
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 14 Aug 2024 20:15:13 +0000 (23:15 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:13 +0000 (12:34 +0200)
Previously mailbox settings had to be inside namespace for the settings to
work.

src/lib-storage/mail-namespace.c

index e5218344be825e2937b32b14eed572bc4823b626..e7244e9978295f90c89e37eeb9266b33d9f1f635 100644 (file)
@@ -504,19 +504,23 @@ mail_namespaces_init_location_full(struct mail_user *user,
                                   const char *override_mail_path,
                                   const char **error_r)
 {
-       struct mail_namespace_settings *inbox_set;
+       const struct mail_namespace_settings *inbox_set;
+       struct mail_namespace_settings *inbox_set_copy;
        struct mail_namespace *ns;
        struct mail_storage *storage;
        int ret;
 
-       inbox_set = p_new(user->pool, struct mail_namespace_settings, 1);
-       *inbox_set = mail_namespace_default_settings;
-       inbox_set->inbox = TRUE;
-       /* enums must be changed */
-       inbox_set->type = "private";
-       inbox_set->list = "yes";
+       /* Use the global namespace settings, except change inbox=yes */
+       if (settings_get(user->event, &mail_namespace_setting_parser_info, 0,
+                        &inbox_set, error_r) < 0)
+               return -1;
+       inbox_set_copy = p_memdup(inbox_set->pool, inbox_set,
+                                 sizeof(*inbox_set));
+       inbox_set_copy->inbox = TRUE;
 
-       if ((ret = mail_namespace_alloc(user, inbox_set, &ns, error_r)) < 0)
+       ret = mail_namespace_alloc(user, inbox_set_copy, &ns, error_r);
+       settings_free(inbox_set);
+       if (ret < 0)
                return ret;
 
        if (override_mail_driver[0] != '\0' || override_mail_path[0] != '\0') {