dovecot-2.0: layout=fs: Fixed checking if pattern was valid with...

dovecot at dovecot.org dovecot at dovecot.org
Sun Jul 11 21:42:52 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/fec7013c628b
changeset: 11791:fec7013c628b
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jul 11 19:42:48 2010 +0100
description:
layout=fs: Fixed checking if pattern was valid with hierarchy separator wasn't the default '/'
For example if separator was ';', which the code internally converted to '/',
it would have been possible to try to list e.g. ";*", which could have been
translated to "/*". Luckily this wasn't actually working, but it could have
caused other broken replies and possibly some problems with ACL plugin.

diffstat:

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

diffs (25 lines):

diff -r b25a30644e68 -r fec7013c628b src/lib-storage/list/mailbox-list-fs-iter.c
--- a/src/lib-storage/list/mailbox-list-fs-iter.c	Sun Jul 11 19:32:28 2010 +0100
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c	Sun Jul 11 19:42:48 2010 +0100
@@ -212,7 +212,7 @@
 		  enum mailbox_list_iter_flags flags)
 {
 	struct fs_list_iterate_context *ctx;
-	const char *path, *vpath, *rootdir, *test_pattern;
+	const char *path, *vpath, *rootdir, *test_pattern, *real_pattern;
 	char *pattern;
 	DIR *dirp;
 	unsigned int prefix_len;
@@ -236,7 +236,11 @@
 		   validation. */
 		if (strncmp(test_pattern, _list->ns->prefix, prefix_len) == 0)
 			test_pattern += prefix_len;
-		if (mailbox_list_is_valid_pattern(_list, test_pattern)) {
+		/* check pattern also when it's converted to use real
+		   separators. */
+		real_pattern = mail_namespace_fix_sep(_list->ns, test_pattern);
+		if (mailbox_list_is_valid_pattern(_list, test_pattern) &&
+		    mailbox_list_is_valid_pattern(_list, real_pattern)) {
 			if (strcasecmp(*patterns, "INBOX") == 0) {
 				ctx->inbox_match = TRUE;
 				continue;


More information about the dovecot-cvs mailing list