Re: [PATCH v3 1/3] send-mail: improve checks for valid_fqdn
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 6, 2025, 22:07 UTC
- Message-ID
- <xmqqzffpfl57.fsf@gitster.g>
- In-Reply-To
- <PN3PR01MB959731081532150F5FE54875B889A@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
Aditya Garg <gargaditya08@live.com> writes:
Show 10 quoted lines
>> * ... but I don't know if your use of negative lookaround >> assersions is correct. Shouldn't the "a label cannot begin or >> end with dash" be applied not just to the first label but >> consistently to all of the dot-separated labels? > > I think you are talking about this case: > > someone.-example.com > > No, its not valid.a
I was not talking about any "case"; I was talking more about your regexp to catch invalid addresses. From RFC 5321,
helo = "HELO" SP Domain CRLF
Domain = sub-domain *("." sub-domain)
sub-domain = Let-dig [Ldh-str]
Let-dig = ALPHA / DIGIT
Ldh-str = *( ALPHA / DIGIT / "-" ) Let-digso the syntax for first "sub-domain" applies equally to the other "sub-domain". If "-example" cannot be the third-level subdomain, then it equally cannot be the second-level, either, but IIRC, the patch had regexp that treated the first level differently from the rest.