]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Return correct root path for PATH_TYPE_ALT_MAILBOX
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Fri, 11 May 2018 14:50:16 +0000 (10:50 -0400)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 15 May 2018 11:01:51 +0000 (11:01 +0000)
mailbox_list_set_get_root_path(..., MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX, ...)
must return one of three values:

1. if there is no alt storage, return NULL
2. if there is alt storage and MAILBOXDIR is set,
return ${alt_dir}/${mailbox_dir_name}
3. if there is alt storage but MAILBOXDIR is not set, return ${alt_dir}

Case number 3 was broken, and it mistakenly returned ${root_dir} - in other
words, it behaved as MAILBOX_LIST_PATH_TYPE_MAILBOX.

This correction changes the behavior, but this shouldn't cause
incompatibilities since:

1. it affects only storages that support alternate storage
2. it affects only configurations that use empty MAILBOXDIR

The only storage that supports alternate storage setting is dbox but dbox
defaults to MAILBOXDIR=mailboxes.  Additionally, it appears to be impossible
to override it to an empty string (setting it to an empty strings causes
dbox to override it with the default - "mailboxes").  Therefore, nobody
should be affected by this change.

src/lib-storage/mailbox-list.c

index 2960d97dab35e601ba1de5b45d4b41a0c30096f5..04336c66789859ef0666e452b6855bbebad1f44c 100644 (file)
@@ -1442,7 +1442,7 @@ bool mailbox_list_set_get_root_path(const struct mailbox_list_settings *set,
                break;
        case MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX:
                if (*set->mailbox_dir_name == '\0')
-                       path = set->root_dir;
+                       path = set->alt_dir;
                else if (set->alt_dir != NULL) {
                        path = t_strconcat(set->alt_dir, "/",
                                           set->mailbox_dir_name, NULL);