/* check linebreaks here, so escaping CR/LF isn't possible.
string always ends with '"', so it's an error if we found
a linebreak.. */
- if (is_linebreak(data[i])) {
+ if (is_linebreak(data[i]) &&
+ (parser->flags & IMAP_PARSE_FLAG_MULTILINE_STR) == 0) {
parser->error = "Missing '\"'";
return FALSE;
}
/* Return literals as IMAP_ARG_LITERAL instead of IMAP_ARG_STRING */
IMAP_PARSE_FLAG_LITERAL_TYPE = 0x04,
/* Don't check if atom contains invalid characters */
- IMAP_PARSE_FLAG_ATOM_ALLCHARS = 0x08
+ IMAP_PARSE_FLAG_ATOM_ALLCHARS = 0x08,
+ /* Allow strings to contain CRLFs */
+ IMAP_PARSE_FLAG_MULTILINE_STR = 0x10
};
enum imap_arg_type {