diff src/lib-storage/index/shared/shared-storage.c @ 8956:9619fbd698d5 HEAD

shared mailboxes: Don't assert-crash if trying to look up "" user's mailboxes.
author Timo Sirainen <tss@iki.fi>
date Thu, 16 Apr 2009 19:48:10 -0400
parents 3a30d73fc463
children 0dcb7e34a216
line wrap: on
line diff
--- a/src/lib-storage/index/shared/shared-storage.c	Thu Apr 16 19:11:32 2009 -0400
+++ b/src/lib-storage/index/shared/shared-storage.c	Thu Apr 16 19:48:10 2009 -0400
@@ -190,6 +190,7 @@
 			return -1;
 		}
 	}
+
 	/* successfully matched the name. */
 	if (userdomain == NULL) {
 		i_assert(username != NULL);
@@ -204,6 +205,11 @@
 			domain++;
 		}
 	}
+	if (*userdomain == '\0') {
+		mail_storage_set_error(_storage, MAIL_ERROR_PARAMS,
+				       "Empty username doesn't exist");
+		return -1;
+	}
 
 	/* expand the namespace prefix and see if it already exists.
 	   this should normally happen only when the mailbox is being opened */