Tin incorrectly parses comment blocks in CFWS blocks (per RFC5322 3.2.2)
On Sun, Nov 10, 2024 at 11:04:54PM -0600, Nicholas Boel wrote: Which version of tin are you reffering to? Please use the build-in BugReport ('R') funtion/key to report bugs as stated in the manual and README. The current snapshot (will be next stable release in about 6 weeks) has some modifications in parser in that directions ...
From: "Some Body" (Cool Guy) <somebody@example.com>
That From is illegal, unquoted words may not contain '!()<>@,;:\.[]' in route addresses. tin wouldn't allow you to post with that and will render it (to fix the mentiond issue) as: From: "\"Some Body\" (Cool Guy)" <somebody@example.com>
On 11/10/2024 11:42 PM, Urs Janßen wrote:
On Sun, Nov 10, 2024 at 11:04:54PM -0600, Nicholas Boel wrote:
Which version of tin are you reffering to? Please use the build-in BugReport ('R') funtion/key to report bugs as stated in the manual and README. The current snapshot (will be next stable release in about 6 weeks) has some modifications in parser in that directions ...
Ah, I didn't know about the built in bug report function. I just went with how you got ahold of me the last time I requested a feature. Thank you for letting me know and I will do this in the future, if needed. I'm using what I believe is the latest snapshot from: ftp://ftp.tin.org/pub/news/clients/tin/v2.6/snapshots/tin-2.6.4.tar.gz
From: "Some Body" (Cool Guy)<somebody@example.com> That From is illegal, unquoted words may not contain '!()<>@,;:\.[]' in route addresses. tin wouldn't allow you to post with that and will render it (to fix the mentiond issue) as:
From: "\"Some Body\" (Cool Guy)"<somebody@example.com>
Here is pertinent line from the server: "From: \"%s\" (%s) <%s>" and here is what tin is outputting in the header: From: "\"Some Body\" (Cool Guy)" <somebody@example.com> However, slrn (Linux) outputs this: From: "Some Body" (Cool Guy) <somebody@example.com> and Thunderbird (Windows) outputs this: Some Body (Cool Guy) <somebody@example.com> It was confusing to me that 3 different newsreaders are parsing it differently each time. However, tin seems to be the farthest off from what is expected. If this is correct behavior for tin, do you have any ideas as to why it is being displayed differently in all three newsreaders, or able to provide a better example of how this should work? -- Nick
On Mon, Nov 11, 2024 at 07:50:47AM -0600, Nicholas Boel wrote:
From: \"%s\" (%s) <%s>
which is illegal
and here is what tin is outputting in the header:
From: "\"Some Body\" (Cool Guy)" <somebody@example.com>
which would be legal
However, slrn (Linux) outputs this:
From: "Some Body" (Cool Guy) <somebody@example.com>
slrn displays it as it is where as tin reformats it so it can be passed on to a mailer if replying to such a post via email.
If this is correct behavior for tin, do you have any ideas as to why it is being displayed differently in all three newsreaders, or able to provide a better example of how this should work?
there is no such thing as "how it should work" when in the input is illegal. it would be even ok to refuse to load/display such an article at all.
Hey Urs, The first line you quoted below is not how I originally wrote it. I don't know if Thunderbird is removing quotes or not, but it should be: (quote)From: (backslash)(quote)%s(backslash)(quote) (%s) <%s>(quote) Either way, I've included Stephen, one of the developers of the server software I'm using. As we were in a lengthy conversation last night about this and I'm not much of a programmer, so I don't want any confusion here while trying to pass on what he says. On 11/11/2024 8:56 AM, Urs Janßen wrote:
On Mon, Nov 11, 2024 at 07:50:47AM -0600, Nicholas Boel wrote:
From: \"%s\" (%s) <%s> which is illegal
and here is what tin is outputting in the header:
From: "\"Some Body\" (Cool Guy)"<somebody@example.com> which would be legal
However, slrn (Linux) outputs this:
From: "Some Body" (Cool Guy)<somebody@example.com> slrn displays it as it is where as tin reformats it so it can be passed on to a mailer if replying to such a post via email.
If this is correct behavior for tin, do you have any ideas as to why it is being displayed differently in all three newsreaders, or able to provide a better example of how this should work? there is no such thing as "how it should work" when in the input is illegal. it would be even ok to refuse to load/display such an article at all.
-- Nick
Sorry about the formatting, I'm between mail clients right now, and using Thunderbird. On 2024-11-11 18:39, Nicholas Boel wrote:
Either way, I've included Stephen, one of the developers of the server software I'm using. As we were in a lengthy conversation last night about this and I'm not much of a programmer, so I don't want any confusion here while trying to pass on what he says.
Hey, just popping in to assert that: From: "Some Body" (Cool Guy) <somebody@example.com> Is legal but sketchy. The " (Cool Guy) " (including the spaces before and after) is CFWS (Comment + Folding White Space) as allowed in the RFCs since 822. " (Cool Guy)" is a comment. Section 3.2.2 in RFC-5322 covers this in detail and contains the CFWS ABNF grammar... the angle-addr grammar starts with optional CFWS, which makes it legal to put a comment (surrounded by parentheses) before there. Most importantly, is the final paragraph which states "Runs of FWS, comment, or CFWS that occur between lexical tokens in a structured header field are semantically interpreted as a single space character." The RFC does mention in 3.4 that comments SHOULD NOT be used in address fields (specifically to avoid confusing software that interprets comments), but it's strictly allowed by the standard. Generally, unless you want to specifically keep the comments in for a specific reason, the best thing to do with comments it to just fold them with the rest of the field and replace the whole CFWS run with a single space at the same time lines are being unwrapped prior to parsing. Basically, translate: From: "Some Body" (Cool Guy) <somebody@example.com> To: From: "Some Body" <somebody@example.com> What tin apparently does currently is changes it to: From: "\"Some Body\" (Cool Guy)" <somebody@example.com> Which places the CFWS inside the display-name. This is very close to being the same as converting: From: "Some Body" <somebody@example.com> To: From: "\"Some Body\"\r\n " <somebody@example.com> Horrifyingly, CFWS is used liberally in the grammar, so unfolding and stripping comments is an important part of parsing RFC-822 messages.
On Mon, Nov 11, 2024 at 07:33:26PM -0500, Stephen Hurd wrote:
Section 3.2.2 in RFC-5322 covers this in detail and contains the CFWS ABNF grammar... the angle-addr grammar starts with optional CFWS, which makes it legal to put a comment (surrounded by parentheses) before there. Most importantly, is the final paragraph which states "Runs of FWS, comment, or CFWS that occur between lexical tokens in a structured header field are semantically interpreted as a single space character."
*gnaa* you are correct, we overlooked the C in CFWS here. should be fixed in the next release (the code now renders the example Some Body" (Cool Guy) <somebody@example.com> as "Some Body" <somebody@example.com>
participants (4)
-
Nicholas Boel -
Stephen Hurd -
Urs Janßen -
Urs Janßen