From 0a4b9a0a28642d409a934e2ee82af4541f585f9e Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 20 Jun 2002 21:44:19 +0000 Subject: [PATCH] Fix for header lines without a key --- ChangeLog | 7 +++++-- TODO | 3 --- lib/rfcmsg.c | 7 +++++++ mbfido/rfc2ftn.c | 18 ++++++++++++++---- 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7ba3ee13..40645fba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,9 +42,12 @@ v0.35.01 05-Jun-2002 When creating uplink area requests the from aka used is now the aka defined in the group. Removed several memory leaks again. + Fixed a bug when a news article was received with a header + line without a key value such as created by wrong configured + newsreaders. mbfile: - Added -v commandline switch to supress virus checking for the + Added -v commandline switch to suppress virus checking for the adopt and import commands. Use with great care. mbsebbs: @@ -242,7 +245,7 @@ v0.33.20 10-Feb-2002 - 04-Jun-2002 anymore. When a converted email to news listserver message is processed that has a header line starting with X-MS-, the headerline is - supressed because there is no key for this header. This looks + suppressed because there is no key for this header. This looks like a new kind of M$ standard. mbnews crashed on this one. Fixed a small problem in magic filename testing. In rfc2ftn the Approved: header now becomes a kludge instead diff --git a/TODO b/TODO index e87c2173..97114cf2 100644 --- a/TODO +++ b/TODO @@ -44,9 +44,6 @@ mbfido: U: Code cleanup and make a structure in this program. Remove duplicate or similar functions. - U: AreaMgr uplink mails use the default best aka instead of the aka - defined in that specific group. - N: Remove memory leak during toss. (It's ok for less 5000 messages for each run). diff --git a/lib/rfcmsg.c b/lib/rfcmsg.c index 1dca8ad0..23efd3e5 100644 --- a/lib/rfcmsg.c +++ b/lib/rfcmsg.c @@ -120,6 +120,13 @@ rfcmsg *parsrfc(FILE *fp) */ cur->key = xstrcpy(buffer); cur->val = xstrcpy((char *)" "); + } else if ((p=strchr(buffer,':')) && (p > buffer)) { + /* + * Header line without information, don't add this one. + */ + Syslog('!', "Header line %s without key value", buffer); + cur->key = xstrcpy(buffer); + cur->val = xstrcpy((char *)" "); } else { Syslog('M', "Non-header line: \"%s\"",buffer); cur->key = xstrcpy((char *)"X-Body-Start"); diff --git a/mbfido/rfc2ftn.c b/mbfido/rfc2ftn.c index 0fabba47..5e59b750 100644 --- a/mbfido/rfc2ftn.c +++ b/mbfido/rfc2ftn.c @@ -435,8 +435,13 @@ int rfc2ftn(FILE *fp, faddr *recipient) return 1; } +// Syslog('-', "1"); + if (newsmode) { + +// Syslog('-', "1a"); fprintf(ofp, "AREA:%s\n", msgs.Tag); +// Syslog('-', "1b"); } else { if (fmsg->to->point != 0) fprintf(ofp, "\001TOPT %d\n", fmsg->to->point); @@ -445,6 +450,7 @@ int rfc2ftn(FILE *fp, faddr *recipient) fprintf(ofp, "\001INTL %d:%d/%d %d:%d/%d\n", fmsg->to->zone, fmsg->to->net, fmsg->to->node, fmsg->from->zone, fmsg->from->net, fmsg->from->node); } +// Syslog('-', "1c"); fprintf(ofp, "\001MSGID: %s %08lx\n", MBSE_SS(fmsg->msgid_a),fmsg->msgid_n); if (fmsg->reply_s) fprintf(ofp, "\1REPLY: %s\n", fmsg->reply_s); @@ -454,16 +460,17 @@ int rfc2ftn(FILE *fp, faddr *recipient) fprintf(ofp, "\001TZUTC: %s\n", gmtoffset(Now)); fmsg->subj = oldsubj; if ((p = hdr((char *)"X-FTN-REPLYADDR",msg))) { -// Syslog('n', "replyaddr 1 %s", p); +// Syslog('n', "replyaddr 1 %s", p); hdrsize += 10+strlen(p); fprintf(ofp,"\1REPLYADDR:"); kludgewrite(p,ofp); } else if (replyaddr) { -// Syslog('n', "replyaddr 2"); +// Syslog('n', "replyaddr 2"); hdrsize += 10+strlen(replyaddr); fprintf(ofp,"\1REPLYADDR: "); kludgewrite(replyaddr,ofp); } +// Syslog('-', "2"); if ((p = hdr((char *)"X-FTN-REPLYTO",msg))) { hdrsize += 8+strlen(p); fprintf(ofp,"\1REPLYTO:"); @@ -506,7 +513,7 @@ int rfc2ftn(FILE *fp, faddr *recipient) fprintf(ofp, "\001PID: MBSE-FIDO %s\n", VERSION); } } - +// Syslog('-', "3"); hdrsize += 8 + strlen(getchrs(outcode)); fprintf(ofp, "\001CHRS: %s\n", getchrs(outcode)); if (html_message) { @@ -597,6 +604,7 @@ int rfc2ftn(FILE *fp, faddr *recipient) kludgewrite(tmp->val,ofp); } +// Syslog('-', "4"); /* * Add the Received: header from this system to the mesage. */ @@ -618,7 +626,7 @@ int rfc2ftn(FILE *fp, faddr *recipient) kludgewrite(hdrconv(tmp->val, incode, outcode),ofp); } } - +// Syslog('-', "5"); rfcheaders=0; for (tmp=msg;tmp;tmp=tmp->next) { if ((needputrfc(tmp) > 1)) { @@ -644,6 +652,8 @@ int rfc2ftn(FILE *fp, faddr *recipient) // free(replyaddr); /* Gives SIGSEGV */ replyaddr = NULL; } + +// Syslog('-', "6"); if (needsplit) { fprintf(ofp," * Continuation %d of a split message *\n\n", splitpart); needsplit = FALSE;