[dovecot-cvs] dovecot/src/lib-imap imap-parser.c,1.39,1.40

cras at procontrol.fi cras at procontrol.fi
Fri Feb 14 11:06:45 EET 2003


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

Modified Files:
	imap-parser.c 
Log Message:
Allow wildcards anyway in atoms, they're needed with LIST.



Index: imap-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-imap/imap-parser.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- imap-parser.c	14 Feb 2003 08:00:01 -0000	1.39
+++ imap-parser.c	14 Feb 2003 09:06:43 -0000	1.40
@@ -11,8 +11,7 @@
 
 #define IS_ATOM_SPECIAL(c) \
 	((c) == '(' || (c) == ')' || (c) == '{' || \
-	 (c) == '*' || (c) == '%' || (c) == '"' || (c) == '\\' || \
-	 (c) <= 32 || (c) == 0x7f)
+	 (c) == '"' || (c) == '\\' || (c) <= 32 || (c) == 0x7f)
 
 #define LIST_ALLOC_SIZE 7
 
@@ -257,6 +256,19 @@
 	parser->cur_type = ARG_PARSE_NONE;
 }
 
+static int is_valid_atom_char(struct imap_parser *parser, char chr)
+{
+	if (IS_ATOM_SPECIAL(chr)) {
+		parser->error = "Invalid characters in atom";
+		return FALSE;
+	} else if ((chr & 0x80) != 0) {
+		parser->error = "8bit data in atom";
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
 static int imap_parser_read_atom(struct imap_parser *parser,
 				 const unsigned char *data, size_t data_size)
 {
@@ -286,13 +298,8 @@
 				 is_linebreak(data[i])) {
 				imap_parser_save_arg(parser, data, i);
 				break;
-			} else if (IS_ATOM_SPECIAL(data[i])) {
-				parser->error = "Invalid characters in atom";
-				return FALSE;
-			} else if ((data[i] & 0x80) != 0) {
-				parser->error = "8bit data in atom";
+			} else if (!is_valid_atom_char(parser, data[i]))
 				return FALSE;
-			}
 		}
 	}
 
@@ -501,6 +508,8 @@
 			}
 			break;
 		default:
+			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