changeset 12444:1afad049f37f

mbox: Allow mail_privileged_group locking for INBOXes also in inbox=no namespaces.
author Timo Sirainen <tss@iki.fi>
date Thu, 18 Nov 2010 18:56:34 +0000
parents 94c5d2189006
children 9c96b54c8a76
files src/lib-storage/index/mbox/mbox-lock.c src/lib-storage/index/mbox/mbox-storage.c
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/mbox/mbox-lock.c	Thu Nov 18 18:51:34 2010 +0000
+++ b/src/lib-storage/index/mbox/mbox-lock.c	Thu Nov 18 18:56:34 2010 +0000
@@ -348,7 +348,11 @@
 	errmsg = eacces_error_get_creating("file_dotlock_create", path);
 	dir = strrchr(path, '/');
 	dir = dir == NULL ? "." : t_strdup_until(path, dir);
-	if (!mbox->box.inbox_any) {
+	/* allow privileged locking for
+	   a) user's own INBOX,
+	   b) another user's shared INBOX, and
+	   c) anything called INBOX (in inbox=no namespace) */
+	if (!mbox->box.inbox_any && strcmp(mbox->box.name, "INBOX") != 0) {
 		mail_storage_set_critical(&mbox->storage->storage,
 			"%s (not INBOX -> no privileged locking)", errmsg);
 	} else if (!mbox->mbox_privileged_locking) {
--- a/src/lib-storage/index/mbox/mbox-storage.c	Thu Nov 18 18:51:34 2010 +0000
+++ b/src/lib-storage/index/mbox/mbox-storage.c	Thu Nov 18 18:56:34 2010 +0000
@@ -403,7 +403,7 @@
 	}
 	move_to_memory = want_memory_indexes(mbox->storage, box->path);
 
-	if (box->inbox_any) {
+	if (box->inbox_any || strcmp(box->name, "INBOX") == 0) {
 		/* if INBOX isn't under the root directory, it's probably in
 		   /var/mail and we want to allow privileged dotlocking */
 		rootdir = mailbox_list_get_path(box->list, NULL,