From 12b28e57e09c11d456098e2b15c444a1f5a7e002 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Fri, 7 Aug 2009 23:04:06 +0200
Subject: [PATCH] Made attempt to store in a namespace prefix fall back into
 INBOX.

---
 src/lib-sieve/sieve-actions.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/lib-sieve/sieve-actions.c b/src/lib-sieve/sieve-actions.c
index 45adce4a5..839478bda 100644
--- a/src/lib-sieve/sieve-actions.c
+++ b/src/lib-sieve/sieve-actions.c
@@ -186,7 +186,7 @@ static void act_store_get_storage_error
 }
 
 static struct mailbox *act_store_mailbox_open
-(const struct sieve_action_exec_env *aenv, const char *folder,
+(const struct sieve_action_exec_env *aenv, const char *name,
 	struct mail_namespace **ns_r)
 {
 	struct mail_storage **storage = &(aenv->exec_status->last_storage);
@@ -195,6 +195,7 @@ static struct mailbox *act_store_mailbox_open
 		MAILBOX_FLAG_POST_SESSION;
 	struct mailbox *box;
 	enum mail_error error;
+	const char *folder = name;
 
 	if (strcasecmp(folder, "INBOX") == 0) {
 		/* Deliveries to INBOX must always succeed, regardless of ACLs */
@@ -212,6 +213,13 @@ static struct mailbox *act_store_mailbox_open
 		 * deliver to the INBOX instead
 		 */
 		folder = "INBOX";
+		flags |= MAILBOX_FLAG_IGNORE_ACLS;
+
+		*ns_r = mail_namespace_find(aenv->scriptenv->namespaces, &folder);
+    	if ( *ns_r == NULL) {
+        	*storage = NULL;
+	        return NULL;
+    	}
 	}
 
 	/* First attempt at opening the box */
-- 
GitLab