Mercurial > dovecot > original-hg > dovecot-1.2
changeset 308:899d3e189dbf HEAD
We didn't allow saving messages longer than 8192 bytes. Now we also send the
"+ OK" only after other parameters have been verified to be ok.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 24 Sep 2002 16:01:47 +0300 |
parents | 5954f9c2e620 |
children | 5b20fb38ac92 |
files | src/imap/cmd-append.c src/lib-imap/imap-parser.c |
diffstat | 2 files changed, 26 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-append.c Tue Sep 24 10:01:32 2002 +0300 +++ b/src/imap/cmd-append.c Tue Sep 24 16:01:47 2002 +0300 @@ -2,6 +2,7 @@ #include "common.h" #include "ioloop.h" +#include "iobuffer.h" #include "commands.h" #include "imap-parser.h" #include "imap-date.h" @@ -120,6 +121,9 @@ } } + io_buffer_send(client->outbuf, "+ OK\r\n", 6); + io_buffer_send_flush(client->outbuf); + /* save the mail */ failed = !box->save(box, flags, custom_flags, internal_date, client->inbuf, msg_size);
--- a/src/lib-imap/imap-parser.c Tue Sep 24 10:01:32 2002 +0300 +++ b/src/lib-imap/imap-parser.c Tue Sep 24 16:01:47 2002 +0300 @@ -276,6 +276,26 @@ return TRUE; } +static int imap_parser_literal_end(ImapParser *parser) +{ + if ((parser->flags & IMAP_PARSE_FLAG_LITERAL_SIZE) == 0) { + if (parser->literal_size > parser->inbuf->max_buffer_size) { + /* too long string, abort. */ + parser->error = TRUE; + return FALSE; + } + + io_buffer_send(parser->outbuf, "+ OK\r\n", 6); + io_buffer_send_flush(parser->outbuf); + } + + parser->cur_type = ARG_PARSE_LITERAL_DATA; + parser->literal_skip_crlf = TRUE; + + parser->cur_pos = 0; + return TRUE; +} + static int imap_parser_read_literal(ImapParser *parser, char *data, size_t data_size) { @@ -284,20 +304,9 @@ /* expecting digits + "}" */ for (i = parser->cur_pos; i < data_size; i++) { if (data[i] == '}') { - if (parser->literal_size > - parser->inbuf->max_buffer_size) { - /* too long string, abort. */ - parser->error = TRUE; + io_buffer_skip(parser->inbuf, i+1); + if (!imap_parser_literal_end(parser)) return FALSE; - } - - io_buffer_send(parser->outbuf, "+ OK\r\n", 6); - io_buffer_send_flush(parser->outbuf); - parser->cur_type = ARG_PARSE_LITERAL_DATA; - parser->literal_skip_crlf = TRUE; - - io_buffer_skip(parser->inbuf, i+1); - parser->cur_pos = 0; break; }