[comp.sources.d] C News production release bugs #2

geoff@utstat.uucp (Geoff Collyer) (06/14/89)

Here's a tag that can be used as a version number for the distribution
as updated by the previous bug report and this one:
"pre-comp.sources.unix version 3" (aka "p-csu v3").

These fixes will appear in the comp.sources.unix distribution, to
appear after Usenix.  Sites making C news available for uucp, ftp,
etc.  are asked to update their C news distributions (often just
cnews.Z) again.  The new cnews.Z (as bundled and compressed by me) is
379655 bytes.  The updated distribution can be retrieved from:
utzoo!~/dtr/cnews.Z, utgpu!/usr/spool/uucppublic/cnews.Z, and
uunet!~/news/cnews.Z by uucp, also known as
uunet.uu.net:~ftp/news/cnews.Z by ftp.  The copies on
neat.ai.toronto.edu and radio.astro.toronto.edu for ftp should be
updated soon.

The bugs fixed are: libcnews/string.c's canonpath() was incorrectly
canonicalising paths by deleting the delimiter before the user name
(thus throwing off the hop count used by the sys file Ln flag), and by
not reducing a path of "user" to "" (which could cause false rejections
of articles by a user named "uunet", say).  These were reported by Chip
Salzenberg.

The plain diffs are just 21 lines in total; they appear first and
equivalent context diffs follow them.


--- libcnews/string.c ---
198,200c198,200
<  * Canonicalise rawpath: NULL -> "", chop last site (actually user name),
<  * and if approved:, chop everything after the site in approved (user@host):
<  * (or sender).
---
>  * Canonicalise rawpath: NULL -> "", chop last site (actually user name) but not
>  * its leading delimiter, and if Approved:, chop everything after the site,
>  * and its trailing delimiter, from Approved: (or Sender:) (user@host).
208c208
< 	register char *p, *lastdelim = NULL, *site = NULL;
---
> 	register char *p, *lastdelim = newpath, *site = NULL;	/* p-csu v3 */
213c213
< 			lastdelim = p;
---
> 			lastdelim = p + 1;	/* just past delim; p-csu v3 */
224c224
< 		if (p != NULL)
---
> 		if (p != NULL && *p++ != '\0')	/* delim after site? p-csu v3 */



*** libcnews/string.c.old	Wed Jun 14 04:03:07 1989
--- libcnews/string.c	Wed Jun 14 04:03:08 1989
***************
*** 195,203
  }
  
  /*
!  * Canonicalise rawpath: NULL -> "", chop last site (actually user name),
!  * and if approved:, chop everything after the site in approved (user@host):
!  * (or sender).
   * Result is malloced memory.
   */
  char *

--- 195,203 -----
  }
  
  /*
!  * Canonicalise rawpath: NULL -> "", chop last site (actually user name) but not
!  * its leading delimiter, and if Approved:, chop everything after the site,
!  * and its trailing delimiter, from Approved: (or Sender:) (user@host).
   * Result is malloced memory.
   */
  char *
***************
*** 205,211
  char *rawpath, *approved, *sender;
  {
  	register char *newpath = strsave(nullify(rawpath));
! 	register char *p, *lastdelim = NULL, *site = NULL;
  	register int ch;
  
  	for (p = newpath; *p != '\0'; ++p)

--- 205,211 -----
  char *rawpath, *approved, *sender;
  {
  	register char *newpath = strsave(nullify(rawpath));
! 	register char *p, *lastdelim = newpath, *site = NULL;	/* p-csu v3 */
  	register int ch;
  
  	for (p = newpath; *p != '\0'; ++p)
***************
*** 210,216
  
  	for (p = newpath; *p != '\0'; ++p)
  		if (nothostchar(*p, ch))
! 			lastdelim = p;
  	if (lastdelim != NULL)
  		*lastdelim = '\0';		/* omit user's name */
  

--- 210,216 -----
  
  	for (p = newpath; *p != '\0'; ++p)
  		if (nothostchar(*p, ch))
! 			lastdelim = p + 1;	/* just past delim; p-csu v3 */
  	if (lastdelim != NULL)
  		*lastdelim = '\0';		/* omit user's name */
  
***************
*** 221,227
  	}
  	if (site != NULL) {
  		p = findhost(site+1, newpath);
! 		if (p != NULL)
  			*p = '\0';		/* terminate newpath after site */
  	}
  	return newpath;

--- 221,227 -----
  	}
  	if (site != NULL) {
  		p = findhost(site+1, newpath);
! 		if (p != NULL && *p++ != '\0')	/* delim after site? p-csu v3 */
  			*p = '\0';		/* terminate newpath after site */
  	}
  	return newpath;
-- 
Geoff Collyer		utzoo!utstat!geoff, geoff@utstat.toronto.edu
``... skill such as yours is evidence of a misspent youth.'' - Herbert Spencer