πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #85501

Re: Perl filter - attributes hash

#85501
From: Steve Crook
Date: Tue, 28 May 2013 15:05
62 lines
3266 bytes
On Mon, 25 Jun 2012 19:59:09 +0200, Julien Γ‰LIE wrote in
Message-Id: <jsa8td$m31$2@news.trigofacile.com>:

> Hi Steve,
>
>>>> If I'm reading nnrpd/perl.c correctly, it looks as though the attributes
>>>> hash is created for Perl Auth and Access functions.  Is there any reason
>>>> why the same hash cannot be created for filter_nnrpd.pl purposes?
>>>
>>> I think that adding %attributes to filter_nnrpd.pl would not be a
>>> problem.  HandleHeaders() in nnrpd/perl.c could do the same thing as the
>>> two other functions you mention.
>>
>> Thanks Julien, it works!  :)
>
> Is it a feature you would want to be included in INN 2.5.4?

Hi Julien,

I'm digging up a thread from this time last year.  :)

Regarding the change we discussed to nnrpd/perl.c to make the
attributes hash accessible to filter_nnrpd.pl: I don't think it ever
made it into INN's development stream.

Currently I'm applying the following patch at each INN update:-


--- /usr/local/news/dev/inn/nnrpd/perl.c        2012-06-21
09:52:23.000000000 +0100
+++ perl.c      2012-06-22 10:44:51.000000000 +0100
@@ -52,6 +52,7 @@
 {
     dSP;
     HEADER *hp;
+    HV *attribs;
     HV *hdr;
     SV *body;
     int rc;
@@ -82,7 +83,16 @@
     ENTER;
     SAVETMPS;

-    /* Create the Perl hash. */
+    /* Create the Perl attributes hash. */
+    attribs = perl_get_hv("attributes", true);
+    (void) hv_store(attribs, "hostname", 8, newSVpv(Client.host, 0), 0);
+    (void) hv_store(attribs, "ipaddress", 9, newSVpv(Client.ip, 0), 0);
+    (void) hv_store(attribs, "port", 4, newSViv(Client.port), 0);
+    (void) hv_store(attribs, "interface", 9, newSVpv(Client.serverhost, 0), 0);
+    (void) hv_store(attribs, "intipaddr", 9, newSVpv(Client.serverip, 0), 0);
+    (void) hv_store(attribs, "intport", 7, newSViv(Client.serverport), 0);
+
+    /* Create the Perl header hash. */
     hdr = perl_get_hv("hdr", true);
     for (hp = Table; hp < EndOfTable; hp++) {
         if (hp->Body)

-- 
What shall we use 
To fill the empty spaces 
Where we used to talk?
Technical Details
Message-ID: <slrnkq9htd.7vp.steve@snorky.mixmin.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.mixmin.net!.POSTED.2a01:4f8:100:5243::4!not-for-mail
References: <slrnju68be.dtg.steve@snorky.mixmin.net> <jrvt6p$1lk$1@news.trigofacile.com> <slrnjuglko.dtg.steve@snorky.mixmin.net> <jsa8td$m31$2@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <slrnkq9htd.7vp.steve@snorky.mixmin.net>
Subject: Re: Perl filter - attributes hash
Date: Tue, 28 May 2013 15:05:17 +0000
From: Steve Crook <steve@mixmin.net>
References: <slrnju68be.dtg.steve@snorky.mixmin.net> <jrvt6p$1lk$1@news.trigofacile.com> <slrnjuglko.dtg.steve@snorky.mixmin.net> <jsa8td$m31$2@news.trigofacile.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.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news.mixmin.net!.POSTED.2a01:4f8:100:5243::4!not-for-mail
Newsgroups: news.software.nntp
Organization: Mixmin
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 28 May 2013 15:05:17 +0000 (UTC)
Injection-Info: news.mixmin.net; posting-host="2a01:4f8:100:5243::4";
 logging-data="15241"; mail-complaints-to="abuse@mixmin.net"
User-Agent: slrn/pre1.0.2-8 (Linux)
Lines: 61
X-Original-Bytes: 2977