Odd diagnostic

Julien ÉLIE julien at trigofacile.com
Mon Jun 29 11:52:33 UTC 2015


Hi Richard,

> Something I noticed during testing; see attached.  I've not had time to
> investigate this but I think it must indicate a bug in nnrpd's article
> parser.

Oh, yes, indeed.
Continuation lines in headers are not properly parsed.  The fact that the
first character in the next line is whitespace was not in the condition.
I believe the following patch fixes the issue:


--- post.c	(révision 9898)
+++ post.c	(copie de travail)
@@ -226,8 +226,10 @@
 		hp->Value = &p[hp->Size + 1];
 		/* '\r\n' is replaced with '\n', and unnecessary to consider
 		 * '\r'. */
-		for (q = &p[hp->Size + 1]; ISWHITE(*q) || *q == '\n'; q++)
+		for (q = &p[hp->Size + 1]; ISWHITE(*q)
+		     || (*q == '\n' && ISWHITE(q[1])) ; q++)
 		    continue;
 		hp->Body = q;
 		break;
 	    }



"Newsgroups:\r\n"

POST
340 Ok, recommended message-ID <mmraje$13f$1 at news.trigofacile.com>
Subject: test
Newsgroups:
From: rjk at greenend.org.uk

test message
.
441 Can't parse Newsgroups: header



"Newsgroups: \r\n"

POST
340 Ok, recommended message-ID <mmrakk$13f$2 at news.trigofacile.com>
Subject: test
Newsgroups: 
From: rjk at greenend.org.uk

test message
.
441 Can't parse Newsgroups: header




"Newsgroups: a\r\n"

POST
340 Ok, recommended message-ID <mmraku$13f$3 at news.trigofacile.com>
Subject: test
Newsgroups: a
From: rjk at greenend.org.uk

test message
.
441 No valid newsgroups in "a"



"Newsgroups:\r\n a\r\n"

POST
340 Ok, recommended message-ID <mmral7$13f$4 at news.trigofacile.com>
Subject: test
Newsgroups:
 a
From: rjk at greenend.org.uk

test message
.
441 No valid newsgroups in "a"



"Newsgroups:\r\n \r\n"

POST
340 Ok, recommended message-ID <mmralm$13f$5 at news.trigofacile.com>
Subject: test
Newsgroups:
 
From: rjk at greenend.org.uk

test message
.
441 Can't parse Newsgroups: header



Seems to parse correctly now.

-- 
Julien ÉLIE

« Le temps, c'est des sesterces. » (Coquelus)


More information about the inn-workers mailing list