"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/rfc2046.c" between
tin-2.4.4.tar.xz and tin-2.4.5.tar.xz

About: TIN is a threaded NNTP and spool based UseNet newsreader.

rfc2046.c  (tin-2.4.4.tar.xz):rfc2046.c  (tin-2.4.5.tar.xz)
/* /*
* Project : tin - a Usenet reader * Project : tin - a Usenet reader
* Module : rfc2046.c * Module : rfc2046.c
* Author : Jason Faultless <jason@altarstone.com> * Author : Jason Faultless <jason@altarstone.com>
* Created : 2000-02-18 * Created : 2000-02-18
* Updated : 2019-10-25 * Updated : 2020-12-17
* Notes : RFC 2046 MIME article parsing * Notes : RFC 2046 MIME article parsing
* *
* Copyright (c) 2000-2020 Jason Faultless <jason@altarstone.com> * Copyright (c) 2000-2021 Jason Faultless <jason@altarstone.com>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
* are met: * are met:
* *
* 1. Redistributions of source code must retain the above copyright notice, * 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
skipping to change at line 151 skipping to change at line 151
if ((len = strlen(line)) == 0) if ((len = strlen(line)) == 0)
return BOUND_NONE; return BOUND_NONE;
if (blen + 2 > len) if (blen + 2 > len)
return BOUND_NONE; return BOUND_NONE;
/* remove trailing whites as per RFC 2046 5.1.1 */ /* remove trailing whites as per RFC 2046 5.1.1 */
l = my_strdup(line); l = my_strdup(line);
e = l + len - 1; e = l + len - 1;
while(e > l + blen + 1 && isspace(*e)) while (e > l + blen + 1 && isspace(*e))
*e-- = '\0'; *e-- = '\0';
len = strlen(l); len = strlen(l);
nl = l[len - 1] == '\n'; nl = l[len - 1] == '\n';
if (len != blen + 2 + nl && len != blen + 4 + nl) { if (len != blen + 2 + nl && len != blen + 4 + nl) {
free(l); free(l);
return BOUND_NONE; return BOUND_NONE;
} }
skipping to change at line 1224 skipping to change at line 1224
case BOUND_START: case BOUND_START:
state = M_HDR; /* Now pa rsing headers of a part */ state = M_HDR; /* Now pa rsing headers of a part */
curr_part = new_part(part); curr_part = new_part(part);
curr_part->depth = depth; curr_part->depth = depth;
break; break;
} }
break; break;
case M_HDR: case M_HDR:
switch (bnd) { switch (bnd) {
case BOUND_START: /* TODO: skip err case BOUND_START:
or message if not -DDEBUG? */ #ifdef DEBUG
error_message(2, _(txt_error_mime if (debug & DEBUG_MISC)
_start)); error_message(2, _(txt_er
ror_mime_start));
#endif /* DEBUG */
continue; continue;
case BOUND_NONE: case BOUND_NONE:
break; / * Correct - No boundary */ break; / * Correct - No boundary */
} }
if (*line == '\0') { /* End of MIME he aders */ if (*line == '\0') { /* End of MIME he aders */
state = M_BODY; state = M_BODY;
curr_part->offset = ftell(artinfo->raw); curr_part->offset = ftell(artinfo->raw);
skipping to change at line 1426 skipping to change at line 1429
goto error; goto error;
if (!read_news_via_nntp) if (!read_news_via_nntp)
artinfo->raw = infile; artinfo->raw = infile;
art_lines = line_count; art_lines = line_count;
if ((ret = parse_rfc822_headers(&artinfo->hdr, infile, artinfo->raw)) != 0) if ((ret = parse_rfc822_headers(&artinfo->hdr, infile, artinfo->raw)) != 0)
goto error; goto error;
/* no article data returned, just a '.' after 220er response */
if (ret == 0 && artinfo->hdr.ext->offset == 0) {
ret = ART_UNAVAILABLE;
goto error;
}
/* /*
* Is this a MIME article ? * Is this a MIME article ?
* We don't bother to parse all plain text articles * We don't bother to parse all plain text articles
*/ */
if (artinfo->hdr.mime && artinfo->hdr.ext->type == TYPE_MULTIPART) { if (artinfo->hdr.mime && artinfo->hdr.ext->type == TYPE_MULTIPART) {
if ((ret = parse_multipart_article(infile, artinfo, artinfo->hdr. ext, 1, show_progress_meter)) != 0) { if ((ret = parse_multipart_article(infile, artinfo, artinfo->hdr. ext, 1, show_progress_meter)) != 0) {
/* Strip off EOF condition if present */ /* Strip off EOF condition if present */
if (ret & TIN_EOF) { if (ret & TIN_EOF) {
ret ^= TIN_EOF; ret ^= TIN_EOF;
/* TODO: skip error message if not -DDEBUG? */ #ifdef DEBUG
error_message(2, _(txt_error_mime_end), content_t if (debug & DEBUG_MISC)
ypes[artinfo->hdr.ext->type], artinfo->hdr.ext->subtype); error_message(2, _(txt_error_mime_end), c
ontent_types[artinfo->hdr.ext->type], artinfo->hdr.ext->subtype);
#endif /* DEBUG */
if (ret != 0) if (ret != 0)
goto error; goto error;
} else } else
goto error; goto error;
} }
} else { } else {
if ((ret = parse_normal_article(infile, artinfo, show_progress_me ter)) != 0) if ((ret = parse_normal_article(infile, artinfo, show_progress_me ter)) != 0)
goto error; goto error;
} }
skipping to change at line 1534 skipping to change at line 1545
if ((fp = open_art_fp(group, art->artnum)) == NULL) if ((fp = open_art_fp(group, art->artnum)) == NULL)
return ((tin_errno == 0) ? ART_UNAVAILABLE : ART_ABORT); return ((tin_errno == 0) ? ART_UNAVAILABLE : ART_ABORT);
#ifdef DEBUG_ART #ifdef DEBUG_ART
fprintf(stderr, "art_open(%p)\n", (void *) artinfo); fprintf(stderr, "art_open(%p)\n", (void *) artinfo);
#endif /* DEBUG_ART */ #endif /* DEBUG_ART */
progress_mesg = pmesg; progress_mesg = pmesg;
if (parse_rfc2045_article(fp, art->line_count, artinfo, show_progress_met er) != 0) { if (parse_rfc2045_article(fp, art->line_count, artinfo, show_progress_met er) != 0) {
progress_mesg = NULL; progress_mesg = NULL;
return ART_ABORT; return ((tin_errno == 0) ? ART_UNAVAILABLE : ART_ABORT);
} }
progress_mesg = NULL; progress_mesg = NULL;
/* /*
* TODO: compare art->msgid and artinfo->hdr.messageid and issue a * TODO: compare art->msgid and artinfo->hdr.messageid and issue a
* warning (once) about broken overviews if they differ * warning (once) about broken overviews if they differ
*/ */
if ((artinfo->tex2iso = ((group->attribute->tex2iso_conv) ? is_art_tex_en coded(artinfo->raw) : FALSE))) if ((artinfo->tex2iso = ((group->attribute->tex2iso_conv) ? is_art_tex_en coded(artinfo->raw) : FALSE)))
wait_message(0, _(txt_is_tex_encoded)); wait_message(0, _(txt_is_tex_encoded));
 End of changes. 7 change blocks. 
11 lines changed or deleted 21 lines changed or added

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