changeset 9591:aae3b2a12cd0 HEAD

acl: Don't use INBOX's ACLs as default ACLs if their paths are the same.
author Timo Sirainen <tss@iki.fi>
date Fri, 23 Jul 2010 21:04:17 +0100
parents f8c14abf52b4
children b386f997c5c5
files src/plugins/acl/acl-backend-vfile.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/acl/acl-backend-vfile.c	Wed Jul 14 13:53:34 2010 +0100
+++ b/src/plugins/acl/acl-backend-vfile.c	Fri Jul 23 21:04:17 2010 +0100
@@ -125,7 +125,7 @@
 static const char *
 acl_backend_vfile_get_local_dir(struct mail_storage *storage, const char *name)
 {
-	const char *dir;
+	const char *dir, *inbox;
 	bool is_file;
 
 	dir = mail_storage_get_mailbox_path(storage, name, &is_file);
@@ -133,6 +133,16 @@
 		dir = mailbox_list_get_path(storage->list, name,
 					    MAILBOX_LIST_PATH_TYPE_CONTROL);
 	}
+	if (*name == '\0') {
+		/* verify that the directory isn't same as INBOX's directory.
+		   this is mainly for Maildir. */
+		inbox = mailbox_list_get_path(storage->list, "INBOX",
+					      MAILBOX_LIST_PATH_TYPE_MAILBOX);
+		if (strcmp(inbox, dir) == 0) {
+			/* can't have default ACLs with this setup */
+			return NULL;
+		}
+	}
 	return dir;
 }