dovecot-2.2: imap: CATENATE command fixes.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jul 31 02:46:27 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/1af9d08e67d7
changeset: 14737:1af9d08e67d7
user: Timo Sirainen <tss at iki.fi>
date: Tue Jul 31 02:46:21 2012 +0300
description:
imap: CATENATE command fixes.
Patch by Stephan Bosch
diffstat:
src/imap/cmd-append.c | 25 ++++++++++++-------------
src/lib-imap-storage/imap-msgpart-url.c | 11 ++++++-----
src/lib/uri-util.c | 2 +-
3 files changed, 19 insertions(+), 19 deletions(-)
diffs (130 lines):
diff -r 4d518c1a366c -r 1af9d08e67d7 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c Tue Jul 31 02:45:23 2012 +0300
+++ b/src/imap/cmd-append.c Tue Jul 31 02:46:21 2012 +0300
@@ -59,9 +59,9 @@
str_printfa(str, "Disconnected in APPEND (%u msgs, %u secs",
ctx->count, secs);
- if (ctx->input != NULL) {
+ if (ctx->litinput != NULL) {
str_printfa(str, ", %"PRIuUOFF_T"/%"PRIuUOFF_T" bytes",
- ctx->input->v_offset, ctx->literal_size);
+ ctx->litinput->v_offset, ctx->literal_size);
}
str_append_c(str, ')');
return str_c(str);
@@ -156,8 +156,8 @@
return TRUE;
}
- (void)i_stream_read(ctx->input);
- i_stream_skip(ctx->input, i_stream_get_data_size(ctx->input));
+ (void)i_stream_read(ctx->litinput);
+ i_stream_skip(ctx->litinput, i_stream_get_data_size(ctx->litinput));
if (cmd->client->input->closed) {
cmd_append_finish(ctx);
@@ -189,7 +189,7 @@
/* we have to read the nonsynced literal so we don't treat the message
data as commands. */
- ctx->input = i_stream_create_limit(ctx->client->input, ctx->literal_size);
+ ctx->litinput = i_stream_create_limit(ctx->client->input, ctx->literal_size);
ctx->message_input = TRUE;
ctx->cmd->func = cmd_append_continue_cancel;
@@ -249,17 +249,16 @@
ctx->cat_msg_size = newsize;
/* add this input stream to chain */
i_stream_chain_append(ctx->catchain, input);
- input = NULL;
/* save by reading the chain stream */
- while (!i_stream_is_eof(ctx->input)) {
- ret = i_stream_read(ctx->input);
+ while (!i_stream_is_eof(input)) {
+ ret = i_stream_read(input);
i_assert(ret != 0); /* we can handle only blocking input here */
if (mailbox_save_continue(ctx->save_ctx) < 0 || ret == -1)
break;
}
- if (ctx->input->stream_errno != 0) {
- errno = ctx->input->stream_errno;
+ if (input->stream_errno != 0) {
+ errno = input->stream_errno;
mail_storage_set_critical(ctx->box->storage,
"read(%s) failed: %m (for CATENATE URL %s)",
i_stream_get_name(input), caturl);
@@ -719,7 +718,7 @@
if (ctx->save_ctx != NULL) {
while (ctx->litinput->v_offset != ctx->literal_size) {
- ret = i_stream_read(ctx->input);
+ ret = i_stream_read(ctx->litinput);
if (mailbox_save_continue(ctx->save_ctx) < 0) {
/* we still have to finish reading the message
from client */
@@ -732,8 +731,8 @@
}
if (ctx->save_ctx == NULL) {
- (void)i_stream_read(ctx->input);
- i_stream_skip(ctx->input, i_stream_get_data_size(ctx->input));
+ (void)i_stream_read(ctx->litinput);
+ i_stream_skip(ctx->litinput, i_stream_get_data_size(ctx->litinput));
}
if (ctx->litinput->eof || client->input->closed) {
diff -r 4d518c1a366c -r 1af9d08e67d7 src/lib-imap-storage/imap-msgpart-url.c
--- a/src/lib-imap-storage/imap-msgpart-url.c Tue Jul 31 02:45:23 2012 +0300
+++ b/src/lib-imap-storage/imap-msgpart-url.c Tue Jul 31 02:46:21 2012 +0300
@@ -67,18 +67,18 @@
if (imap_url_parse(urlstr, &base_url,
IMAP_URL_PARSE_REQUIRE_RELATIVE, &url, &error) < 0) {
*error_r = t_strconcat("Invalid IMAP URL: ", error, NULL);
- return -1;
+ return 0;
}
if (url->mailbox == NULL) {
*error_r = "Mailbox-relative IMAP URL, but no mailbox selected";
- return -1;
+ return 0;
}
if (url->uid == 0 || url->search_program != NULL) {
*error_r = "Invalid messagepart IMAP URL";
- return -1;
+ return 0;
}
*url_r = imap_msgpart_url_create(user, url);
- return 0;
+ return 1;
}
struct mailbox *imap_msgpart_url_get_mailbox(struct imap_msgpart_url *mpurl)
@@ -168,12 +168,13 @@
imap_msgpart_url_open_part(struct imap_msgpart_url *mpurl, struct mail **mail_r,
struct imap_msgpart **msgpart_r, const char **error_r)
{
+ const char *section = mpurl->section == NULL ? "" : mpurl->section;
int ret;
if ((ret = imap_msgpart_url_open_mail(mpurl, mail_r, error_r)) <= 0)
return ret;
- if (imap_msgpart_parse((*mail_r)->box, mpurl->section, msgpart_r) < 0) {
+ if (imap_msgpart_parse((*mail_r)->box, section, msgpart_r) < 0) {
*error_r = "Invalid section";
return 0;
}
diff -r 4d518c1a366c -r 1af9d08e67d7 src/lib/uri-util.c
--- a/src/lib/uri-util.c Tue Jul 31 02:45:23 2012 +0300
+++ b/src/lib/uri-util.c Tue Jul 31 02:46:21 2012 +0300
@@ -239,7 +239,7 @@
p = (const char *)parser->cur;
if (uri_cut_scheme(&p, scheme_r) < 0)
- return -1;
+ return 0;
parser->cur = (const unsigned char *)p;
return 1;
More information about the dovecot-cvs
mailing list