]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
acl: Put ACL files to control dir if storage doesn't have a mail directory.
authorTimo Sirainen <tss@iki.fi>
Wed, 20 Mar 2013 16:09:46 +0000 (18:09 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 20 Mar 2013 16:09:46 +0000 (18:09 +0200)
src/plugins/acl/acl-backend-vfile-acllist.c
src/plugins/acl/acl-backend-vfile.c

index 0958c44552e86eb58151912309ecafb055a5ac16..6d5f3424608d81952d2d8f7b08cabf0b956d8213 100644 (file)
@@ -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) {
index 71675fa3e399ddfce943a6fce424469cd2121f7b..ccf16557fb4072d3992a795c862209c35a32ec31 100644 (file)
@@ -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))