Eric S Raymond <esr(_at_)thyrsus(_dot_)com> writes:
Scott Gifford <sgifford(_at_)suspectclass(_dot_)com>:
I've written a patch (against 5.9.11) which fixes this. It puts the
server's name in square brackets when using it in the MAIL FROM
command if it looks like an IP address in dotted-quad format. It's
mostly tested, although my hosting provider recently stopped accepting
mail with an unqualified envelope sender, so the testing wasn't
perfect.
Taken. I wonder why I never saw this patch before?
<shrug> It was a few messages into a thread; maybe I should have
posted the patch in a new thread with a new subject.
Which RFC requires the square brackets?
RFC2821; Sec. 4.1.3 says:
Sometimes a host is not known to the domain name system and
communication (and, in particular, communication to report and
repair the error) is blocked. To bypass this barrier a special
literal form of the address is allowed as an alternative to a
domain name. For IPv4 addresses, this form uses four small decimal
integers separated by dots and enclosed by brackets such as
[123.255.37.2], which indicates an (IPv4) Internet Address in
sequence-of-octets form. For IPv6 and other forms [ ... ]
The definition of MAIL FROM in Sec. 4.1.1.2:
Syntax:
"MAIL FROM:" ("<>" / Reverse-Path)
[SP Mail-parameters] CRLF
in combination with the BNF syntax in 4.1.2 (presented out of order
here):
Reverse-path = Path
Path = "<" [ A-d-l ":" ] Mailbox ">"
Mailbox = Local-part "@" Domain
Domain = (sub-domain 1*("." sub-domain)) / address-literal
address-literal = "[" IPv4-address-literal /
IPv6-address-literal /
General-address-literal "]"
; See section 4.1.3
sub-domain = Let-dig [Ldh-str]
says the same thing in a more formal way.
----ScottG.