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

Support obs-FWS in the FWS parser (#431) #435

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions src/low-level/imf/mailimf.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ int mailimf_fws_parse(const char * message, size_t length, size_t * indx)
int fws_1;
int fws_2;
int fws_3;
int fws_4;
int r;

cur_token = * indx;
Expand All @@ -847,20 +848,24 @@ int mailimf_fws_parse(const char * message, size_t length, size_t * indx)
}
final_token = cur_token;

r = mailimf_crlf_parse(message, length, &cur_token);
switch (r) {
case MAILIMF_NO_ERROR:
fws_2 = TRUE;
break;
case MAILIMF_ERROR_PARSE:
fws_2 = FALSE;
break;
default:
return r;
}

fws_3 = FALSE;
if (fws_2) {
fws_4 = FALSE;
while (1) {
r = mailimf_crlf_parse(message, length, &cur_token);
switch (r) {
case MAILIMF_NO_ERROR:
fws_2 = TRUE;
break;
case MAILIMF_ERROR_PARSE:
fws_2 = FALSE;
break;
default:
return r;
}
if (!fws_2)
break;

fws_4 = FALSE;
while (1) {
r = mailimf_wsp_parse(message, length, &cur_token);
if (r != MAILIMF_NO_ERROR) {
Expand All @@ -869,14 +874,19 @@ int mailimf_fws_parse(const char * message, size_t length, size_t * indx)
else
return r;
}
final_token = cur_token;
fws_3 = TRUE;
fws_4 = TRUE;
}

if (!fws_4)
break;
}

if ((!fws_1) && (!fws_3))
return MAILIMF_ERROR_PARSE;

if (!fws_3)
if (!fws_4)
cur_token = final_token;

* indx = cur_token;
Expand Down