From: Timo Sirainen Date: Sun, 11 Jul 2010 18:42:48 +0000 (+0100) Subject: layout=fs: Fixed checking if pattern was valid with hierarchy separator wasn't the... X-Git-Tag: 2.0.rc3~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c62211dc9ada8c473b992a8057baef9c3a2dedfb;p=thirdparty%2Fdovecot%2Fcore.git 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. --- diff --git a/src/lib-storage/list/mailbox-list-fs-iter.c b/src/lib-storage/list/mailbox-list-fs-iter.c index 1ca56b7664..e87867fefe 100644 --- a/src/lib-storage/list/mailbox-list-fs-iter.c +++ b/src/lib-storage/list/mailbox-list-fs-iter.c @@ -212,7 +212,7 @@ fs_list_iter_init(struct mailbox_list *_list, const char *const *patterns, 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 @@ fs_list_iter_init(struct mailbox_list *_list, const char *const *patterns, 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;