Live data from Hacker News

The curious case of the missing period

tjaart.substack.com

111–120 of 201 posts

Re: The curious case of the missing period

#111
post #108

Earlier quoted context omitted.

The real problem is that SMTP is a "plain-text" protocol that includes in-band signaling. It literally happened because SMTP defined "a line that only contains a single period in it" as a control sequence and not a literal line that only contains a single period in it. SMTP is an example of an unnecessarily complex design, and the implementation bugs reflect it. SMTP shouldn't be hard for someone to correctly impleme…

Why didn't they use actual control sequences instead of text chars, ASCII had plenty of those?

When your debugger is telnet circa 1980, non-printable characters are a liability. (You pay for it later, when people who've never seen "...end with ." botch the implementation.)

Re: The curious case of the missing period

#112
- The SMTP client they implemented could insert a newline such that a line was comprised of only a single period.

- The SMTP client spec says that an additional period would be added here.

- The SMTP server spec says that it would remove this additional period, bringing us back to one period.

I don’t get how this led to there being no period at all. Am I missing something?

Re: The curious case of the missing period

#113

- The SMTP client they implemented could insert a newline such that a line was comprised of only a single period. - The SMTP client spec says that an additional period would be added here. - The SMTP server spec says that it would remove this additional period, bringing us back to one period. I don’t get how this led to there being no period at all. Am I missing something?

The spec says that an additional period should be added on the client, but their implementation did not do that.

Re: The curious case of the missing period

#116
post #5

> A portion of this code implemented a SMTP client. If I wanted to root cause this, the real problem is right there. Implementing protocols correctly is hard and bugs like in the post are common. A properly implemented SMTP client library, like one you would pull off the shelf, would accept text and encode it properly per the SMTP protocol, regardless of where the periods were in the input. The templating layer shoul…

Sounds like a great idea, until you find that your SMTP library pulls in 5 other libraries as its own dependencies and those each pull in 3 transitive dependencies of their own, one being some kitchen sink/toolbox project where only 1% of its code is actually relevant to the dependant and the rest is dead weight - but which pulls in 20 more dependencies for functions that are literally never called in your project - and before you know it, your codebase bloats up by several MB and you get CVE warnings for libraries that you didn't even know existed, let alone that you're using them.

Re: The curious case of the missing period

#118
>the first character is a period and there are other characters on the line, the first character is deleted.

Why is it implemented that way?

If a single period means end of mail then more than a period means it's mail data.

Why deleting the period in the first place? Couldn't they store one byte to check the next?

Re: The curious case of the missing period

#120
post #118

>the first character is a period and there are other characters on the line, the first character is deleted. Why is it implemented that way? If a single period means end of mail then more than a period means it's mail data. Why deleting the period in the first place? Couldn't they store one byte to check the next?

Cause you have to send a line with a single period somehow.

  .     Ends body
  ..    One period 
Anyway that’s stupid and only helps if you compose your email right in a tcp session.
Post reply on HN