[net.news.b] Bug fix to missing sitename problem

pag@hao.UUCP (Peter Gross) (11/13/83)

here is a serious bug in the routine ihwrite() in header.c of news
2.10 (likely also in 2.10.1, but I haven't checked) that will cause
your sitename to be left out of the header path of outgoing news when
the sending site has a name which includes your site as a prefix.  For
example, if we received news from site "haovax", the bug would make
our outgoing news would look like:

Path: haovax!rest_of_path

instead of:

Path: hao!haovax!rest_of_path

This can cause mail lossage if the next site downstream from you
doesn't connect directly to the upstream site.  For example, if the
we sent our news on to site "cires", the path would now look like:
Path: cires!haovax!rest_of_path
Anyone responding to the article will have their mail fail since
cires doesn't connect to haovax.  The fix is to check more carefully
for whether the first sitename in an outgoing path is already your own.
Here is the diff -c output:

*** header.c	Sat Nov 12 11:39:14 1983
--- header.c.orig	Sat Nov 12 11:46:09 1983
***************
*** 464,471
  	int	iu;
  	time_t t;
  	time_t cgtdate();
- 	char tempsite[BUFLEN];
- 	register char *sp;
  
  	fprintf(fp, "Relay-Version: %s\n", genversion());
  	if (*hp->postversion)

--- 461,466 -----
  	int	iu;
  	time_t t;
  	time_t cgtdate();
  
  	fprintf(fp, "Relay-Version: %s\n", genversion());
  	if (*hp->postversion)
***************
*** 475,483
  	 * issues.  The new version considers From and Path to be separate.
  	 * The old one thinks they both mean "Path" but only believes the
  	 * first one it sees, so will ignore the second.
- 	 *
- 	 * Bug fix: Make sure that our site isn't just a prefix of
- 	 * previous site!  Otherwise we leave our name out of the path.
  	 */
  	strncpy(tempsite,hp->path,BUFLEN-1);
  	if((sp=index(tempsite,'!')) != NULL)

--- 470,475 -----
  	 * issues.  The new version considers From and Path to be separate.
  	 * The old one thinks they both mean "Path" but only believes the
  	 * first one it sees, so will ignore the second.
  	 */
  	if (prefix(hp->path, FULLSYSNAME))
  		fprintf(fp, "Path: %s\n", hp->path);
***************
*** 479,488
  	 * Bug fix: Make sure that our site isn't just a prefix of
  	 * previous site!  Otherwise we leave our name out of the path.
  	 */
! 	strncpy(tempsite,hp->path,BUFLEN-1);
! 	if((sp=index(tempsite,'!')) != NULL)
! 		*sp = '\0';
! 	if(strcmp(FULLSYSNAME,tempsite)==0)
  		fprintf(fp, "Path: %s\n", hp->path);
  	else
  		fprintf(fp, "Path: %s!%s\n", FULLSYSNAME, hp->path);

--- 471,477 -----
  	 * The old one thinks they both mean "Path" but only believes the
  	 * first one it sees, so will ignore the second.
  	 */
! 	if (prefix(hp->path, FULLSYSNAME))
  		fprintf(fp, "Path: %s\n", hp->path);
  	else
  		fprintf(fp, "Path: %s!%s\n", FULLSYSNAME, hp->path);

--peter (don't flame too loud if this was fixed in 2.10.1) gross
seismo!hao!pag
decvax!kpno!hao!pag
ucbvax!hplabs!hao!pag