changeset 8901:703214a10642 HEAD

acl: Don't try to create dovecot-acl-list file for unknown users' auto-created namespaces.
author Timo Sirainen <tss@iki.fi>
date Thu, 02 Apr 2009 19:09:32 -0400
parents 87c23fa4278e
children 5ce33cfc568f
files src/lib-storage/index/shared/shared-storage.c src/lib-storage/mail-namespace.h src/plugins/acl/acl-backend-vfile-acllist.c
diffstat 3 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/shared/shared-storage.c	Thu Apr 02 19:08:50 2009 -0400
+++ b/src/lib-storage/index/shared/shared-storage.c	Thu Apr 02 19:09:32 2009 -0400
@@ -234,8 +234,10 @@
 	location = t_str_new(256);
 	if (ret > 0)
 		var_expand(location, storage->location, tab);
-	else
+	else {
 		get_nonexisting_user_location(storage, userdomain, location);
+		ns->flags |= NAMESPACE_FLAG_UNUSABLE;
+	}
 	if (mail_storage_create(ns, NULL, str_c(location), _storage->flags,
 				_storage->lock_method, &error) < 0) {
 		mail_storage_set_critical(_storage, "Namespace '%s': %s",
--- a/src/lib-storage/mail-namespace.h	Thu Apr 02 19:08:50 2009 -0400
+++ b/src/lib-storage/mail-namespace.h	Thu Apr 02 19:09:32 2009 -0400
@@ -27,7 +27,9 @@
 	NAMESPACE_FLAG_AUTOCREATED	= 0x2000,
 	/* Namespace has at least some usable mailboxes. Autocreated namespaces
 	   that don't have usable mailboxes may be removed automatically. */
-	NAMESPACE_FLAG_USABLE		= 0x4000
+	NAMESPACE_FLAG_USABLE		= 0x4000,
+	/* Automatically created namespace for a user that doesn't exist. */
+	NAMESPACE_FLAG_UNUSABLE		= 0x8000
 };
 
 struct mail_namespace {
--- a/src/plugins/acl/acl-backend-vfile-acllist.c	Thu Apr 02 19:08:50 2009 -0400
+++ b/src/plugins/acl/acl-backend-vfile-acllist.c	Thu Apr 02 19:09:32 2009 -0400
@@ -185,6 +185,12 @@
 	if (rootdir == NULL)
 		return 0;
 
+	ns = mailbox_list_get_namespace(list);
+	if ((ns->flags & NAMESPACE_FLAG_UNUSABLE) != 0) {
+		/* we can't write anything here */
+		return 0;
+	}
+
 	path = t_str_new(256);
 	str_printfa(path, "%s/%s", rootdir, mailbox_list_get_temp_prefix(list));
 
@@ -206,7 +212,6 @@
 
 	ret = 0;
 	acllist_clear(backend, 0);
-	ns = mailbox_list_get_namespace(list);
 
 	backend->rebuilding_acllist = TRUE;
 	iter = mailbox_list_iter_init(list, "*", MAILBOX_LIST_ITER_RAW_LIST |