🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90162

Re: Seeking help modifying Diablo source to prevent miscategorization of articles containing PGP

#90162
From: Retro Guy
Date: Mon, 20 Mar 2023 01:30
85 lines
4201 bytes
Jesse Rehmer wrote:

> I recently switched to Diablo on the transit layer, but am observing it is
> rejecting messages that contain PGP as binary articles. This is preventing
> valid messages, such as NoCeM notices and messages that aren't encrypted but
> contain a PGP Signature, to be rejected in some cases, or not propagated to
> peers (due to "arttypes !binary" in the dnewsfeed definition).

> In lib/arttype.c, I see there is a specific check to identify an article with
> an article type of pgp, but this only checks for "-----BEGIN PGP
> MESSAGE-----".

> Looking at the contents of articles I am rejecting or not propagating, I
> believe the check should also look the following:

> "-----BEGIN PGP SIGNED MESSAGE-----"
> and
> "-----BEGIN PGP SIGNATURE-----"

> but I am not a developer and can't quite cobble anything together from the
> existing code that works to add these additional values.

> If anyone out there is willing to help me with a patch, I will be forever
> grateful!

> This is the portion of lib/arttype.c that is causing the misidentification:

>         /*
>          * We look for binary formats first, since these eat
>          * up CPU like there is no tomorrow.  We may miss
>          * some flags if we detect a binary file, the
>          * alternative is to remove the return(Type)'s and
>          * eat CPU for the entire binary.
>          */

>         linetype = classifyLineAsTypes(ptr, len);

>         if (linetype & UUE) {
>             Base64 = 0;
>             BinHex = 0;
>             UUencode++;
>             if (UUencode > 8) {
>                 Type |= ARTTYPE_UUENCODE | ARTTYPE_BINARY;
>                 return(Type);
>             }
>         } else if (linetype & BHX) {
>             UUencode = 0;
>             Base64 = 0;
>             BinHex++;
>             if (BinHex > 8) {
>                 Type |= ARTTYPE_BINHEX | ARTTYPE_BINARY;
>                 return(Type);
>             }
>         } else if (linetype & B64) {
>             UUencode = 0;
>             BinHex = 0;
>             Base64++;
>             if (Base64 > 8) {
>                 Type |= ARTTYPE_BASE64 | ARTTYPE_BINARY;
>                 return(Type);
>             }
>         } else {
>             if (*ptr == '-' &&
>                         strncmp(ptr, "-----BEGIN PGP MESSAGE-----", 27) == 0)
>                 Type |= ARTTYPE_PGPMESSAGE;
>             UUencode = 0;
>             Base64 = 0;
>             BinHex = 0;
>         }
>     }

Maybe just change:

            if (*ptr == '-' &&
                        strncmp(ptr, "-----BEGIN PGP MESSAGE-----", 27) == 0)
                Type |= ARTTYPE_PGPMESSAGE;

to:

            if (*ptr == '-' &&
                        strncmp(ptr, "-----BEGIN PGP ", 15) == 0)
                Type |= ARTTYPE_PGPMESSAGE;

-- 
Retro Guy
Technical Details
Message-ID: <9e316a26602e6764c6f722dc5c002594@news.novabbs.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <tv8ale$2t9m$1@nnrp.usenet.blueworldhosting.com>

Show Full Headers
Complete Article Headers
Message-ID: <9e316a26602e6764c6f722dc5c002594@news.novabbs.org>
Subject: Re: Seeking help modifying Diablo source to prevent miscategorization of articles containing PGP
Date: Mon, 20 Mar 2023 01:30:32 +0000
From: retro.guy@rocksolidbbs.com (Retro Guy)
References: <tv8ale$2t9m$1@nnrp.usenet.blueworldhosting.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp
Organization: Rocksolid Light
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.i2pn2.org; posting-account="novabbs.org"; posting-host="novabbs-org:10.136.143.187"; logging-data="27382"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: Rocksolid Light 0.7.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.org
X-Rslight-Site: $2y$10$5VF7ay7BtPqYt3qKyFP83eezPhSIiBorEOdTmJdpYDLGD6BmrMgPi
X-Rslight-Posting-User: 91053d4a47d51b416144568e5a1040f05e31ed1b
X-Face: .&YR-G(w(DZ$$,}%k=]*5*!p'=(anr"IT`wZG'2VWdfl\r)l[42u7JH`n(JUQ*e5*A|XCDf ?&\X&uwkl38"CYX3O8m}C8E4p'%N$2#kSTVzx{Ly|DjLT\Vk7NE}NQ(VC$Yq]i:7|z[.9iv^g>*8_B H0=hZt'[%)4kG|