Article View: news.software.nntp
Article #90192Re: Seeking help modifying Diablo source to prevent miscategorization of articles containing PGP
From: Jesse Rehmer
Date: Mon, 20 Mar 2023 23:14
Date: Mon, 20 Mar 2023 23:14
107 lines
5963 bytes
5963 bytes
On Mar 20, 2023 at 12:22:43 PM CDT, "Jesse Rehmer"
<jesse.rehmer@blueworldhosting.com> wrote:
> On Mar 20, 2023 at 11:37:46 AM CDT, "Tom Furie" <tom@furie.org.uk> wrote:
>
>> On 2023-03-20, Jesse Rehmer <jesse.rehmer@blueworldhosting.com> wrote:
>>> I'm a bit confused by it's intended behavior, as I thought it was only for
>>> rejecting misplaced binaries, but looking at the logs I see it is
>>> identifying these particular messages as some other type, but according to
>>> what is in lib/defs.h, I can't quite make heads or tails of how these
>>> translate.
>>>
>>> Take these two entries for example:
>>>
>>> 2023-03-20 01:00:03.737 somehost - <tv8sp3$fql$1@rasp.pasdenom.info> 2642
>>> 020b00 IncomingFilter
>>> 2023-03-20 01:00:03.738 somehost - <tv8sp3$fql$1@rasp.pasdenom.info> 2656
>>> 020b00 IncomingFilter
>>>
>>> The article type logged is "020b00", which that string does not appear
>>> anywhere in the source code. In lib/defs.h there is the following block:
>>>
>>> /*
>>> * Article types that diablo can determine when receiving an article
>>> */
>>>
>>> #define ARTTYPE_NONE 0x000000
>>>
>>> #define ARTTYPE_DEFAULT 0x000001
>>> #define ARTTYPE_CONTROL 0x000002
>>> #define ARTTYPE_CANCEL 0x000004
>>>
>>> #define ARTTYPE_MIME 0x000100
>>> #define ARTTYPE_BINARY 0x000200
>>> #define ARTTYPE_UUENCODE 0x000400
>>> #define ARTTYPE_BASE64 0x000800
>>> #define ARTTYPE_MULTIPART 0x001000
>>> #define ARTTYPE_HTML 0x002000
>>> #define ARTTYPE_PS 0x004000
>>> #define ARTTYPE_BINHEX 0x008000
>>> #define ARTTYPE_PARTIAL 0x010000
>>> #define ARTTYPE_PGPMESSAGE 0x020000
>>> #define ARTTYPE_YENC 0x040000
>>> #define ARTTYPE_BOMMANEWS 0x080000
>>> #define ARTTYPE_UNIDATA 0x100000
>>>
>>> #define ARTTYPE_ALL 0xFFFFFF
>>
>> This looks like a bitfield map, so the 020b00 you see above equates to a sum
>> of PGPMESSAGE + BASE64 + BINARY + MIME. At least it's recognised the PGP
>> element. The size of the signature (greater than the 8 line limit in the
>> earlier check) seems to be what triggers the filter to flag the article as
>> binary.
>
> Ahhh thank you, this makes sense.
>
> I did move the PGP related if statements above the others as you had suggested
> earlier. So far, so good, but may take a while to know for sure. The changes
> didn't break the binary detection, so there's that.
>
> I'm curious if there's any known reason why the developers chose 8 lines for
> the checks? I assume this is somewhat arbitrary, but not certain, and thinking
> if I'm still having trouble raising that value may be a better solution than
> trying to make the code do things I don't fully understand.
I backed out several of the changes I had made that weren't successful. I
believe moving the if statement for the PGP stuff at the top of this block and
adding "return(Type);" is working as expected. I was able to re-send some
articles that were previously rejected and they made it through.
How syntactically correct it is, I don't know, but I'm still seeing it filter
misplaced binaries and other useless Base64 encoded articles like I want, but
so far no PGP messages have been filtered.
/*
* 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 (*ptr == '-' &&
strncmp(ptr, "-----BEGIN PGP ", 15) == 0)
Type |= ARTTYPE_PGPMESSAGE;
return(Type);
UUencode = 0;
Base64 = 0;
BinHex = 0;
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);
}
Technical Details
Message-ID:
<tvapdi$2ade$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-mailReferences:
<tv8ale$2t9m$1@nnrp.usenet.blueworldhosting.com> <tv9cuv$3ti$1@freeq.furie.org.uk> <tv9qce$dtq$1@nnrp.usenet.blueworldhosting.com> <tva24q$dcm$1@freeq.furie.org.uk> <tva4p3$2b2p$1@nnrp.usenet.blueworldhosting.com>Show Full Headers
Complete Article Headers
Message-ID: <tvapdi$2ade$1@nnrp.usenet.blueworldhosting.com> Subject: Re: Seeking help modifying Diablo source to prevent miscategorization of articles containing PGP Date: Mon, 20 Mar 2023 23:14:58 +0000 From: Jesse Rehmer <jesse.rehmer@blueworldhosting.com> References: <tv8ale$2t9m$1@nnrp.usenet.blueworldhosting.com> <tv9cuv$3ti$1@freeq.furie.org.uk> <tv9qce$dtq$1@nnrp.usenet.blueworldhosting.com> <tva24q$dcm$1@freeq.furie.org.uk> <tva4p3$2b2p$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: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com) Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=fixed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 20 Mar 2023 23:14:58 -0000 (UTC) Injection-Info: nnrp.usenet.blueworldhosting.com; logging-data="76206"; mail-complaints-to="usenet@blueworldhosting.com" User-Agent: Usenapp for MacOS Cancel-Lock: sha1:CJ+FL18RNI+7FMCFAZSIrQlA+Pw= sha256:1PivZi83uXzjN1bVnlVNqA1axJDpTciSUzBAWGbj6uw= sha1:Zq9/n4C6mLnsfwJrKboss/QmJfE= sha256:fP9y0F5/LKqmQreom5HvFWtSqlGb+hIsjtDFCSFKEA8= X-Usenapp: v1.26.3/d - Full License Lines: 106