dovecot-2.1: lib-storage: Fixed listing layout=fs when namespace...

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 26 13:06:13 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/22875bcaa952
changeset: 14789:22875bcaa952
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 26 13:05:43 2012 +0300
description:
lib-storage: Fixed listing layout=fs when namespace prefix part included wildcards.

diffstat:

 src/lib-storage/list/mailbox-list-fs-iter.c |  23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r b1b693a69c5f -r 22875bcaa952 src/lib-storage/list/mailbox-list-fs-iter.c
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Fri Oct 26 12:09:03 2012 +0300
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Fri Oct 26 13:05:43 2012 +0300
@@ -395,13 +395,24 @@
 	for (patterns = ctx->valid_patterns; *patterns != NULL; patterns++) {
 		pattern = *patterns;
 
-		for (p = last = pattern; *p != '\0'; p++) {
-			if (*p == '%' || *p == '*')
-				break;
-			if (*p == ns_sep)
-				last = p;
+		if (strncmp(pattern, ns->prefix, ns->prefix_len) != 0) {
+			/* typically e.g. prefix=foo/bar/, pattern=foo/%/%
+			   we'll use root="" for this.
+
+			   it might of course also be pattern=foo/%/prefix/%
+			   where we could optimize with root=prefix, but
+			   probably too much trouble to implement. */
+			prefix_vname = "";
+			p = last = pattern;
+		} else {
+			for (p = last = pattern; *p != '\0'; p++) {
+				if (*p == '%' || *p == '*')
+					break;
+				if (*p == ns_sep)
+					last = p;
+			}
+			prefix_vname = t_strdup_until(pattern, last);
 		}
-		prefix_vname = t_strdup_until(pattern, last);
 
 		if (p == last+1 && *pattern == ns_sep)
 			root = "/";


More information about the dovecot-cvs mailing list