🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #46310

inn 2.3.0beta nnrpd ARTreadschema() wrongness

#46310
From: Karl Kleinpaste
Date: Fri, 05 May 2000 00:00
68 lines
3272 bytes
Recent changes (0502) for intended improvement to nnrpd Xref schema
verification have broken it.

Consider this slice from nnrpd/article.c beginning line 243:

	if ((p = strchr(buff, ':')) != NULL) {
	    *p++ = '\0';
|	    fp->NeedsHeader = EQ(p, "full");
	    if (ARTfirstfullfield == 0)
	      ARTfirstfullfield = fp - ARTfields + 1;
	}
	else
	    fp->NeedsHeader = FALSE;
	fp->HasHeader = FALSE;
	fp->Header = COPY(buff);
	fp->Length = strlen(buff);
|	fp++;
	if (caseEQ(buff, "Xref")) {
	    foundxref = TRUE;
|	    foundxreffull = fp->NeedsHeader;
	    ARTxreffield = fp - ARTfields - 1;
	    fp->HasHeader = FALSE;
	    fp->Header = COPY("Newsgroups");
	    fp->Length = strlen("Newsgroups");
	    fp++;
	}
    }
    ARTfieldsize = fp - ARTfields;
    (void)fclose(F);
|   if (!foundxref || !foundxreffull) {
|	syslog(L_ERROR, "%s 'Xref:full' must be included in %s", ClientHost, SCHEMA);
	return FALSE;
    }
    return TRUE;

Please note the lines preceded with `|'.  NeedsHeader is figured on
the basis of comparison to "full".  Then we step past the current fp
into the next.  Then we determine foundxreffull on the basis of that
next fp...which is uninitialized.  Um?

The values I find in fp->NeedsHeader at the 3rd `|' line when nnrpd
starts vary all over the map.

Honestly, I'm not at all sure what was intended to be accomplished
here, because right this instant I see no reason to cobble up a fresh
Newsgroups overview entry out of air here.  So I haven't yet bothered
to debug farther than to determine the operational failure, when the
garbage value happens to be zero, leading to the "must be included"
diagnostic, confounding the heck outta me when I tried to install this
code on yet another new server today.  The obvious & trivial fix would
be to use "foundxreffull = (fp-1)->NeedsHeader" but that seems hackish.

Alternatively, this may be a little less disconcerting:
	fp->Length = strlen(buff);
	if (caseEQ(buff, "Xref")) {
	    foundxref = TRUE;
	    foundxreffull = fp->NeedsHeader;
	    fp++;
	    ARTxreffield = fp - ARTfields - 1;
	    fp->HasHeader = FALSE;
	    fp->Header = COPY("Newsgroups");
	    fp->Length = strlen("Newsgroups");
	}
	fp++;

0501 runs without incident; foundxreffull appeared in 0502.

Technical Details
Message-ID: <vxk4s8d4o5a.fsf@mesquite.charcoal.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <vxk4s8d4o5a.fsf@mesquite.charcoal.com>
Subject: inn 2.3.0beta nnrpd ARTreadschema() wrongness
Date: Fri, 05 May 2000 00:00:00 +0000
From: Karl Kleinpaste <karl@charcoal.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 619439609
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: postmaster@cs.cmu.edu
X-Trace: cantaloupe.srv.cs.cmu.edu 957500868 22627 128.2.194.2 (5 May 2000 04:27:48 GMT)
X-Face: "5(T0tZd{6}pd~YzBG8O/*EW,.]6]@`m^e;fv65W^Y&=d"M\1H}>T~4_.kcDD.O~y3k)a6h R;Nmi>9|>Nm${2IpM0^RcUEa\jcq?KOP)C&~x51l~zCHTulL^_T|u0I^kB'z@]{`2YjQu
Organization: Charcoal Communicators
Mime-Version: 1.0
User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.2 (Iris)
NNTP-Posting-Date: 5 May 2000 04:27:48 GMT
Newsgroups: news.software.nntp