changeset 7270:c6afa177bbf1 HEAD

Don't crash if trying to deliver mail to mailbox outside all namespaces.
author Timo Sirainen <tss@iki.fi>
date Wed, 20 Feb 2008 20:39:07 +0200
parents af415b88ba1d
children 4ac4e9ba1124
files src/deliver/deliver.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/deliver/deliver.c	Wed Feb 20 20:02:37 2008 +0200
+++ b/src/deliver/deliver.c	Wed Feb 20 20:39:07 2008 +0200
@@ -199,6 +199,12 @@
 	mailbox_name = str_sanitize(mailbox, 80);
 	box = mailbox_open_or_create_synced(namespaces, storage_r, mailbox);
 	if (box == NULL) {
+		if (*storage_r == NULL) {
+			deliver_log(mail,
+				    "save failed to %s: Unknown namespace",
+				    mailbox_name);
+			return -1;
+		}
 		deliver_log(mail, "save failed to %s: %s", mailbox_name,
 			    mail_storage_get_last_error(*storage_r, &error));
 		return -1;