[news.admin] vnews' `cancel' command doesn't work if HIDDENNET defined

earle@smeagol.UUCP (02/02/87)

Index:	src/visual.c 2.11 patch level 3

Description:
	The vnews `c' command won't cancel the article if you have HIDDENNET 
	defined (and you aren't currently the news ROOTID), even if you are
	the author of the article.  Even if you become ROOTID, cancelling
	the article only gets done locally.  A cancel message is not
	transmitted to your other feeds.

	This is because there is code in src/header.c to strip off system names
	and `!'s from the Path: of the given article.  Unfortunately, this
	code is #ifndef HIDDENNET.  vnews tries to verify authorship of the
	article by comparing this Path to the current username.  If you have
	HIDDENNET defined, this path is undoubtedly `yourmachine!you', and
	username is `you'.  The string match fails, and vnews decides you
	aren't the author.

	If you become ROOTID, then you can cancel the article; unfortunately
	in src/rfuncs2.c the `cancel' function looks to see if you are the
	author.  Assuming ROOTID is not the author, the article will be
	cancelled, but because ROOTID is not the author, the distribution for
	the cancel control message will be `local'.  Not much help.

Repeat-by:
	If you have HIDDENNET defined, and aren't ROOTID, go into vnews and
	try to cancel an article you posted.  `Can't cancel something you
	didn't write.' will appear.

Fix:
	In visual.c, the cancel command is handled by the following function:

cancel_command()
{
	int notauthor;

	tfilename = filename;
	(void) strcpy(rcbuf, h->path);
	ptr1 = index(rcbuf, ' ');
	if (ptr1)
		*ptr1 = 0;
	notauthor = strcmp(username, rcbuf);
	if (uid != ROOTID && uid && notauthor) {
		msg("Can't cancel what you didn't write.");
		return;
	}
	if (!cancel(stderr, h, notauthor)) {
		clear(bit);
		saveart;
		nextbit();
		obit = -1;
		fp = NULL;
	}
	FCLOSE(fp);
}

(1) There should be an #ifndef HIDDENNET case around the
	notauthor = strcmp(username, rcbuf);
line.  For the #else part, `rcbuf' should be sent through a routine
(like header.c's) to strip out the system name(s) and `!' before this
test.

(2) Before calling the `cancel' function, if ROOTID is true then perhaps
either `notauthor' should be set false, or the cancel line should be modified
to something like
	if (!cancel(stderr, h, (notauthor || uid == ROOTID))) {


This bug has been reported, so it will probably be fixed in Patch #4 if/when
it comes out.
-- 
	Greg Earle	UUCP: sdcrdcf!smeagol!earle; attmail!earle
	JPL		ARPA: elroy!smeagol!earle@csvax.caltech.edu
AT&T: +1 818 354 4034	      earle@jplpub1.jpl.nasa.gov (For the daring)
I'm using my X-RAY VISION to obtain a rare glimpse of the INNER WORKINGS of     this POTATO!!