Article View: news.software.nntp
Article #90060Re: No colon-space in header field check in INN
From: Julien ÉLIE
Date: Fri, 03 Feb 2023 20:03
Date: Fri, 03 Feb 2023 20:03
60 lines
3558 bytes
3558 bytes
Hi Jesse,
> I've been on auto-pilot for a bit, but started checking logs/reports today and
> notice an increasing number of articles rejected due to the following:
>
> 439 No colon-space in "User-Agent:" header field
>
> When reviewing headers of the those messages there is a User-Agent: header,
> but its blank and does not contain a space.
>
> It is probably against a RFC to accept these messages
Indeed, they shouldn't have been accepted by injecting agents.
Some posting agents send empty header fields, which are usually stripped
off by injecting agents before injecting the article.
> but I'm not concerned
> about the User-Agent header. I went looking for a way to relax the check, but
> is strict for all headers in innd/art.c:
>
> /* Find first colon */
> if ((colon = memchr(header, ':', size)) == NULL || !ISWHITE(colon[1])) {
> if ((p = memchr(header, '\r', size)) != NULL)
> *p = '\0';
> snprintf(cp->Error, sizeof(cp->Error),
> "%d No colon-space in \"%s\" header field",
> ihave ? NNTP_FAIL_IHAVE_REJECT : NNTP_FAIL_TAKETHIS_REJECT,
> MaxLength(header, header));
> if (p != NULL)
> *p = '\r';
> return;
> }
If you're looking for a quick-and-dirty hack for that very header field,
I think the following check would do the trick (not tested):
@@ -644,10 +644,12 @@ ARTcheckheader(CHANNEL *cp, int size)
if ((colon = memchr(header, ':', size)) == NULL ||
!ISWHITE(colon[1])) {
if ((p = memchr(header, '\r', size)) != NULL)
*p = '\0';
+ if (strcasecmp(header, "User-Agent:") != 0 || colon[1] != '\0') {
snprintf(cp->Error, sizeof(cp->Error),
"%d No colon-space in \"%s\" header field",
ihave ? NNTP_FAIL_IHAVE_REJECT :
NNTP_FAIL_TAKETHIS_REJECT,
MaxLength(header, header));
+ }
if (p != NULL)
*p = '\r';
return;
--
Julien ÉLIE
« – Ce n'était pas ma question.
– C'était p'têt pas vot'question, oui, mais c'est ma réponse ! »
(Georges Marchais répondant à Alain Duhamel)
Technical Details
Message-ID:
<trjpa2$j086$1@news.trigofacile.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:
<trd09m$1369$1@nnrp.usenet.blueworldhosting.com>Show Full Headers
Complete Article Headers
Message-ID: <trjpa2$j086$1@news.trigofacile.com> Subject: Re: No colon-space in header field check in INN Date: Fri, 3 Feb 2023 21:03:14 +0100 From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> References: <trd09m$1369$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: Groupes francophones par TrigoFACILE Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 3 Feb 2023 20:03:14 -0000 (UTC) Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="176-143-2-105.abo.bbox.fr:176.143.2.105"; logging-data="622854"; mail-complaints-to="abuse@trigofacile.com" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Cancel-Lock: sha1:n4CtYMOjlyiwkunWc2dJ8i+R3t0= sha256:duLI3NAM4H7GbBFTIft77S3Wf8AErQCI6oNfv68S0Tg= sha1:vrF5lOOyMDwmBzeXjl/NbDjyehY= sha256:pbQSUDk1ZYcjV5jBYW6tupyOyVuoOmi2iY/sHbVGBFU= In-Reply-To: <trd09m$1369$1@nnrp.usenet.blueworldhosting.com> Lines: 59