Streaming NNTP bug?

River Tarnell r.tarnell at IEEE.ORG
Mon Mar 21 22:24:12 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I'm using INN 2.5.2 from pkgsrc on Solaris 10 x86.

While developing a streaming NNTP client, I noticed an odd problem with 
INN: when sending a large number of CHECK commands to INN, its response 
would sometimes include extraneous junk characters at the start of the 
line.

To test this, I generated a list of CHECK commands:

% awk '{print "CHECK " $6}' /var/news/log/news | tail -5000 >list

and used the following program to send them to INN and read the replies:

#include <unistd.h>
#include <netdb.h>
#include <strings.h>
#include <fcntl.h>

int main(ac, av) char **av; {
struct addrinfo *res, hints;
int              sock, idlist;
ssize_t          n;
char             buf[16384];

        bzero(&hints, sizeof(hints));
        hints.ai_socktype = SOCK_STREAM;
        getaddrinfo(av[1], av[2], &hints, &res);
        sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
        connect(sock, res->ai_addr, res->ai_addrlen);
        idlist = open(av[3], O_RDONLY);
        while ((n = read(idlist, buf, sizeof(buf))) > 0) 
                write(sock, buf, n);
        while ((n = read(sock, buf, sizeof(buf))) > 0)
                write(1, buf, n);
        return 0;
}

This reliably demonstrates the problem:

% ./inntest news.tcx.org.uk 119 list >out
^C
% head -20 out                            
200 news.tcx.org.uk InterNetNews server INN 2.5.2 ready (transit mode)
438 <6aa5a43a97f89ad26cca28d2f4a9b87b at rip.ax.lt>
438 <1103211241001971.NP15983 at jobcircle.com>
438 <slrnioehqi.gdt.Mariusz.Kruk at epsilon.rdc.pl>
438 <1103211241011972.NP15983 at jobcircle.com>
438 <1103211241021973.NP15983 at jobcircle.com>
438 <43a659cb3bfdd7c0 at nocem.news.httrack.net>
438 <7b1dfc58-2b1d-4a5d-a21b-6d36b9d16b78 at w9g2000prg.googlegroups.com>
438 <362d14bb-3760-4c54-9e29-2ac318f3b6ce at q12g2000prb.googlegroups.com>
c438 <4d87475f$0$18248$4fafbaef at reader2.news.tin.it>
438 <91ce7282-a1c9-49d8-a08e-f2d980778fc7 at m7g2000vbq.googlegroups.com>
438 <AHHhp.11664$2w1.8672 at tornado.fastwebnet.it>

The extra character always seems to be in the same place (line 10), 
although its value varies.

Regards,
River.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (SunOS)

iEYEARECAAYFAk2H0AwACgkQIXd7fCuc5vKlNgCgs+Hr1qIHD9eYEDXcEL2KahWz
cYwAnRS25A+TgoALXdgevYq5hPtEUj5u
=QIBw
-----END PGP SIGNATURE-----



More information about the inn-workers mailing list