Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParseError due to unsupported flag #163

Open
awein opened this issue Jun 6, 2018 · 5 comments
Open

ParseError due to unsupported flag #163

awein opened this issue Jun 6, 2018 · 5 comments
Labels

Comments

@awein
Copy link

awein commented Jun 6, 2018

Emails that use a flag value without a leading \ or $ will cause an internal error:
ParseError: unexpected data_item found while looking for flag|right_parenthesis

Example: FLAGS (\Seen JUNK $Junk)

@tonioo tonioo added the bug label Jun 14, 2018
@tonioo
Copy link
Member

tonioo commented Jun 14, 2018

@awein Which version of the webmail do you use?

@awein
Copy link
Author

awein commented Jun 14, 2018

@tonioo Sorry for not mentioning the versions:
Modoboa: 1.10.5
Webmail: 1.4.3

@tonioo
Copy link
Member

tonioo commented Jun 14, 2018

That's strange, the regex cleary allows this kind of token: https://github.com/modoboa/modoboa-webmail/blob/master/modoboa_webmail/lib/fetch_parser.py#L93

@awein
Copy link
Author

awein commented Jun 14, 2018

Sure - but JUNK will be treated as data_item type since it's matching that RE first. I had a quick look too but don't think there is an easy fix without reworking the Lexer class.

This snippet should be enough to reproduce the issue:

FetchResponseParser().parse_chunk('1 (UID 1303 FLAGS (\Seen NOTJUNK $NotJunk) RFC822.SIZE 5710 BODYSTRUCTURE ("text" "plain" ("charset" "ISO-8859-15") NIL NIL "quoted-printable" 2634 56 NIL NIL NIL NIL) BODY[HEADER.FIELDS (DATE FROM TO CC SUBJECT)] {154}')

@tonioo
Copy link
Member

tonioo commented Jul 16, 2018

Indeed, there is a lexer rule conflict and the fix is more complicated than expected...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants