Mercurial > dovecot > core-2.2
changeset 22296:0dd7baafb46e
lib-storage: mailbox_list_get_permissions() - Use index dir for storage without mails
The index dir might still exist.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 26 Jun 2017 18:46:30 +0300 |
parents | cebd11880aea |
children | 08851deea49c |
files | src/lib-storage/mailbox-list.c |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mailbox-list.c Mon Jun 26 18:41:27 2017 +0300 +++ b/src/lib-storage/mailbox-list.c Mon Jun 26 18:46:30 2017 +0300 @@ -955,7 +955,7 @@ const char *name, struct mailbox_permissions *permissions_r) { - const char *path, *parent_name, *p; + const char *path = NULL, *parent_name, *p; i_zero(permissions_r); @@ -967,18 +967,23 @@ permissions_r->file_create_gid = (gid_t)-1; permissions_r->file_create_gid_origin = "defaults"; - if (name != NULL) { + if ((list->flags & MAILBOX_LIST_FLAG_NO_MAIL_FILES) != 0) { + /* mail files don't exist in storage, but index files might. */ + (void)mailbox_list_get_path(list, name, + MAILBOX_LIST_PATH_TYPE_INDEX, &path); + } + + if (name != NULL && path == NULL) { if (mailbox_list_get_path(list, name, MAILBOX_LIST_PATH_TYPE_DIR, &path) < 0) name = NULL; } - if (name == NULL) { + if (name == NULL && path == NULL) { (void)mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_DIR, &path); } - if (path == NULL || - (list->flags & MAILBOX_LIST_FLAG_NO_MAIL_FILES) != 0) { + if (path == NULL) { /* no filesystem support in storage */ } else if (mailbox_list_get_permissions_stat(list, path, permissions_r)) { /* got permissions from the given path */