dovecot: Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() an...

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 2 05:27:07 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/1d2b67440878
changeset: 6351:1d2b67440878
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 02 05:27:03 2007 +0300
description:
Renamed IS_ATOM_SPECIAL() to IS_ATOM_SPECIAL_INPUT() and added a new
IS_ATOM_SPECIAL() that contains all of the specials.

diffstat:

2 files changed, 12 insertions(+), 5 deletions(-)
src/lib-imap/imap-parser.c |    2 +-
src/lib-imap/imap-parser.h |   15 +++++++++++----

diffs (39 lines):

diff -r e7f61751822e -r 1d2b67440878 src/lib-imap/imap-parser.c
--- a/src/lib-imap/imap-parser.c	Sun Sep 02 05:03:41 2007 +0300
+++ b/src/lib-imap/imap-parser.c	Sun Sep 02 05:27:03 2007 +0300
@@ -223,7 +223,7 @@ static void imap_parser_save_arg(struct 
 
 static int is_valid_atom_char(struct imap_parser *parser, char chr)
 {
-	if (IS_ATOM_SPECIAL((unsigned char)chr)) {
+	if (IS_ATOM_SPECIAL_INPUT((unsigned char)chr)) {
 		parser->error = "Invalid characters in atom";
 		return FALSE;
 	} else if ((chr & 0x80) != 0) {
diff -r e7f61751822e -r 1d2b67440878 src/lib-imap/imap-parser.h
--- a/src/lib-imap/imap-parser.h	Sun Sep 02 05:03:41 2007 +0300
+++ b/src/lib-imap/imap-parser.h	Sun Sep 02 05:27:03 2007 +0300
@@ -3,12 +3,19 @@
 
 #include "array.h"
 
-/* FIXME: we don't have ']' here due to FETCH BODY[] handling failing
-   with it.. also '%' and '*' are banned due to LIST, and '\' due to it being
-   in flags. oh well.. */
-#define IS_ATOM_SPECIAL(c) \
+/* We use this macro to read atoms from input. It should probably contain
+   everything some day, but for now we can't handle some input otherwise:
+
+   ']' is required for parsing section (FETCH BODY[])
+   '%', '*' and ']' are valid list-chars for LIST patterns
+   '\' is used in flags */
+#define IS_ATOM_SPECIAL_INPUT(c) \
 	((c) == '(' || (c) == ')' || (c) == '{' || \
 	 (c) == '"' || (c) <= 32 || (c) == 0x7f)
+
+#define IS_ATOM_SPECIAL(c) \
+	(IS_ATOM_SPECIAL_INPUT(c) || \
+	 (c) == ']' || (c) == '%' || (c) == '*' || (c) == '\\')
 
 enum imap_parser_flags {
 	/* Set this flag if you wish to read only size of literal argument


More information about the dovecot-cvs mailing list