changeset 15277:a6b21ce8652d

lib-storage: Handle better when attempting to access shared mailboxes for nonexistent users.
author Timo Sirainen <tss@iki.fi>
date Mon, 29 Oct 2012 15:30:59 +0200
parents 5d465a3eceb2
children 12cd194553a8
files src/lib-storage/index/shared/shared-storage.c
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/shared/shared-storage.c	Mon Oct 29 15:29:52 2012 +0200
+++ b/src/lib-storage/index/shared/shared-storage.c	Mon Oct 29 15:30:59 2012 +0200
@@ -257,15 +257,17 @@
 				user->unexpanded_set);
 	owner->autocreated = TRUE;
 	if (mail_user_init(owner, &error) < 0) {
-		mailbox_list_set_critical(list,
-			"Couldn't create namespace '%s' for user %s: %s",
-			ns->prefix, userdomain, error);
-		mail_user_unref(&owner);
-		return -1;
-	}
-	if (!var_has_key(storage->location, 'h', "home"))
+		if (!owner->nonexistent) {
+			mailbox_list_set_critical(list,
+				"Couldn't create namespace '%s' for user %s: %s",
+				ns->prefix, userdomain, error);
+			mail_user_unref(&owner);
+			return -1;
+		}
+		ret = 0;
+	} else if (!var_has_key(storage->location, 'h', "home")) {
 		ret = 1;
-	else {
+	} else {
 		/* we'll need to look up the user's home directory */
 		if ((ret = mail_user_get_home(owner, &tab[3].value)) < 0) {
 			mailbox_list_set_critical(list, "Namespace '%s': "