[net.sources.bugs] rn bug #29

lwall@sdcrdcf.UUCP (Larry Wall) (12/04/84)

System: rn version 4.1
Bug #: 29
Priority: MEDIUM
Subject: Duplicate suppression suppressed by rn/inews disagreements

Description:
	Rn currently verifies that Xref lines are from the current system by
	matching its idea of site name against the site name put into the
	Xref line by inews/rnews.  This is fine as long as inews and rn
	agree on the current site name.  If they don't, Xref processing is
	disabled, and articles posted to multiple newsgroups will show up
	multiple times.

	Because rn and inews possibly look up the site name via different
	methods, and different methods may return different sitenames, this
	problem may arise.  If it were only this, it would be fairly easy
	to force rn to use the same method as inews.  Unfortunately, now
	that local-area networks are becoming more popular, the inews that
	rn has to agree with may actually run on a different machine!

Repeat-By:
	Using rn, find an article with an Xref line.  The first word on the
	Xref line is the system name as inews thinks of it.  You may have to
	use the "v" command to see the Xref line.

	To find rn's idea of the site name, type /<esc>H.  If these two names
	disagree, you won't get Xref processing.

Fix:	There's no particular reason why the Xref line has to match rn's idea
	of system name.  It really only has to match the name as inews knows
	it to show that the Xref is really from this system.  Thus the fix
	is to make rn check the Xref system name against the system named
	in the Relay-Version line of the same article.

	This means that you could even change the system name in inews/rnews,
	and rn will continue to work on both the old and the new articles.

	From rn, say "| patch -d DIR", where DIR is your rn source directory.
	Outside of rn, say "cd DIR; patch <thisarticle".  If you don't have
	the patch program, apply the following by hand, or get patch.

Index: bits.c
Prereq: 4.1.1.3
***************
*** 1,4
! /* $Header: bits.c,v 4.1.1.3 84/11/30 17:08:15 lwall Exp $
   *
   * $Log:	bits.c,v $
   * Revision 4.1.1.3  84/11/30  17:08:15  lwall

--- 1,4 -----
! /* $Header: bits.c,v 4.1.1.4 84/12/03 16:25:05 lwall Exp $
   *
   * $Log:	bits.c,v $
   * Revision 4.1.1.4  84/12/03  16:25:05  lwall
***************
*** 1,6
  /* $Header: bits.c,v 4.1.1.3 84/11/30 17:08:15 lwall Exp $
   *
   * $Log:	bits.c,v $
   * Revision 4.1.1.3  84/11/30  17:08:15  lwall
   * Had an = where it should have been ==.
   * 

--- 1,10 -----
  /* $Header: bits.c,v 4.1.1.4 84/12/03 16:25:05 lwall Exp $
   *
   * $Log:	bits.c,v $
+  * Revision 4.1.1.4  84/12/03  16:25:05  lwall
+  * Changed Xref line verication to match site name from current article's
+  * Relay-Version line, rather than rn's idea of site name.
+  * 
   * Revision 4.1.1.3  84/11/30  17:08:15  lwall
   * Had an = where it should have been ==.
   * 
***************
*** 318,323
  					/* are there article# xrefs? */
  	char *xref_buf, *curxref;
  	register char *xartnum;
  	register ART_NUM x;
  	char tmpbuf[128];
  

--- 322,329 -----
  					/* are there article# xrefs? */
  	char *xref_buf, *curxref;
  	register char *xartnum;
+ 	char *rver_buf = Nullch;
+ 	static char *inews_site = Nullch;
  	register ART_NUM x;
  	char tmpbuf[128];
  
***************
*** 337,346
  	if (debug & DEB_XREF_MARKER)
  	    printf("Xref: %s\n",xref_buf);
  #endif
! 	curxref = cpytill(tmpbuf,xref_buf,' ');
! 	if (strEQ(tmpbuf,sitename))
! 	    curxref++;
! 	else {
  #ifdef DEBUGGING
  	    if (debug)
  		printf("Xref not from this system--ignoring\n");

--- 343,372 -----
  	if (debug & DEB_XREF_MARKER)
  	    printf("Xref: %s\n",xref_buf);
  #endif
! 	curxref = cpytill(tmpbuf,xref_buf,' ') + 1;
! 
! 	/* Make sure site name on Xref matches what inews thinks site is.
! 	 * Check first against last inews_site.  If it matches, fine.
! 	 * If not, fetch inews_site from current Relay-Version line and
! 	 * check again.  This is so that if the new administrator decides
! 	 * to change the system name as known to inews, rn will still do
! 	 * Xrefs correctly--each article need only match itself to be valid.
! 	 */ 
! 	if (inews_site == Nullch || strNE(tmpbuf,inews_site)) {
! 	    char *t;
! 
! 	    if (inews_site != Nullch)
! 		free(inews_site);
! 	    rver_buf = fetchlines(artnum,RVER_LINE);
! 	    if ((t = instr(rver_buf,"; site ")) == Nullch)
! 		inews_site = savestr(nullstr);
! 	    else {
! 		char new_site[128];
! 
! 		cpytill(new_site,t + 7,'.');
! 		inews_site = savestr(new_site);
! 	    }
! 	    if (strNE(tmpbuf,inews_site)) {
  #ifdef DEBUGGING
  		if (debug)
  		    printf("Xref not from %s--ignoring\n",inews_site);
***************
*** 342,349
  	    curxref++;
  	else {
  #ifdef DEBUGGING
! 	    if (debug)
! 		printf("Xref not from this system--ignoring\n");
  #endif
  	    goto wild_goose;
  	}

--- 368,375 -----
  	    }
  	    if (strNE(tmpbuf,inews_site)) {
  #ifdef DEBUGGING
! 		if (debug)
! 		    printf("Xref not from %s--ignoring\n",inews_site);
  #endif
  		goto wild_goose;
  	    }
***************
*** 345,351
  	    if (debug)
  		printf("Xref not from this system--ignoring\n");
  #endif
! 	    goto wild_goose;
  	}
  	while (*curxref) {
  					/* for each newsgroup */

--- 371,378 -----
  		if (debug)
  		    printf("Xref not from %s--ignoring\n",inews_site);
  #endif
! 		goto wild_goose;
! 	    }
  	}
  	while (*curxref) {
  					/* for each newsgroup */
***************
*** 371,376
  	}
        wild_goose:
  	free(xref_buf);
      }
      return 0;
  }

--- 398,405 -----
  	}
        wild_goose:
  	free(xref_buf);
+ 	if (rver_buf != Nullch)
+ 	    free(rver_buf);
      }
      return 0;
  }

sjoerd@tjalk.UUCP (Sjoerd Mullender) (12/10/84)

I have never seen rn bugs #24 through #28.  Can somebody please mail them
or repost them (if they ever got posted).
Thanks in advance.
-- 
			Sjoerd Mullender
			...!{decvax,philabs,seismo}!mcvax!vu44!sjoerd