437 Body of header is all blanks
Russ Allbery
rra at stanford.edu
Sun Jun 6 19:09:28 UTC 2004
Christoph Biedl <cbiedl at gmx.de> writes:
> The article arrives at my INN 2.4.1 and is rejected with the message
> above, since Organization is a "Standard optional header" which may not
> be empty from innd's point of view. It may be missing but if present it
> must be filled with content. This check takes place in ARTparseheader
> innd/art.c.
It used to be that innd would just rewrite the message to remove those
headers, which was an even worse violation of the standard. This was
changed in INN 2.3. I'm not positive of the history of it.
This is one of the warts in INN's header parsing that I've been meaning to
clean up, but haven't had a chance to look at the implications. I believe
it should be fine to just remove this check, though; there's nothing
syntactically wrong about empty headers as long as they have the space
after the colon, and the rest of INN should cope.
Note that innd also doesn't consider any leading blanks in the header
value to be part of the header, which I think is also broken.
I've had very bad luck changing this part of innd in STABLE, so I'm going
to hold off making any changes there until after we get the next version
of INN released. I'm applying the patch below to CURRENT, since I think
it will do more the right thing.
> Furthermore, I understand innd's behaviour as a violation of USEFOR.
USEFOR is not worth paying attention to; the relevant standard in this
case is RFC 2822. Organization is an unstructured header, so its content
is defined by:
unstructured = *([FWS] utext) [FWS]
which allows an empty header. INN should really both accept and propagate
messages of this type. (Note that Usenet by way of RFC 1036 does impose
an additional restriction over RFC 2822, namely that there be a single
space after the colon.)
> [2] nnrpd isn't perfect in that, too. When posting an article,
> "Summary: " would get stripped, "X-Newsreader: " not.
nnrpd's header parsing is even more of a mess than innd's in some ways.
--- inn/innd/art.c 2004/05/25 07:47:58 1.232
+++ inn/innd/art.c 2004/06/06 19:06:18
@@ -677,17 +677,9 @@ ARTcheckheader(CHANNEL *cp, int size)
/* duplicated */
hc->Length = -1;
} else {
- for (p = colon + 1 ; (p < header + size - 2) &&
- (ISWHITE(*p) || *p == '\r' || *p == '\n'); p++);
- if (p < header + size - 2) {
- hc->Value = p;
- /* HDR_LEN() does not include trailing "\r\n" */
- hc->Length = header + size - 2 - p;
- } else {
- snprintf(cp->Error, sizeof(cp->Error),
- "%d Body of header is all blanks in \"%s\" header",
- NNTP_REJECTIT_VAL, MaxLength(hp->Name, hp->Name));
- }
+ hc->Value = colon + 2;
+ /* HDR_LEN() does not include trailing "\r\n" */
+ hc->Length = size - (hc->Value - header) - 2;
}
return;
}
@@ -711,6 +703,8 @@ ARTidok(const char *MessageID)
/* Scan local-part: "< atom|quoted [ . atom|quoted]" */
p = MessageID;
+ while (*p != '\0' && ISSPACE(*p))
+ p++;
if (*p++ != '<')
return false;
for (; ; p++) {
@@ -770,6 +764,8 @@ ARTidok(const char *MessageID)
break;
}
+ while (*p != '\0' && ISSPACE(*p))
+ p++;
return *p == '>' && *++p == '\0';
}
--
Russ Allbery (rra at stanford.edu) <http://www.eyrie.org/~eagle/>
Please send questions to the list rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
More information about the inn-workers
mailing list