From: Timo Sirainen Date: Mon, 12 Dec 2011 04:48:44 +0000 (+0200) Subject: imap: Convert LIST/LSUB patterns from mUTF-7 to UTF-8 for internal representation. X-Git-Tag: 2.1.rc2~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec82a9ba81e4dae822694eb58da44753fd58a384;p=thirdparty%2Fdovecot%2Fcore.git imap: Convert LIST/LSUB patterns from mUTF-7 to UTF-8 for internal representation. --- diff --git a/src/imap/cmd-list.c b/src/imap/cmd-list.c index 2ea786f226..987e45b643 100644 --- a/src/imap/cmd-list.c +++ b/src/imap/cmd-list.c @@ -889,9 +889,10 @@ bool cmd_list_full(struct client_command_context *cmd, bool lsub) struct client *client = cmd->client; const struct imap_arg *args, *list_args; unsigned int arg_count; - struct cmd_list_context *ctx; + struct cmd_list_context *ctx; ARRAY_DEFINE(patterns, const char *) = ARRAY_INIT; const char *pattern, *const *patterns_strarr; + string_t *str; /* [()] |() [RETURN ()] */ @@ -917,6 +918,7 @@ bool cmd_list_full(struct client_command_context *cmd, bool lsub) client_send_command_error(cmd, "Invalid reference."); return TRUE; } + str = t_str_new(64); if (imap_arg_get_list_full(&args[1], &list_args, &arg_count)) { ctx->used_listext = TRUE; /* convert pattern list to string array */ @@ -927,7 +929,10 @@ bool cmd_list_full(struct client_command_context *cmd, bool lsub) "Invalid pattern list."); return TRUE; } + if (imap_utf7_to_utf8(pattern, str) == 0) + pattern = t_strdup(str_c(str)); array_append(&patterns, &pattern, 1); + str_truncate(str, 0); } args += 2; } else { @@ -935,6 +940,8 @@ bool cmd_list_full(struct client_command_context *cmd, bool lsub) client_send_command_error(cmd, "Invalid pattern."); return TRUE; } + if (imap_utf7_to_utf8(pattern, str) == 0) + pattern = str_c(str); p_array_init(&patterns, cmd->pool, 1); array_append(&patterns, &pattern, 1);