]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mbox: Allow mail_privileged_group locking for INBOXes also in inbox=no namespaces.
authorTimo Sirainen <tss@iki.fi>
Thu, 18 Nov 2010 18:56:34 +0000 (18:56 +0000)
committerTimo Sirainen <tss@iki.fi>
Thu, 18 Nov 2010 18:56:34 +0000 (18:56 +0000)
src/lib-storage/index/mbox/mbox-lock.c
src/lib-storage/index/mbox/mbox-storage.c

index d65513cf70b712e8174a8c4f011b84fd7e95ee31..ac020ec66e28d72c8f601997d95ab859e5531e38 100644 (file)
@@ -348,7 +348,11 @@ mbox_dotlock_log_eacces_error(struct mbox_mailbox *mbox, const char *path)
        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) {
index 5713a01b65f53840aec7c6962d119eee558e8eb0..00192e206a8cd66bf037e8843c0a47fba11ce06b 100644 (file)
@@ -403,7 +403,7 @@ static int mbox_mailbox_open_existing(struct mbox_mailbox *mbox)
        }
        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,