[dovecot-cvs] dovecot/src/lib-imap imap-parser.c,1.33,1.34

cras at procontrol.fi cras at procontrol.fi
Wed Jan 22 20:41:31 EET 2003


Update of /home/cvs/dovecot/src/lib-imap
In directory danu:/tmp/cvs-serv29764

Modified Files:
	imap-parser.c 
Log Message:
Externally parsed literal size always stops argument parsing now. Input
stream is now skipped when returning success/failure, so the stream can be
used for other purposes too.



Index: imap-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-parser.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- imap-parser.c	21 Jan 2003 21:43:23 -0000	1.33
+++ imap-parser.c	22 Jan 2003 18:41:29 -0000	1.34
@@ -325,7 +325,9 @@
 
 static int imap_parser_literal_end(struct imap_parser *parser)
 {
-	if ((parser->flags & IMAP_PARSE_FLAG_LITERAL_SIZE) == 0) {
+	if ((parser->flags & IMAP_PARSE_FLAG_LITERAL_SIZE) != 0)
+		parser->eol = TRUE;
+	else {
 		if (parser->literal_size > parser->max_literal_size) {
 			/* too long string, abort. */
 			parser->error = "Literal size too large";
@@ -531,11 +533,16 @@
 
 	if (parser->error != NULL) {
 		/* error, abort */
+		i_stream_skip(parser->input, parser->cur_pos);
+		parser->cur_pos = 0;
 		*args = NULL;
 		return -1;
 	} else if ((!IS_UNFINISHED(parser) && count > 0 &&
 		    parser->root_list->size >= count) || parser->eol) {
 		/* all arguments read / end of line. */
+		i_stream_skip(parser->input, parser->cur_pos);
+		parser->cur_pos = 0;
+
 		if (parser->list_arg != NULL) {
 			parser->error = "Missing ')'";
 			*args = NULL;




More information about the dovecot-cvs mailing list