From: Timo Sirainen Date: Tue, 7 Apr 2009 21:57:34 +0000 (-0400) Subject: Shared mailboxes: If selecting prefix/, try to open the user's INBOX. X-Git-Tag: 2.0.alpha1~1011 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b1c42176a65dbe9c83a0af766e6bd8315530f3a5;p=thirdparty%2Fdovecot%2Fcore.git Shared mailboxes: If selecting prefix/, try to open the user's INBOX. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index a4f14682b7..fec0a32315 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -148,12 +148,8 @@ int shared_storage_get_namespace(struct mail_storage *_storage, p = storage->ns_prefix_pattern; for (name = *_name; *p != '\0';) { if (*p != '%') { - if (*p != *name) { - mail_storage_set_critical(_storage, - "Invalid namespace prefix %s vs %s", - storage->ns_prefix_pattern, *_name); - return -1; - } + if (*p != *name) + break; p++; name++; continue; } @@ -175,15 +171,25 @@ int shared_storage_get_namespace(struct mail_storage *_storage, next = strchr(name, *p != '\0' ? *p : _storage->ns->sep); if (next == NULL) { - mail_storage_set_critical(_storage, - "Invalid namespace prefix %s vs %s", - storage->ns_prefix_pattern, *_name); - return -1; + *dest = name; + name = ""; + break; } - *dest = t_strdup_until(name, next); name = next; } + if (*p != '\0') { + if (*name == '\0' || + (name[1] == '\0' && *name == _storage->ns->sep)) { + /* trying to open / mailbox */ + name = "INBOX"; + } else { + mail_storage_set_critical(_storage, + "Invalid namespace prefix %s vs %s", + storage->ns_prefix_pattern, *_name); + return -1; + } + } /* successfully matched the name. */ if (userdomain == NULL) { i_assert(username != NULL);