Subject: Re: [PATCH v3 1/3] send-mail: improve checks for valid_fqdn

From: Junio C Hamano <[email-masked]>
Date: Tue, 06 May 2025 14:59:24 -0700

Aditya Garg <[email-masked]> writes:

> As far as the script is concerned,
>
> - The script currently checks the presence of a period in the fqdn.

I suspect that this is overly strict in a strictly local settings.

> - At the same time, the script does NOT check whether the fqdn
> starts or ends with a period.

As a DNS domainname, starting with is problematic, but ending with a
period (e.g., "example.com.") should be OK, as long as the last
label is truly a top-level domain name.  I however think 

> - Also, it does NOT check if 2 periods are together or not.

That does sound problematic.

> a fqdn without a dot at all gets accepted by my Outlook server, ...
> ... afterall no FQDN would have these things.

True; we need to be careful here, though---after all the world is
not necessarily RFC 5321 compliant, as your Outlook server shows, if
accepts a name without any dot and is not a top-level domain.

So I think "one or more <upto 63 octet run of alnum or hyphen that
does not begin or end with hyphen>, separated by a single dot in
between each" (which is probably what you wanted to say in your
regexp, even though it wasn't clear to me if you restricted the
second and subsequent labels like you did the first one correctly)
would be a reasonable check to have.