[net.news.b] Some minor bugs in inews

draper (01/15/83)

I have just fixed a few bugs in my copy of inews (netnews version 2.9;
inews SCCS no.2.11).  I am not sure my fixes are particularly well designed or
portable so I will mostly just describe the bugs, and people can fix them
or leave them.

1)  The inews manual entry is out of date -- like about 6 versions out of
date.  The code shows nearly twice as many options (9) as the man entry (5 in
the synopsis), although I couldn't tell what all of them do.

2)  The code of the -c option for cancelling an article is clearly meant to
allow an author to cancel his/her own article but this test doesn't work
because it tests the user's name from the environment against an
uninitialized header.  The cure is to read in the header of the article to be
cancelled.  Revised code for the cancel branch in main() might be:
	if (mode == CANCEL) {
		char *p;  FILE *f;
		f = xfopen(filename, "r");      hread(&header, f);
		p = index(header.path, ' ');    if (p != NULL) *p = '\0';
		p = header.path;
		if (strncmp(whatever, p, strlen(whatever)) && uid != NEWSUID && uid != geteuid() && uid && gid != NEWSGID)
			xerror("Not contributor");
		cancel();
		xxit(0);
	}

3)  I wanted to be able to use the -c and -C (create a newsgroup) options
without having to su to root or to news, just by being in the news group.
So I changed the code to test for gid==news as well as uid==ROOTID (see
above for an example).  I would NOT want to do this for the c (cancel)
command in readnews, which I might accidentally invoke when reading my
news, but obviously I would not call "inews -c" or "inews -C" by accident.

4)  When inserting an article, inews added the history entry for the article
even if it failed to insert the article.  This means that when the error
causing failed insertion has been fixed (typically wrong protection on some
file) attempts to reinsert will fail because the article is now seen as a
duplicate.  The fix is to move the "addhist" call in localize() inside the
conditional branch that tests for successful insertion.

5) The error message I have needed most from inews would warn me that a
newsgroup directory has the wrong protection set.  Inews does not test for
this directly, so the error messages are not to the point.  I added a direct
test for this common error.   This would have been a lot more help of course
if it had been there before I was familiar enough with the system to fix it.

				Steve Draper
				UCSD, San Diego
				ucbvax!sdcsvax!sdcsla!draper   draper@nprdc