dovecot-1.2: Shared mailboxes: If selecting prefix/<username>, t...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 8 01:02:03 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/3a30d73fc463
changeset: 8928:3a30d73fc463
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Apr 07 17:57:34 2009 -0400
description:
Shared mailboxes: If selecting prefix/<username>, try to open the user's INBOX.

diffstat:

1 file changed, 18 insertions(+), 12 deletions(-)
src/lib-storage/index/shared/shared-storage.c |   30 +++++++++++++++----------

diffs (49 lines):

diff -r 7d484e0f0789 -r 3a30d73fc463 src/lib-storage/index/shared/shared-storage.c
--- a/src/lib-storage/index/shared/shared-storage.c	Tue Apr 07 17:54:32 2009 -0400
+++ b/src/lib-storage/index/shared/shared-storage.c	Tue Apr 07 17:57:34 2009 -0400
@@ -148,12 +148,8 @@ int shared_storage_get_namespace(struct 
 	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,14 +171,24 @@ int shared_storage_get_namespace(struct 
 
 		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 <prefix>/<user> 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) {


More information about the dovecot-cvs mailing list