dovecot-2.2: acl: Put ACL files to control dir if storage doesn'...

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 20 18:09:55 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/abd9763e91d1
changeset: 16062:abd9763e91d1
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Mar 20 18:09:46 2013 +0200
description:
acl: Put ACL files to control dir if storage doesn't have a mail directory.

diffstat:

 src/plugins/acl/acl-backend-vfile-acllist.c |  15 +++++++++------
 src/plugins/acl/acl-backend-vfile.c         |   6 +++++-
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r c742a7bf48a6 -r abd9763e91d1 src/plugins/acl/acl-backend-vfile-acllist.c
--- a/src/plugins/acl/acl-backend-vfile-acllist.c	Wed Mar 20 17:59:32 2013 +0200
+++ b/src/plugins/acl/acl-backend-vfile-acllist.c	Wed Mar 20 18:09:46 2013 +0200
@@ -44,14 +44,17 @@
 {
 	struct mail_storage *storage;
 	const char *rootdir, *maildir;
-
-	if (!mailbox_list_get_root_path(backend->backend.list,
-					MAILBOX_LIST_PATH_TYPE_DIR, &rootdir))
-		return FALSE;
-	*type_r = MAILBOX_LIST_PATH_TYPE_DIR;
+	enum mailbox_list_path_type type;
 
 	storage = mailbox_list_get_namespace(backend->backend.list)->storage;
-	if (mail_storage_is_mailbox_file(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 = type;
+
+	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 -r c742a7bf48a6 -r abd9763e91d1 src/plugins/acl/acl-backend-vfile.c
--- a/src/plugins/acl/acl-backend-vfile.c	Wed Mar 20 17:59:32 2013 +0200
+++ b/src/plugins/acl/acl-backend-vfile.c	Wed Mar 20 18:09:46 2013 +0200
@@ -138,7 +138,11 @@
 	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))


More information about the dovecot-cvs mailing list