From: Timo Sirainen Date: Mon, 23 Jun 2003 18:22:48 +0000 (+0300) Subject: LIST and STATUS replies shouldn't strip tabs and spaces from mailbox names. X-Git-Tag: 1.1.alpha1~4538 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4393e184152643728342c7f020dbb9779d30748a;p=thirdparty%2Fdovecot%2Fcore.git LIST and STATUS replies shouldn't strip tabs and spaces from mailbox names. --HG-- branch : HEAD --- diff --git a/src/imap/cmd-list.c b/src/imap/cmd-list.c index a19cf1624e..e5c70051ef 100644 --- a/src/imap/cmd-list.c +++ b/src/imap/cmd-list.c @@ -166,7 +166,7 @@ static void list_send(struct list_send_context *ctx, struct list_node *node, str = t_str_new(256); str_printfa(str, "* %s (%s) \"%s\" ", ctx->response_name, flagstr, ctx->sep); - imap_quote_append_string(str, send_name); + imap_quote_append_string(str, send_name, FALSE); client_send_line(ctx->client, str_c(str)); t_pop(); } @@ -228,7 +228,7 @@ static void list_unsorted(struct client *client, if (strcasecmp(list->name, "INBOX") == 0) str_append(str, "INBOX"); else - imap_quote_append_string(str, list->name); + imap_quote_append_string(str, list->name, FALSE); client_send_line(client, str_c(str)); t_pop(); } diff --git a/src/imap/cmd-status.c b/src/imap/cmd-status.c index ba08f25b0d..d53fe1822b 100644 --- a/src/imap/cmd-status.c +++ b/src/imap/cmd-status.c @@ -111,7 +111,7 @@ int cmd_status(struct client *client) str = t_str_new(128); str_append(str, "* STATUS "); - imap_quote_append_string(str, mailbox); + imap_quote_append_string(str, mailbox, FALSE); str_append(str, " ("); if (items & STATUS_MESSAGES) diff --git a/src/lib-imap/imap-bodystructure.c b/src/lib-imap/imap-bodystructure.c index ed5cf6a008..96bde77325 100644 --- a/src/lib-imap/imap-bodystructure.c +++ b/src/lib-imap/imap-bodystructure.c @@ -74,9 +74,9 @@ static void parse_save_params_list(const unsigned char *name, size_t name_len, if (name_len == 7 && memcasecmp(name, "charset", 7) == 0) data->charset_found = TRUE; - imap_quote_append(data->str, name, name_len); + imap_quote_append(data->str, name, name_len, TRUE); str_append_c(data->str, ' '); - imap_quote_append(data->str, value, value_len); + imap_quote_append(data->str, value, value_len, TRUE); } static void parse_content_transfer_encoding(const unsigned char *value, diff --git a/src/lib-imap/imap-envelope.c b/src/lib-imap/imap-envelope.c index ce0f2ce67b..b0c4ab14ef 100644 --- a/src/lib-imap/imap-envelope.c +++ b/src/lib-imap/imap-envelope.c @@ -156,13 +156,13 @@ static void imap_write_address(string_t *str, struct message_address *addr) str_append_c(str, '('); while (addr != NULL) { str_append_c(str, '('); - imap_quote_append_string(str, addr->name); + imap_quote_append_string(str, addr->name, TRUE); str_append_c(str, ' '); - imap_quote_append_string(str, addr->route); + imap_quote_append_string(str, addr->route, TRUE); str_append_c(str, ' '); - imap_quote_append_string(str, addr->mailbox); + imap_quote_append_string(str, addr->mailbox, TRUE); str_append_c(str, ' '); - imap_quote_append_string(str, addr->domain); + imap_quote_append_string(str, addr->domain, TRUE); str_append_c(str, ')'); addr = addr->next; diff --git a/src/lib-imap/imap-quote.c b/src/lib-imap/imap-quote.c index 75e01d892b..35a168e612 100644 --- a/src/lib-imap/imap-quote.c +++ b/src/lib-imap/imap-quote.c @@ -5,7 +5,7 @@ #include "imap-quote.h" void imap_quote_append(string_t *str, const unsigned char *value, - size_t value_len) + size_t value_len, int compress_lwsp) { size_t i, extra = 0; int last_lwsp = TRUE, literal = FALSE, modify = FALSE; @@ -28,7 +28,7 @@ void imap_quote_append(string_t *str, const unsigned char *value, break; case ' ': case '\t': - if (last_lwsp) { + if (last_lwsp && compress_lwsp) { modify = TRUE; extra++; } @@ -67,7 +67,7 @@ void imap_quote_append(string_t *str, const unsigned char *value, break; case ' ': case '\t': - if (!last_lwsp) + if (!last_lwsp || !compress_lwsp) str_append_c(str, ' '); last_lwsp = TRUE; break; @@ -98,7 +98,7 @@ char *imap_quote(pool_t pool, const unsigned char *value, size_t value_len) t_push(); str = t_str_new(value_len + MAX_INT_STRLEN + 5); - imap_quote_append(str, value, value_len); + imap_quote_append(str, value, value_len, TRUE); ret = p_strndup(pool, str_data(str), str_len(str)); t_pop(); diff --git a/src/lib-imap/imap-quote.h b/src/lib-imap/imap-quote.h index 862eacc12d..1700246313 100644 --- a/src/lib-imap/imap-quote.h +++ b/src/lib-imap/imap-quote.h @@ -8,9 +8,10 @@ char *imap_quote(pool_t pool, const unsigned char *value, size_t value_len); /* Append to existing string. */ void imap_quote_append(string_t *str, const unsigned char *value, - size_t value_len); + size_t value_len, int compress_lwsp); -#define imap_quote_append_string(str, value) \ - imap_quote_append(str, (const unsigned char *) value, (size_t)-1) +#define imap_quote_append_string(str, value, compress_lwsp) \ + imap_quote_append(str, (const unsigned char *) value, \ + (size_t)-1, compress_lwsp) #endif