🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #47002

Re: possible bug in INN 2.2.1 perl filtering (filter_nnrpd.pl)

#47002
From: Russ Allbery
Date: Tue, 20 Jun 2000 00:00
65 lines
2603 bytes
[ Posted and mailed. ]

Sorry for how long it took me to look at this, and thanks for the report!

Sven Gottwald <svengo@gmx.net> writes:

> I'm using INN 2.2.1 on my Linux-box as local newsserver and tried to use

> ---SNIP---
> sub filter_post {
> 	$modify_headers = 1;
> 	$hdr{"X-Trace"} = "";
> }
> ---SNAP---  

> in filter_nnrpd.pl to remove the X-Trace header (I didn't want to modify
> the source). But with that modification the header of a test posting to
> a local group looks like that:

[...]

> | X-No-Archive:  yes
>                ^^
> | Mail-Copies-To:  never
>                  ^^
> | User-Agent:  slrn/0.9.6.1 (Linux)
>              ^^
> | Xref: sauron.ddns.org local.test:60

> The same (of course /with/ a X-Trace Header ;-) happens if I only use 

> ---SNIP---
> sub filter_post {
> 	$modify_headers = 1;
>  	"";
> }
> ---SNAP---

> Does anyone have the same problem? (btw I'm using perl 5.005_03.)

The header code was including the space after the colon as part of the
contents of the header, but the code for glueing the headers back together
when $modify_headers was set was adding a space.  After thinking about it
for a moment, I think it's correct to consider the space not part of the
header value but part of the format of the article headers and omit it.

Here's a patch.  I'll commit this to STABLE, BETA, and CURRENT.

--- nnrpd/perl.c	2000/06/05 00:14:20	1.14
+++ nnrpd/perl.c	2000/06/21 02:39:31
@@ -95,7 +95,8 @@
           continue;
         }
         s++;
-        hv_store(hdr, p, (s - p) - 1, newSVpv(s, 0), 0);
+        t = (*s == ' ' ? s + 1 : s);
+        hv_store(hdr, p, (s - p) - 1, newSVpv(t, 0), 0);
    }
    /* Store user */
    sv_setpv(perl_get_sv("user",TRUE), PERMuser);

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

Technical Details
Message-ID: <ylu2enwya8.fsf@windlord.stanford.edu>
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
References: <slrn86a9tb.1bd.svengo@sauron.ddns.org>

Show Full Headers
Complete Article Headers
Message-ID: <ylu2enwya8.fsf@windlord.stanford.edu>
Subject: Re: possible bug in INN 2.2.1 perl filtering (filter_nnrpd.pl)
Date: Tue, 20 Jun 2000 00:00:00 +0000
From: Russ Allbery <rra@stanford.edu>
References: <slrn86a9tb.1bd.svengo@sauron.ddns.org>
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: 637053796
To: Sven Gottwald <svengo@gmx.net>
Content-Type: text/plain; charset=us-ascii
Organization: The Eyrie
Mime-Version: 1.0
User-Agent: Gnus/5.0802 (Gnus v5.8.2) XEmacs/21.1 (Biscayne)
Newsgroups: news.software.nntp