🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #79248

Re: Cleanfeed Binary Checks

#79248
From: Julien ÉLIE
Date: Sat, 02 Aug 2008 10:25
83 lines
4157 bytes
Hi Russ,

[Steve and Matija, could you please test Cleanfeed with the following change?]

>>    SV* newSVpvn_share(const char* s, I32 len, U32 hash)
>>
>> New in Perl 5.7.1.
>
> Yup, that looks like exactly what you want.  You probably want to pass in
> some nonsense for the hash rather than having it compute a hash of the
> body of the message, since we won't use the hash for innd's use case (I
> think).


All right.  Here is a suggestion for innd/perl.c:


#if (PERL_REVISION == 5) && ((PERL_VERSION < 7) || ((PERL_VERSION == 7) && (PERL_SUBVERSION < 1)))
    static SV *body = NULL;
    if (artBody) {
        if (!body) {
            body = newSV(0);
            (void) SvUPGRADE(body, SVt_PV);
        }
        SvPVX(body) = artBody;
        SvCUR_set(body, artLen);
        SvLEN_set(body, 0);
        SvPOK_on(body);
        (void) SvREADONLY_on(body);
        (void) SvREFCNT_inc(body);
        hv_store(hdr, "__BODY__", 8, body, 0);
    }
#else
    if (artBody) {
        /* For Perl not to compute a hash for artBody, we give it "42". */
        hv_store(hdr, "__BODY__", 8, newSVpvn_share(artBody, artLen, 42), 0);
    }
#endif /* Perl <= 5.7.1 */


I do not think we need all the other functions (SVt_PV which specifies body is
a scalar and SvPOK_on that it is a string).  READONLY (and FAKE) are implicit.


I have also added PERL_REVISION (5) to include/ppport.h for compatibility with
older Perl versions, if not set.  Otherwise, it will cause problems with Perl 6:

--- include/ppport.h    (révision 7932)
+++ include/ppport.h    (copie de travail)
@@ -150,6 +150,7 @@
 #      endif
 #endif
 #ifndef PERL_VERSION
+#       define PERL_REVISION (5)
 #       ifdef PERL_PATCHLEVEL
 #               define PERL_VERSION    PERL_PATCHLEVEL
 #       else
@@ -162,7 +163,7 @@
 #      define ERRSV perl_get_sv("@",false)
 #endif

-#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 4))
+#if (PERL_REVISION == 5) && ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 4)))
 #      define PL_sv_undef      sv_undef
 #      define PL_sv_yes        sv_yes
 #      define PL_sv_no         sv_no
@@ -174,7 +175,7 @@
 #      define PL_copline       copline
 #endif

-#if (PERL_VERSION < 5)
+#if (PERL_REVISION == 5) && (PERL_VERSION < 5)
 #      undef dTHR
 #      ifdef WIN32
 #              define dTHR extern int Perl___notused


-- 
Julien ÉLIE

« Balnea, uina, Venus corrumpunt corpora nostra,
  Sed uitam faciunt balnea, uina, Venus. » 
Technical Details
Message-ID: <g71cn9$jfb$1@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!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!news.ecp.fr!news.trigofacile.com!not-for-mail
References: <g61rme$nqb$1@news.mixmin.net> <g62e1h$ejc$1@news.trigofacile.com> <g6qtgm$sq3$1@bongo.bofh.it> <slrng94sta.c76.mnalis-news@eagle102.home.lan> <8763ql5sli.fsf@windlord.stanford.edu> <g6ua3g$4pe$1@news.trigofacile.com> <877ib0mp47.fsf@windlord.stanford.edu>

Show Full Headers
Complete Article Headers
Message-ID: <g71cn9$jfb$1@news.trigofacile.com>
Subject: Re: Cleanfeed Binary Checks
Date: Sat, 2 Aug 2008 12:25:42 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <g61rme$nqb$1@news.mixmin.net> <g62e1h$ejc$1@news.trigofacile.com> <g6qtgm$sq3$1@bongo.bofh.it> <slrng94sta.c76.mnalis-news@eagle102.home.lan> <8763ql5sli.fsf@windlord.stanford.edu> <g6ua3g$4pe$1@news.trigofacile.com> <877ib0mp47.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.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!oleane.net!oleane!news.ecp.fr!news.trigofacile.com!not-for-mail
Newsgroups: news.software.nntp
Organization: TrigoFACILE -- http://www.trigofacile.com/
Lines: 83
NNTP-Posting-Host: aaubervilliers-151-1-88-50.w83-199.abo.wanadoo.fr
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
 reply-type=original
Content-Transfer-Encoding: 8bit
X-Trace: news.trigofacile.com 1217672745 19947 83.199.151.50 (2 Aug 2008
X-Complaints-To: abuse@trigofacile.com
NNTP-Posting-Date: Sat, 2 Aug 2008 10:25:45 +0000 (UTC)
In-Reply-To: <877ib0mp47.fsf@windlord.stanford.edu>
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18000