From: Timo Sirainen Date: Wed, 20 Mar 2013 16:09:46 +0000 (+0200) Subject: acl: Put ACL files to control dir if storage doesn't have a mail directory. X-Git-Tag: 2.2.rc3~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8d9540a4536e294e69beb3d1f5b378eb06ba8bda;p=thirdparty%2Fdovecot%2Fcore.git acl: Put ACL files to control dir if storage doesn't have a mail directory. --- diff --git a/src/plugins/acl/acl-backend-vfile-acllist.c b/src/plugins/acl/acl-backend-vfile-acllist.c index 0958c44552..6d5f342460 100644 --- a/src/plugins/acl/acl-backend-vfile-acllist.c +++ b/src/plugins/acl/acl-backend-vfile-acllist.c @@ -44,14 +44,17 @@ static bool acl_list_get_root_dir(struct acl_backend_vfile *backend, { struct mail_storage *storage; const char *rootdir, *maildir; + enum mailbox_list_path_type type; - if (!mailbox_list_get_root_path(backend->backend.list, - MAILBOX_LIST_PATH_TYPE_DIR, &rootdir)) + storage = mailbox_list_get_namespace(backend->backend.list)->storage; + type = (storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NO_ROOT) != 0 ? + MAILBOX_LIST_PATH_TYPE_CONTROL : MAILBOX_LIST_PATH_TYPE_DIR; + if (!mailbox_list_get_root_path(backend->backend.list, type, &rootdir)) return FALSE; - *type_r = MAILBOX_LIST_PATH_TYPE_DIR; + *type_r = type; - storage = mailbox_list_get_namespace(backend->backend.list)->storage; - if (mail_storage_is_mailbox_file(storage)) { + if (type == MAILBOX_LIST_PATH_TYPE_DIR && + mail_storage_is_mailbox_file(storage)) { maildir = mailbox_list_get_root_forced(backend->backend.list, MAILBOX_LIST_PATH_TYPE_MAILBOX); if (strcmp(maildir, rootdir) == 0) { diff --git a/src/plugins/acl/acl-backend-vfile.c b/src/plugins/acl/acl-backend-vfile.c index 71675fa3e3..ccf16557fb 100644 --- a/src/plugins/acl/acl-backend-vfile.c +++ b/src/plugins/acl/acl-backend-vfile.c @@ -138,7 +138,11 @@ acl_backend_vfile_get_local_dir(struct acl_backend *backend, const char *name) else if (!mailbox_list_is_valid_name(ns->list, name, &error)) return NULL; - type = mail_storage_is_mailbox_file(ns->storage) ? + /* ACL files are very important. try to keep them among the main + mail files. that's not possible though with a) if the mailbox is + a file or b) if the mailbox path doesn't point to filesystem. */ + type = mail_storage_is_mailbox_file(ns->storage) || + (ns->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NO_ROOT) != 0 ? MAILBOX_LIST_PATH_TYPE_CONTROL : MAILBOX_LIST_PATH_TYPE_MAILBOX; if (name == NULL) { if (!mailbox_list_get_root_path(ns->list, type, &dir))