From per@erix.ericsson.se Sat Dec  9 19:24:07 EST 1995
Article: 16342 of news.software.nntp
Path: news.math.psu.edu!chi-news.cic.net!newsfeed.internetmci.com!in2.uu.net!news00.sunet.se!sunic!news99.sunet.se!erinews.ericsson.se!eua.ericsson.se!erix.ericsson.se!per
From: per@erix.ericsson.se (Per Hedeland)
Newsgroups: news.software.nntp
Subject: Re: NEWNEWS bug found.
Date: 9 Dec 1995 23:22:57 GMT
Organization: Ericsson Telecom Systems Labs, Stockholm, Sweden
Lines: 145
Message-ID: <4ad5oh$2aq@euas20.eua.ericsson.se>
References: <4a9f1v$ln@irk.zetnet.co.uk>
NNTP-Posting-Host: super.eua.ericsson.se
NNTP-Posting-User: per

In article <4a9f1v$ln@irk.zetnet.co.uk> pm@zetnet.co.uk  (Paul Martin) writes:
>A couple of people have written back to me saying that the reported bug is 
>to do with distributions. It isn't. What the unoff3 code is trying to do is
>match against the full history entry including article number, and not just
>the newsgroup name.

Hm, NEWNEWS appears to be problematic in more ways than one... The
original problem with NEWNEWS in 1.4 was indeed that it didn't do the
distributions right: If you specified any, you would never get *any*
articles back.

Unoff3 included a fix for this - unfortunately that fix introduced two
new bugs, a) (the one discussed here) that newsgroup specifications had
to end in '*', and b) (which I haven't seen mentioned) that only the
first newsgroup was checked for crossposted articles.

I'm afraid your fix, while dealing with a), also brings back the
original problem (no surprise as it just puts back the code that was
removed from 1.4), and leaves b) in place - i.e. the net result is
definitely worse than 1.4.

Below is a patch (relative to unoff3) that I believe fixes all of the
above - it is a bit ugly (and says so:-), but seems to work fine, and
doing this "cleanly" would be too much work:-). For those that think I'm
insane to do *any* work on fixing the abominable NEWNEWS, another patch
is included as a bonus, which allows disabling of NEWNEWS altogether via
config.data - the patch only updates config.dist though, you have to
make the corresponding change to config.data.

--Per Hedeland
per@erix.ericsson.se

Patch1------------------------------------------------------------------
*** newnews.c.ORIG	Thu Sep 14 19:29:17 1995
--- newnews.c	Sat Dec  9 21:06:33 1995
***************
*** 27,33 ****
  
      /* Loop through the file list, trying to open one of them.. */
      for (save = files[0]; *files; files++) {
! 	(void)sprintf(buff, "%s/%s", _PATH_SPOOL, files[0]);
  	for (p = &buff[STRLEN(_PATH_SPOOL)]; *p; p++)
  	    if (*p == '.')
  		*p = '/';
--- 27,36 ----
  
      /* Loop through the file list, trying to open one of them.. */
      for (save = files[0]; *files; files++) {
! 	/* Ugly - need to grab the article number beyond the '\0' that
! 	   GetFiles() wrote over the '/' - there'd better be one...    */
! 	(void)sprintf(buff, "%s/%s/%s", _PATH_SPOOL, files[0],
! 		      files[0] + strlen(files[0]) + 1);
  	for (p = &buff[STRLEN(_PATH_SPOOL)]; *p; p++)
  	    if (*p == '.')
  		*p = '/';
***************
*** 93,101 ****
  	    RENEW(list, char *, size + 1);
  	}
  	for (list[i++] = p; *p && *p != '\n' && !ISWHITE(*p); p++) {
! 	    ;
  	}
! 	*p = '\0';
      }
      list[i] = NULL;
      return i ? list : NULL;
--- 96,106 ----
  	    RENEW(list, char *, size + 1);
  	}
  	for (list[i++] = p; *p && *p != '\n' && !ISWHITE(*p); p++) {
! 	    if (*p == '/')
! 		*p = '\0';
  	}
! 	if (*p)
! 	    *p++ = '\0';
      }
      list[i] = NULL;
      return i ? list : NULL;

------------------------------------------------------------------------

Patch2------------------------------------------------------------------
*** config/config.dist.ORIG	Sun Jul 23 17:50:28 1995
--- config/config.dist	Sat Dec  9 21:49:22 1995
***************
*** 411,416 ****
--- 411,420 ----
  ##  Strip Sender from posts that didn't authenticate?  Pick DO or DONT.
  #### =()<NNRP_AUTH_SENDER	@<NNRP_AUTH_SENDER>@>()=
  NNRP_AUTH_SENDER	DONT
+ ##  Allow the NEWNEWS NNTP command?   Pick DO or DONT.
+ ##  (RFC 977 says you should; your server performance may not agree...)
+ #### =()<ALLOW_NEWNEWS		@<ALLOW_NEWNEWS>@>()=
+ ALLOW_NEWNEWS		DO
  ##  How many read/write failures until channel is put to sleep or closed?
  #### =()<BAD_IO_COUNT		@<BAD_IO_COUNT>@>()=
  BAD_IO_COUNT		5
*** include/configdata.h.ORIG	Mon Nov 20 14:18:27 1995
--- include/configdata.h	Sat Dec  9 22:14:54 1995
***************
*** 254,259 ****
--- 254,262 ----
      /*  Strip Sender from posts that did authenticate? */
      /* =()<#define @<NNRP_AUTH_SENDER>@_NNRP_AUTH_SENDER>()= */
  #define DONT_NNRP_AUTH_SENDER
+     /* Allow the NEWNEWS NNTP command? */
+     /* =()<#define @<ALLOW_NEWNEWS>@_ALLOW_NEWNEWS>()= */
+ #define DO_ALLOW_NEWNEWS
      /* How many read/write failures until channel is put to sleep or closed? */
      /* =()<#define BAD_IO_COUNT	@<BAD_IO_COUNT>@>()= */
  #define BAD_IO_COUNT	5
*** nnrpd/newnews.c.ORIG	Sat Dec  9 21:06:33 1995
--- nnrpd/newnews.c	Sat Dec  9 21:49:25 1995
***************
*** 4,10 ****
--- 4,22 ----
  */
  #include "nnrpd.h"
  
+ #if	defined(DONT_ALLOW_NEWNEWS)
  
+ FUNCTYPE
+ CMDnewnews(ac, av)
+     register int	ac;
+     char		*av[];
+ {
+     Reply("%d NEWNEWS command disabled by administrator\r\n",
+ 	  NNTP_ACCESS_VAL);
+ }
+ 
+ #else
+ 
  #define FILE_LIST_DELTA		10
  #define GET_DATE(p, line)	\
  	((p = strchr(line, HIS_FIELDSEP)) == NULL ? 0 : atol(++p))
***************
*** 259,261 ****
--- 271,275 ----
      (void)fclose(F);
      Printf(".\r\n");
  }
+ 
+ #endif	/* defined(DONT_ALLOW_NEWNEWS) */

------------------------------------------------------------------------


