[news.software.anu-news] 5.9C , reject of crossposted item though one group s/b okay?

jeh@simpact.com (01/01/90)

Running NEWS 5.9C (thanks, Geoff!), VMS 5.2. 

While reviewing last night's RNEWS log files [RNEWS is a DECUS uucp thing
that takes news batches received via uucp and feeds them to NEWS via 
ADD BATCH commands] I noticed a message that was rejected due to my sys
filter. 

The message was posted to alt.flame and to news.groups (in that order), and 
followups were directed to alt.flame.  My sys filter says (among other things) 

	news,!alt

Is this the intended behavior?  I thought that the posting to news.groups
should be alllowed.  

	--- Jamie Hanrahan, Simpact Associates, San Diego CA
Chair, VMSnet [DECUS uucp] and Internals Working Groups, DECUS VAX Systems SIG 
Internet:  jeh@simpact.com, or if that fails, jeh@crash.cts.com
Uucp:  ...{crash,scubed,decwrl}!simpact!jeh

gih900@csc.anu.oz (Geoff Huston) (01/12/90)

In article <811.259e10c7@simpact.com>, jeh@simpact.com writes:
> Running NEWS 5.9C (thanks, Geoff!), VMS 5.2. 
> 
> While reviewing last night's RNEWS log files [RNEWS is a DECUS uucp thing
> that takes news batches received via uucp and feeds them to NEWS via 
> ADD BATCH commands] I noticed a message that was rejected due to my sys
> filter. 
> 
> The message was posted to alt.flame and to news.groups (in that order), and 
> followups were directed to alt.flame.  My sys filter says (among other things) 
> 
> 	news,!alt
> 
> Is this the intended behavior?  I thought that the posting to news.groups
> should be alllowed.  

There is a logic error in the program whereby if ANY newsgroup is explicitly
rejected by the filter, then the item is rejected. What I was trying to catch
was filters of the form "comp,!comp.os.vms", where all comp.* are accepted
APART from comp.os.vms.

I think that the following fix will remove the problem...

Geoff Huston

NEWSDIST.C

/*
 *  test_accept
 *
 *  Test if the newsgroup groups and distribution dist is accepted
 *  using the filter f
 */

static
test_accept(newsgroups,distribution,f)
  char *newsgroups,
       *distribution;
  sys_filter_t *f;
{
  char *cp1,
       *cp2,
       locname[NGRP_SIZE],
       wname[NGRP_SIZE],
       line[IO_SIZE];
  int accept = 0, ngaccept;
  sys_filter_t *f_sav = f;

  strcpy(line,newsgroups);
  cp1 = line;
  if (!f) return(1);
  do {
    if (cp2 = strchr(cp1,',')) *cp2++ = '\0';
    util_cvrt(locname,cp1);
    f = f_sav;
    ngaccept = 0;
    while (f) {
      if (*f->sys_filtnam == '!') {
        if (!strcmp("all",f->sys_filtnam + 1)) ngaccept = -1;
        else if (wild_match(locname,f->sys_filtnam + 1)) ngaccept = -1;
        else {
          strcpy(wname,f->sys_filtnam + 1);
          strcat(wname,".*");
          if (wild_match(locname,wname)) ngaccept = -1;
          }
        if (ngaccept < 0) break;
        }
      else if (!ngaccept) {
        if (!strcmp("all",f->sys_filtnam)) ngaccept = 1;
        else if (wild_match(locname,f->sys_filtnam)) ngaccept = 1;
        else {
          strcpy(wname,f->sys_filtnam);
          strcat(wname,".*");
          if (wild_match(locname,wname)) ngaccept = 1;
          }
        }
      f = f->sys_fnext;
      }
    if (ngaccept == 1) accept = 1;
    } while (!accept && (cp1 = cp2));
  if (!accept) return(0);
  if ((!distribution) || (!*distribution)) return(accept);
  accept = 0;
  strcpy(line,distribution);
  if (!strcmp(line,"all")) return(1);
  cp1 = line;
  do {
    if (cp2 = strchr(cp1,',')) *cp2++ = '\0';
    util_cvrt(locname,cp1);
    f = f_sav;
    ngaccept = 0;
    while (f) {
      if (*f->sys_filtnam == '!') {
        if (!strcmp("all",f->sys_filtnam + 1)) ngaccept = -1;
        else if (wild_match(locname,f->sys_filtnam + 1)) ngaccept = -1;
        else {
          strcpy(wname,f->sys_filtnam + 1);
          strcat(wname,".*");
          if (wild_match(locname,wname)) ngaccept = 1;
          }
        if (ngaccept < 0) break;
        }
      else if (!ngaccept) {
        if (!strcmp("all",f->sys_filtnam)) ngaccept = 1;
        else if (wild_match(locname,f->sys_filtnam)) ngaccept = 1;
        else {
          strcpy(wname,f->sys_filtnam);
          strcat(wname,".*");
          if (wild_match(locname,wname)) ngaccept = 1;
	  else {
            strcat(locname,".");
            if (!strncmp(locname,f->sys_filtnam,strlen(locname))) ngaccept = 1;
            locname[strlen(locname) - 1] = '\0';
            }
          }
        }
      f = f->sys_fnext;
      }
    if (ngaccept == 1) accept = 1;
    cp1 = cp2;
    } while ((!accept) && (cp1));
  return(accept);
}