🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #90401

[inn] Header folded immediately after header name results in "invalid syntax encountered" posting error

#90401
From: Adam W.
Date: Tue, 06 Jun 2023 19:49
46 lines
2630 bytes
Hi,

inn version 2.7.0.

Let's try to post this message (minimal example):

#v+
From: test@test.test
Newsgroups: alt.test
Subject:
 test

test
#v-

The Subject header body is folded here, but immediately after the header 
name. The real life example is when Message-ID body is too long to fit in 
the same line with the header name (and that's why I detected it and 
started digging).

When trying to post it, I'm getting message:

441 Invalid syntax encountered in Subject header field body (unexpected byte or empty content line)

The check is done in nnrpd/post.c. Function IsValidHeaderBody is called 
(from libinn, headers.c), which does some checks on the header to check 
if it's sane.

When calling this function with an argument "\n test", this check is 
triggered:

/* Folding detected.  We expect CRLF or lone LF as some parts
 * of INN code internally remove CR.
 * Check that the line that has just been processed is not
 * "empty" and that the following character marks the beginning
 * of a continuation line. */
if (emptycontentline || !ISWHITE(p[1])) {
    printf("false1 p[1]=%d\n", p[1]);
    return false;
}

I believe this test is wrong, as emptycontentline will always be false if 
the header body (value) is folded just after the header name. It's been 
there since 2016, so I doubt I'm the only one who encountered this 
error... or maybe that's not an error and this header is in fact wrong 
and should not be folded (and it's a bug in formail then)?
Technical Details
Message-ID: <u5o2l1$lml$1$arnold@news.chmurka.net>
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

Show Full Headers
Complete Article Headers
Message-ID: <u5o2l1$lml$1$arnold@news.chmurka.net>
Subject: [inn] Header folded immediately after header name results in "invalid syntax encountered" posting error
Date: Tue, 06 Jun 2023 19:49:53 +0000
From: gof-cut-this-news@cut-this-chmurka.net.invalid (Adam W.)
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: news.chmurka.net
Nntp-Posting-Host: s.v.chmurka.net
Injection-Date: Tue, 6 Jun 2023 19:49:53 -0000 (UTC)
Injection-Info: news.chmurka.net; posting-account="arnold"; posting-host="s.v.chmurka.net:172.24.44.20"; logging-data="22229"; mail-complaints-to="abuse-news.(at).chmurka.net"
User-Agent: tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.32-v7+ (armv7l))
Cancel-Lock: sha1:M1a+hbwDHEtjSNQsSRDGnB8ziuA= sha1:fmAWdWa7FiKwNqaUbCaN4z5HOQg= sha256:U0EFPoFoLVCJx6gjd4EoT5A5nD9oXylyEshiCAYnL8w= sha1:y+DJICUIpJzjKw5OV0aIhZqx+iY= sha256:WAtjMvFrUp3uC7CqQkMVxBz+nKNjBkaVBZcVdiouv0g=