"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "rfc822.c" between
mairix-0.23.tar.gz and mairix-0.24.tar.gz

About: mairix is a program for indexing and searching email messages stored in maildir, MH or mbox folders.

rfc822.c  (mairix-0.23):rfc822.c  (mairix-0.24)
skipping to change at line 866 skipping to change at line 866
b0 = NULL; b0 = NULL;
line_after_b0 = input; line_after_b0 = input;
be = input + input_len; be = input + input_len;
do { do {
int boundary_ok; int boundary_ok;
start_b1_search_from = line_after_b0; start_b1_search_from = line_after_b0;
do { do {
/* reject boundaries that aren't a whole line */ /* reject boundaries that aren't a whole line */
b1 = NULL; b1 = NULL;
for (bx = start_b1_search_from; bx < be - (boundary_len + 4); bx++) { for (bx = start_b1_search_from; bx < be - (boundary_len + 2); bx++) {
if (bx[0] == '-' && bx[1] == '-' && if (bx[0] == '-' && bx[1] == '-' &&
!strncmp(bx+2, boundary, boundary_len)) { !strncmp(bx+2, boundary, boundary_len)) {
b1 = bx; b1 = bx;
break; break;
} }
} }
if (!b1) { if (!b1) {
if (error) if (error)
*error = DTR8_MISSING_END; *error = DTR8_MISSING_END;
return; return;
} }
looking_at_end_boundary = (b1[boundary_len+2] == '-' && looking_at_end_boundary = (b1+boundary_len+3 < be) && (b1[boundary_len+2] == '-' &&
b1[boundary_len+3] == '-'); b1[boundary_len+3] == '-');
boundary_ok = 1; boundary_ok = 1;
if ((b1 > input) && (*(b1-1) != '\n')) if ((b1 > input) && (*(b1-1) != '\n'))
boundary_ok = 0; boundary_ok = 0;
if (!looking_at_end_boundary && (b1 + boundary_len + 2 < input + input_len if (!looking_at_end_boundary && (b1 + boundary_len + 3 < be) && !(
) && (*(b1 + boundary_len + 2) != '\n')) ((b1 + boundary_len + 2 < input + input_len) && (*(b1 + boundary_len +
2) == '\n')) ||
((b1 + boundary_len + 3 < input + input_len) && (*(b1 + boundary_len +
2) == '\r') && (*(b1 + boundary_len + 3) == '\n'))
))
boundary_ok = 0; boundary_ok = 0;
if (!boundary_ok) { if (!boundary_ok) {
char *eol = strchr(b1, '\n'); char *eol = strchr(b1, '\n');
if (!eol) { if (!eol) {
fprintf(stderr, "Oops, didn't find another normal boundary in %s\n", fprintf(stderr, "Oops, didn't find another normal boundary in %s\n",
format_msg_src(src)); format_msg_src(src));
return; return;
} }
start_b1_search_from = 1 + eol; start_b1_search_from = 1 + eol;
} }
skipping to change at line 1020 skipping to change at line 1023
fprintf(stderr, "Giving up on message %s with bad header\n", fprintf(stderr, "Giving up on message %s with bad header\n",
format_msg_src(src)); format_msg_src(src));
} }
if (error) *error = DTR8_BAD_HEADERS; if (error) *error = DTR8_BAD_HEADERS;
return NULL; return NULL;
} }
/* Extract key headers {{{*/ /* Extract key headers {{{*/
ct_nvp = cte_nvp = cd_nvp = NULL; ct_nvp = cte_nvp = cd_nvp = NULL;
for (x=header.next; x!=&header; x=x->next) { for (x=header.next; x!=&header; x=x->next) {
if (match_string("to", x->text)) if (match_string("to:", x->text))
copy_or_concat_header_value(&result->hdrs.to, x->text); copy_or_concat_header_value(&result->hdrs.to, x->text);
else if (match_string("cc", x->text)) else if (match_string("cc:", x->text))
copy_or_concat_header_value(&result->hdrs.cc, x->text); copy_or_concat_header_value(&result->hdrs.cc, x->text);
else if (!result->hdrs.from && match_string("from", x->text)) else if (!result->hdrs.from && match_string("from:", x->text))
result->hdrs.from = copy_header_value(x->text); result->hdrs.from = copy_header_value(x->text);
else if (!result->hdrs.subject && match_string("subject", x->text)) else if (!result->hdrs.subject && match_string("subject:", x->text))
result->hdrs.subject = copy_header_value(x->text); result->hdrs.subject = copy_header_value(x->text);
else if (!ct_nvp && (nvp = make_nvp(src, x->text, "content-type:"))) else if (!ct_nvp && (nvp = make_nvp(src, x->text, "content-type:")))
ct_nvp = nvp; ct_nvp = nvp;
else if (!cte_nvp && (nvp = make_nvp(src, x->text, "content-transfer-encodin g:"))) else if (!cte_nvp && (nvp = make_nvp(src, x->text, "content-transfer-encodin g:")))
cte_nvp = nvp; cte_nvp = nvp;
else if (!cd_nvp && (nvp = make_nvp(src, x->text, "content-disposition:"))) else if (!cd_nvp && (nvp = make_nvp(src, x->text, "content-disposition:")))
cd_nvp = nvp; cd_nvp = nvp;
else if (!result->hdrs.date && match_string("date", x->text)) { else if (!result->hdrs.date && match_string("date:", x->text)) {
char *date_string = copy_header_value(x->text); char *date_string = copy_header_value(x->text);
result->hdrs.date = parse_rfc822_date(date_string); result->hdrs.date = parse_rfc822_date(date_string);
free(date_string); free(date_string);
} else if (!result->hdrs.message_id && match_string("message-id", x->text)) } else if (!result->hdrs.message_id && match_string("message-id:", x->text))
result->hdrs.message_id = copy_header_value(x->text); result->hdrs.message_id = copy_header_value(x->text);
else if (!result->hdrs.in_reply_to && match_string("in-reply-to", x->text)) else if (!result->hdrs.in_reply_to && match_string("in-reply-to:", x->text))
result->hdrs.in_reply_to = copy_header_value(x->text); result->hdrs.in_reply_to = copy_header_value(x->text);
else if (!result->hdrs.references && match_string("references", x->text)) else if (!result->hdrs.references && match_string("references:", x->text))
result->hdrs.references = copy_header_value(x->text); result->hdrs.references = copy_header_value(x->text);
else if (match_string("status", x->text)) else if (match_string("status:", x->text))
scan_status_flags(x->text + sizeof("status:"), &result->hdrs); scan_status_flags(x->text + sizeof("status:"), &result->hdrs);
else if (match_string("x-status", x->text)) else if (match_string("x-status:", x->text))
scan_status_flags(x->text + sizeof("x-status:"), &result->hdrs); scan_status_flags(x->text + sizeof("x-status:"), &result->hdrs);
} }
/*}}}*/ /*}}}*/
/* Process body */ /* Process body */
body_len = length - (body_start - data); body_len = length - (body_start - data);
do_body(src, body_start, body_len, ct_nvp, cte_nvp, cd_nvp, &result->atts, err or); do_body(src, body_start, body_len, ct_nvp, cte_nvp, cd_nvp, &result->atts, err or);
/* Free header memory */ /* Free header memory */
for (x=header.next; x!=&header; x=nx) { for (x=header.next; x!=&header; x=nx) {
 End of changes. 13 change blocks. 
14 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)