rees@apollo.uucp (Jim Rees) (12/18/84)
# Here are six fixes to news 2.10.2 that I don't recall having been posted # recently. Use the Bourne shell to extract six files from this article, # one fix per file. I suggest you look at these fixes before applying # them, to see whether they make sense to you. # # The rest of this file is a shell script which will extract: # 1 2 3 4 5 6 echo x - 1 cat >1 <<'Godfather_Of_Soul' Control message replies are malformed control.c *************** *** 219,225 */ fd = mailhdr((struct hbuf *)NULL, "creation of new newsgroup"); if (fd != NULL) { ! fprintf(fd, "\nA new newsgroup called '%s' has been created by %s.\n\n", argv[1], header.path); mclose(fd); } --- 219,225 ----- */ fd = mailhdr((struct hbuf *)NULL, "creation of new newsgroup"); if (fd != NULL) { ! fprintf(fd, "A new newsgroup called '%s' has been created by %s.\n", argv[1], header.path); mclose(fd); } *************** *** 247,253 fd = mailhdr((struct hbuf *)NULL, "rmgroup control message"); if (fd != NULL) { # ifndef MANUALLY ! fprintf(fd, "\nA newsgroup called '%s' has been removed by %s.\n\n", argv[1], header.path); # ifdef USG fprintf(fd, "You may need to remove the directory %s by hand\n", --- 247,253 ----- fd = mailhdr((struct hbuf *)NULL, "rmgroup control message"); if (fd != NULL) { # ifndef MANUALLY ! fprintf(fd, "A newsgroup called '%s' has been removed by %s.\n", argv[1], header.path); # ifdef USG fprintf(fd, "You may need to remove the directory %s by hand\n", *************** *** 254,260 dirname(argv[1])); # endif # else ! fprintf(fd, "\n%s has requested that newsgroup %s be removed.\n", header.path, argv[1]); fprintf(fd, "You should remove it by hand\n"); # endif --- 254,260 ----- dirname(argv[1])); # endif # else ! fprintf(fd, "%s has requested that newsgroup %s be removed.\n", header.path, argv[1]); fprintf(fd, "You should remove it by hand\n"); # endif *************** *** 366,372 #ifdef NOTIFY f = mailhdr((struct hbuf *)NULL, "sendsys control message"); if (f != NULL) { ! fprintf(f, "\n%s requested your sys file.\n", header.path); fprintf(f, "It has been sent.\n"); mclose(f); } --- 366,372 ----- #ifdef NOTIFY f = mailhdr((struct hbuf *)NULL, "sendsys control message"); if (f != NULL) { ! fprintf(f, "%s requested your sys file.\n", header.path); fprintf(f, "It has been sent.\n"); mclose(f); } *************** *** 371,377 mclose(f); } #endif ! f = mailhdr(&header, "Subject: response to your sendsys request\n\n"); u = fopen(SUBFILE, "r"); if (f != NULL && u != NULL) { while ((c=getc(u)) != EOF) --- 371,377 ----- mclose(f); } #endif ! f = mailhdr(&header, "response to your sendsys request"); u = fopen(SUBFILE, "r"); if (f != NULL && u != NULL) { while ((c=getc(u)) != EOF) *************** *** 411,417 #ifdef NOTIFY fd = mailhdr((struct hbuf *)NULL, "uuname control message"); ! fprintf(fd, "\n%s requested your uuname output\n", header.path); mclose(fd); #endif fd = mailhdr(&header, "response to your senduuname request"); --- 411,417 ----- #ifdef NOTIFY fd = mailhdr((struct hbuf *)NULL, "uuname control message"); ! fprintf(fd, "%s requested your uuname output\n", header.path); mclose(fd); #endif fd = mailhdr(&header, "response to your senduuname request"); *************** *** 447,454 f = mailhdr(&header, "Our news version"); if (f == NULL) xerror("Cannot send back error message"); ! fprintf(f, "\nCurrently running news version %s.\n\n", news_version); ! fprintf(f, "The header of your message follows:\n"); hwrite(&header, f); mclose(f); } --- 447,454 ----- f = mailhdr(&header, "Our news version"); if (f == NULL) xerror("Cannot send back error message"); ! fprintf(f, "Currently running news version %s.\n\n", news_version); ! fprintf(f, "The header of your message follows:\n\n"); hwrite(&header, f); mclose(f); } *************** *** 487,493 if (f == NULL) xerror("Cannot send back error message"); fprintf(f, "Currently running news B version %s.\n\n", news_version); ! fprintf(f, "The header of the message follows:\n"); hwrite(h, f); mclose(f); } --- 485,491 ----- if (f == NULL) xerror("Cannot send back error message"); fprintf(f, "Currently running news B version %s.\n\n", news_version); ! fprintf(f, "The header of the message follows:\n\n"); hwrite(h, f); mclose(f); } *************** *** 505,511 if (f == NULL) xerror("Cannot send back error message"); fprintf(f, "Currently running news B version %s.\n\n", news_version); ! fprintf(f, "The header of the message follows:\n"); hwrite(&header, f); mclose(f); } --- 503,509 ----- if (f == NULL) xerror("Cannot send back error message"); fprintf(f, "Currently running news B version %s.\n\n", news_version); ! fprintf(f, "The header of the message follows:\n\n"); hwrite(&header, f); mclose(f); } *************** *** 652,658 fprintf(fp, "Date: %s\n", arpadate(&now)); fprintf(fp, "To: %s\n", to); fprintf(fp, "Subject: %s\n", subject); ! fprintf(fp, "Responding-System: %s%s\n", FULLSYSNAME, MYDOMAIN); } return fp; } --- 656,662 ----- fprintf(fp, "Date: %s\n", arpadate(&now)); fprintf(fp, "To: %s\n", to); fprintf(fp, "Subject: %s\n", subject); ! fprintf(fp, "Responding-System: %s%s\n\n", FULLSYSNAME, MYDOMAIN); } return fp; } Godfather_Of_Soul echo x - 2 cat >2 <<'Godfather_Of_Soul' Readnews 'd' command fails on some headers See recent issues of Telecom Digest, for example. digest.c *************** *** 233,239 register int n, len; register char *s; register long pos; ! short wasblank; n = len = 0; wasblank = FALSE; --- 233,239 ----- register int n, len; register char *s; register long pos; ! short wasblank, ishead; n = len = 0; wasblank = FALSE; *************** *** 257,262 nhlines = 0; arts[n].a_hdr = pos; isblank = FALSE; do { lastpos = pos; wasblank = isblank; --- 257,263 ----- nhlines = 0; arts[n].a_hdr = pos; isblank = FALSE; + ishead = TRUE; do { lastpos = pos; wasblank = isblank; *************** *** 270,276 if (isblank && nhlines==1) /* one liner--not a header */ break; ! } while ((isblank && !wasblank) || isheader(s)); if ((!isblank && !wasblank) || nhlines < 2) { /* oops! not a header... back off */ arts[n].a_hdr = arts[n-1].a_bod; --- 271,279 ----- if (isblank && nhlines==1) /* one liner--not a header */ break; ! if (!ishead || (s[0] != ' ' && s[0] != '\t')) ! ishead = isheader(s); ! } while ((isblank && !wasblank) || ishead); if ((!isblank && !wasblank) || nhlines < 2) { /* oops! not a header... back off */ arts[n].a_hdr = arts[n-1].a_bod; Godfather_Of_Soul echo x - 3 cat >3 <<'Godfather_Of_Soul' Uninitialized variables cause core dumps inews.c *************** *** 68,74 int tlen, len; /* temps for string processing routine */ register char *ptr; /* pointer to rest of buffer */ int filchar; /* fill character (state = STRING) */ ! char *user, *home; /* environment temps */ struct passwd *pw; /* struct for pw lookup */ struct group *gp; /* struct for group lookup */ register int i; --- 68,74 ----- int tlen, len; /* temps for string processing routine */ register char *ptr; /* pointer to rest of buffer */ int filchar; /* fill character (state = STRING) */ ! char *user = NULL, *home = NULL; /* environment temps */ struct passwd *pw; /* struct for pw lookup */ struct group *gp; /* struct for group lookup */ register int i; Godfather_Of_Soul echo x - 4 cat >4 <<'Godfather_Of_Soul' Unused variables iparams.h *************** *** 17,21 #endif NOTIFY extern FILE *infp,*actfp; ! extern int tty, flag, is_ctl; ! extern char filename[], *DFLTNG, whatever[]; --- 17,21 ----- #endif NOTIFY extern FILE *infp,*actfp; ! extern int tty, is_ctl; ! extern char filename[], *DFLTNG; Godfather_Of_Soul echo x - 5 cat >5 <<'Godfather_Of_Soul' Readnews will sometimes write .newsrc, even with -x readnews.c *************** *** 283,289 register int i, c; register char *p; ! if (!rcreadok) return; #ifdef VMS unlink(newsrc); --- 283,290 ----- register int i, c; register char *p; ! /* NEVER write it out if xflag */ ! if (xflag || !rcreadok) return; #ifdef VMS unlink(newsrc); readr.c *************** *** 914,920 bit = ngsize + 1; else bit = minartno - 1; ! if (uflag) { time_t now; (void) time(&now); if (now - timelastsaved > 5*60 /* 5 minutes */) { --- 926,932 ----- bit = ngsize + 1; else bit = minartno - 1; ! if (uflag && !xflag) { time_t now; (void) time(&now); if (now - timelastsaved > 5*60 /* 5 minutes */) { Godfather_Of_Soul echo x - 6 cat >6 <<'Godfather_Of_Soul' References: line can get too long, causing core dumps readr.c *************** *** 609,615 { register char *pathptr; int edit = 1; ! char *ed; FILE *tfp; char *replyname(); char subj[BUFLEN]; --- 613,619 ----- { register char *pathptr; int edit = 1; ! char *ed, *fbp; FILE *tfp; char *replyname(); char subj[BUFLEN]; *************** *** 658,665 folbuf[0] = '\0'; /* References */ if (hptr->followid[0]) { ! strcpy(folbuf, hptr->followid); ! strcat(folbuf, ", "); } strcat(folbuf, hptr->ident); --- 662,676 ----- folbuf[0] = '\0'; /* References */ if (hptr->followid[0]) { ! fbp = hptr->followid; ! ! /* If the references line is too long, truncate it. */ ! while (fbp && strlen(fbp) > 80) ! fbp = index(fbp + 1, '<'); ! if (fbp != NULL) { ! strcpy(folbuf, fbp); ! strcat(folbuf, " "); ! } } strcat(folbuf, hptr->ident); Godfather_Of_Soul exit