dovecot-2.1: imap: Convert LIST/LSUB patterns from mUTF-7 to UTF...

dovecot at dovecot.org dovecot at dovecot.org
Mon Dec 12 06:48:58 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/b9fcac239aed
changeset: 13849:b9fcac239aed
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Dec 12 06:48:44 2011 +0200
description:
imap: Convert LIST/LSUB patterns from mUTF-7 to UTF-8 for internal representation.

diffstat:

 src/imap/cmd-list.c |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (43 lines):

diff -r 9352c4ccb1f9 -r b9fcac239aed src/imap/cmd-list.c
--- a/src/imap/cmd-list.c	Mon Dec 12 06:36:31 2011 +0200
+++ b/src/imap/cmd-list.c	Mon Dec 12 06:48:44 2011 +0200
@@ -889,9 +889,10 @@
 	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;
 
 	/* [(<selection options>)] <reference> <pattern>|(<pattern list>)
 	   [RETURN (<return options>)] */
@@ -917,6 +918,7 @@
 		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 @@
 					"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 @@
 			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);


More information about the dovecot-cvs mailing list