dovecot-2.2: imap: Fixed more URL escaping in URLFETCH replies.

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 25 13:55:51 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/0634cf4acf8d
changeset: 16108:0634cf4acf8d
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 25 13:55:41 2013 +0200
description:
imap: Fixed more URL escaping in URLFETCH replies.

diffstat:

 src/imap/cmd-urlfetch.c |  20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diffs (50 lines):

diff -r 33e78edac8f5 -r 0634cf4acf8d src/imap/cmd-urlfetch.c
--- a/src/imap/cmd-urlfetch.c	Sun Mar 24 19:04:15 2013 +0200
+++ b/src/imap/cmd-urlfetch.c	Mon Mar 25 13:55:41 2013 +0200
@@ -167,25 +167,25 @@
 				   struct imap_urlauth_fetch_reply *reply)
 {
 	struct cmd_urlfetch_context *ctx = cmd->context;
+	string_t *response = t_str_new(256);
 	int ret;
 
+	str_append(response, "* URLFETCH ");
+	imap_append_astring(response, reply->url);
+
 	if ((reply->flags & IMAP_URLAUTH_FETCH_FLAG_EXTENDED) == 0) {
 		/* simple */
 		ctx->extended = FALSE;
 
-		client_send_line(cmd->client, t_strdup_printf(
-			"* URLFETCH %s {%"PRIuUOFF_T"}",
-			reply->url, reply->size));
+		str_printfa(response, " {%"PRIuUOFF_T"}", reply->size);
+		client_send_line(cmd->client, str_c(response));
 		i_assert(reply->size == 0 || reply->input != NULL);
 	} else {
-		string_t *response = t_str_new(256);
 		bool metadata = FALSE;
 
 		/* extended */
 		ctx->extended = TRUE;
 
-		str_append(response, "* URLFETCH ");
-		imap_append_astring(response, reply->url);
 		str_append(response, " (");
 		if ((reply->flags & IMAP_URLAUTH_FETCH_FLAG_BODYPARTSTRUCTURE) != 0 &&
 		    reply->bodypartstruct != NULL) {
@@ -265,8 +265,12 @@
 		}
 	} else {
 		/* URL fetch failed */
-		client_send_line(cmd->client,
-			t_strdup_printf("* URLFETCH %s NIL", reply->url));
+		string_t *response = t_str_new(128);
+
+		str_append(response, "* URLFETCH ");
+		imap_append_astring(response, reply->url);
+		str_append(response, " NIL");
+		client_send_line(cmd->client, str_c(response));
 		if (reply->error != NULL) {
 			client_send_line(cmd->client, t_strdup_printf(
 				"* NO %s.", reply->error));


More information about the dovecot-cvs mailing list