nnrp answer to listgroup of empty group

Russ Allbery rra at stanford.edu
Mon Mar 20 02:31:17 UTC 2006


Jeffrey M Vinocur <jeff at litech.org> writes:

> That certainly strikes me like a bug.

> The relevant code in nnrpd/group.c is:

>      if (!OVgroupstats(group, &ARTlow, &ARThigh, &count, NULL)) {
>          Reply("%s %s\r\n", NOSUCHGROUP, group);
>          free(group);
>          return;
>      }
> [...]
>          if ((handle = OVopensearch(group, ARTlow, ARThigh)) != NULL) {
>              if (count == 0)
>                  Reply("%d 0 0 0 %s\r\n", NNTP_GROUPOK_VAL, group);
>              else
>                  Reply("%d %d %ld %ld %s\r\n", NNTP_GROUPOK_VAL, count,
>                        ARTlow, ARThigh, group);
>              while (OVsearch(handle, &i, NULL, NULL, &token, NULL)) {
> [...]
>          } else {
>              Reply("%s %s\r\n", NOSUCHGROUP, group);
>          }

> And I think we should pull the count==0 test outside of the surrounding
> if block.  Except that makes it difficult to deal with a true error (not
> just empty group) returned from OVopensearch.  Ho hum.  I think I see
> how to rearrange it, but I don't seem to be able to compile INN at the
> moment so I can't test.

I've committed a patch to just skip the OVopensearch if count == 0.  It
seems to work correctly in some quick testing.  Please do feel free to
take a crack at a better solution, though, if one came to mind.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.


More information about the inn-workers mailing list