[dovecot-cvs] dovecot/src/lib-imap imap-parser.c,1.47,1.48

cras at dovecot.org cras at dovecot.org
Tue Sep 28 13:55:39 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-imap
In directory talvi:/tmp/cvs-serv1148/lib-imap

Modified Files:
	imap-parser.c 
Log Message:
BODY.PEEK[HEADER.FIELDS (...)] list is allowed to contain strings and
literals. We didn't handle them correctly before.



Index: imap-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-imap/imap-parser.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- imap-parser.c	5 Aug 2003 23:10:33 -0000	1.47
+++ imap-parser.c	28 Sep 2004 10:55:36 -0000	1.48
@@ -48,7 +48,6 @@
 
 	unsigned int literal_skip_crlf:1;
 	unsigned int literal_nonsync:1;
-	unsigned int inside_bracket:1;
 	unsigned int eol:1;
 	unsigned int fatal_error:1;
 };
@@ -114,7 +113,6 @@
 	parser->error = NULL;
 
 	parser->literal_skip_crlf = FALSE;
-	parser->inside_bracket = FALSE;
 	parser->eol = FALSE;
 
 	imap_args_realloc(parser, LIST_ALLOC_SIZE);
@@ -277,33 +275,14 @@
 {
 	size_t i;
 
-	/* read until we've found space, CR or LF. Data inside '[' and ']'
-	   characters are an exception though, allow spaces inside them. */
+	/* read until we've found space, CR or LF. */
 	for (i = parser->cur_pos; i < data_size; i++) {
-		if (parser->inside_bracket) {
-			if (data[i] == '[') {
-				/* nested '[' characters not allowed
-				   (too much trouble and imap doesn't need) */
-				parser->error = "Unexpected '['";
-			}
-			if (is_linebreak(data[i])) {
-				/* missing ']' character */
-				parser->error = "Missing ']'";
-				return FALSE;
-			}
-
-			if (data[i] == ']')
-				parser->inside_bracket = FALSE;
-		} else {
-			if (data[i] == '[')
-				parser->inside_bracket = TRUE;
-			else if (data[i] == ' ' || data[i] == ')' ||
-				 is_linebreak(data[i])) {
-				imap_parser_save_arg(parser, data, i);
-				break;
-			} else if (!is_valid_atom_char(parser, data[i]))
-				return FALSE;
-		}
+		if (data[i] == ' ' || data[i] == ')' ||
+			 is_linebreak(data[i])) {
+			imap_parser_save_arg(parser, data, i);
+			break;
+		} else if (!is_valid_atom_char(parser, data[i]))
+			return FALSE;
 	}
 
 	parser->cur_pos = i;
@@ -519,7 +498,6 @@
 			if (!is_valid_atom_char(parser, data[0]))
 				return FALSE;
 			parser->cur_type = ARG_PARSE_ATOM;
-                        parser->inside_bracket = FALSE;
 			break;
 		}
 



More information about the dovecot-cvs mailing list