dovecot-1.2: acl: Don't try to create dovecot-acl-list file for ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 3 02:09:39 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/703214a10642
changeset: 8901:703214a10642
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 02 19:09:32 2009 -0400
description:
acl: Don't try to create dovecot-acl-list file for unknown users' auto-created namespaces.

diffstat:

3 files changed, 12 insertions(+), 3 deletions(-)
src/lib-storage/index/shared/shared-storage.c |    4 +++-
src/lib-storage/mail-namespace.h              |    4 +++-
src/plugins/acl/acl-backend-vfile-acllist.c   |    7 ++++++-

diffs (53 lines):

diff -r 87c23fa4278e -r 703214a10642 src/lib-storage/index/shared/shared-storage.c
--- 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 @@ int shared_storage_get_namespace(struct 
 	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",
diff -r 87c23fa4278e -r 703214a10642 src/lib-storage/mail-namespace.h
--- 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 @@ enum namespace_flags {
 	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 {
diff -r 87c23fa4278e -r 703214a10642 src/plugins/acl/acl-backend-vfile-acllist.c
--- 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 @@ int acl_backend_vfile_acllist_rebuild(st
 	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 @@ int acl_backend_vfile_acllist_rebuild(st
 
 	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 |


More information about the dovecot-cvs mailing list