🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #84406

Re: INN's mailpost script - requested change.

#84406
From: Julien ÉLIE
Date: Tue, 27 Sep 2011 22:05
41 lines
2955 bytes
Hi Dieter,

>>> I have noted that some mail headers (which always end up being
>>> added to the "weird_mail_hdrs" variable) exceed this limit,
>>> especially those which relate to headers added by spam detection
>>> (e.g. a list of spam rules which fired). Would it be possible to
>>> modify any header added to this variable to truncate them at 995
>>> bytes plus elipsis ("...")?
>>
>> Why not just remove the invalid header? (998 bytes without seeing
>> any CRLF)
>
> That could be done, but I thought that the idea was to preserve as
> much as possible from the original message....

Sure, you're right.

Couldn't we use Text::Wrap, which is a Perl core module to achieve that?
It defaults to wrap to 76 columns, after a space ("\s"), with "\n" 
(which is fine because mailpost uses mere LF "\n" too).  If a word is 
more than 76 columns, then it is wrapped at multiples of its 76th chars 
(which is probably fine, even for base64-encoded headers).

I suggest to just call the function after a header field has been filled 
into $line.
$line is something like "Header: text\n text\n text".

     $line = Text::Wrap::wrap("", "\t", $line);


Maybe we should also remove lines containing only whitespace characters 
afterwards, just to be sure the header is valid?

     $line =~ s/\n[ \t]*\n/\n/g;
     $line =~ s/\n[ \t]*$//;

-- 
Julien ÉLIE

« – Où vous croyez-vous ici ?
   – Où je me trouve, je sais. » (Astérix)
Technical Details
Message-ID: <j5thbn$7j6$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!border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!newsfeed.straub-nv.de!news.albasani.net!news.trigofacile.com!.POSTED.aaubervilliers-552-1-145-66.w81-249.abo.wanadoo.fr!not-for-mail
References: <j5e6c0$8ib$1@snarked.org> <j5g860$9qe$1@news.trigofacile.com> <j5ggc9$q20$1@snarked.org>

Show Full Headers
Complete Article Headers
Message-ID: <j5thbn$7j6$1@news.trigofacile.com>
Subject: Re: INN's mailpost script - requested change.
Date: Wed, 28 Sep 2011 00:05:42 +0200
From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid>
References: <j5e6c0$8ib$1@snarked.org> <j5g860$9qe$1@news.trigofacile.com> <j5ggc9$q20$1@snarked.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.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!newsfeed.straub-nv.de!news.albasani.net!news.trigofacile.com!.POSTED.aaubervilliers-552-1-145-66.w81-249.abo.wanadoo.fr!not-for-mail
Newsgroups: news.software.nntp
Organization: TrigoFACILE -- http://www.trigofacile.com/
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 27 Sep 2011 22:05:43 +0000 (UTC)
Injection-Info: news.trigofacile.com;
 posting-host="aaubervilliers-552-1-145-66.w81-249.abo.wanadoo.fr:81.249.132.66";
 logging-data="7782"; mail-complaints-to="abuse@trigofacile.com"
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.7; fr;
In-Reply-To: <j5ggc9$q20$1@snarked.org>
Lines: 40
X-Original-Bytes: 2685