dovecot-1.2: Fix to IMAP LIST pattern matching.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Mar 26 02:38:52 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/8cedfefc98e0
changeset: 8869:8cedfefc98e0
user: Timo Sirainen <tss at iki.fi>
date: Wed Mar 25 20:27:02 2009 -0400
description:
Fix to IMAP LIST pattern matching.
diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
src/lib-imap/imap-match.c | 8 +++++++-
src/tests/test-imap.c | 2 +-
diffs (30 lines):
diff -r 39f1644ed150 -r 8cedfefc98e0 src/lib-imap/imap-match.c
--- a/src/lib-imap/imap-match.c Wed Mar 25 19:43:39 2009 -0400
+++ b/src/lib-imap/imap-match.c Wed Mar 25 20:27:02 2009 -0400
@@ -207,7 +207,13 @@ match_sub(struct imap_match_context *ctx
data += i;
pattern += i;
- match = IMAP_MATCH_NO;
+ if (*data == '\0' && *data_p != data && data[-1] == ctx->sep &&
+ *pattern != '\0') {
+ /* data="/" pattern="/%..." */
+ match = IMAP_MATCH_CHILDREN;
+ } else {
+ match = IMAP_MATCH_NO;
+ }
while (*pattern == '%') {
pattern++;
diff -r 39f1644ed150 -r 8cedfefc98e0 src/tests/test-imap.c
--- a/src/tests/test-imap.c Wed Mar 25 19:43:39 2009 -0400
+++ b/src/tests/test-imap.c Wed Mar 25 20:27:02 2009 -0400
@@ -37,7 +37,7 @@ static void test_imap_match(void)
{ "foo*bar", "foobar/baz", IMAP_MATCH_CHILDREN | IMAP_MATCH_PARENT },
{ "*foo*", "fobo", IMAP_MATCH_CHILDREN },
{ "%/%/%", "foo/", IMAP_MATCH_CHILDREN },
- { "%/%o/%", "foo/", IMAP_MATCH_NO },
+ { "%/%o/%", "foo/", IMAP_MATCH_CHILDREN },
{ "%/%o/%", "foo", IMAP_MATCH_CHILDREN },
{ "inbox", "inbox", IMAP_MATCH_YES },
{ "inbox", "INBOX", IMAP_MATCH_NO }
More information about the dovecot-cvs
mailing list