[net.news.b] Fix for "Not contributor"

rees@apollo.uucp (Jim Rees) (03/13/84)

Have you ever wondered why you sometimes get "Not contributor" when a cancel
message comes in, even when the author and the canceler are the same person?
At first glance it appears to be because cancel is comparing the path to the
internet address, because the log says something like this:

Mar 13 01:07 apollo.uucp	Not contributor: tektronix!tekig!donz and donz@tekig.UUCP

But the log entry is misleading.  It isn't printing what is actually being
compared.  The real reason that the cancel doesn't work is that one of the
addresses has a full name appended, and the other doesn't.  The solution is
to only compare up to the first blank.  I also stop the compare if I hit a
'.', so that if the addresses only differ in the domain, the comparison will
succeed.  Fixes to control.c follow.

By the way, can anyone tell me why the USG makefile contains the line
    CFLAGS = -Dindex=strchr -Drindex=strrchr
Both index and rindex are included with the distribution, in funcs.c, so
there wouldn't seem to be any reason to redefine their names for USG.

*** control.c_o	Tue Mar 13 09:28:36 1984
--- control.c	Tue Mar 13 09:28:50 1984
***************
*** 295,302
  		if((uid==ROOTID||uid==0) && strncmp(msgng,"to.",3) == 0)
  			su = 1;
  		poster = senderof(&header);
! 		if (!su && strcmp(whatsisname, poster)) {
! 			sprintf(msgbuf, "Not contributor: %s and %s", header.path, whatsisname);
  			xerror(msgbuf);
  		}
  

--- 295,309 -----
  		if((uid==ROOTID||uid==0) && strncmp(msgng,"to.",3) == 0)
  			su = 1;
  		poster = senderof(&header);
! 
! 		/* Only compare up to '.' or ' ' */
! 		r = index(poster, '.');
! 		if (r == NULL)
! 			r = index(poster, ' ');
! 		if (r != NULL)
! 			*r = '\0';
! 		if (!su && strncmp(whatsisname, poster, strlen(poster))) {
! 			sprintf(msgbuf, "Not contributor: %s and %s", poster, whatsisname);
  			xerror(msgbuf);
  		}