git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Aditya Garg <gargaditya08@live.com>
Cc: git@vger.kernel.org,  M Hickford <mirth.hickford@gmail.com>,
	 Julian Swagemakers <julian@swagemakers.org>,
	 sandals@crustytoothpaste.net,
	 Eric Sunshine <sunshine@sunshineco.com>,
	 Zi Yao <ziyao@disroot.org>,
	Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Subject: Re: [PATCH v3 1/3] send-mail: improve checks for valid_fqdn
Date: Mon, 05 May 2025 16:49:33 -0700	[thread overview]
Message-ID: <xmqqplgmlisy.fsf@gitster.g> (raw)
In-Reply-To: <PN3PR01MB95971B8A202ADEA412010B35B88E2@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM> (Aditya Garg's message of "Mon, 5 May 2025 15:23:03 +0000")

Aditya Garg <gargaditya08@live.com> writes:

> Due to current implementation, I was not able to send emails from
> Ubuntu.

It may be that send-email did not complain, but I have a suspicion
that it the above is only half truth.  We do have an ugly last-ditch
fallback to claim that we are localhost.localdomain, instead of
using a misconfigured maildomain name that servers would not like,
but that name is a meaningless name; from the point of view of the
server, if everybody uses that name, the name loses the meaning as
an identifier.

It is more like due to misconfiguration you couldn't send e-mails,
and by tightening the condition to tell an invalid maildomain name
and have the misconfigured maildomain name that is invalid replaced
with "localhost.localdomain" fallback, you managed to send things
out.

The real fix for individual users may probably be to see how
maildomain_net() and/or maildomain_mta() gives you a bogus
"Macbook.." and fix _that_.  Until that gets fixed, trying to use
"localhost.localdomain" fallback might be a good workaround, but
that is a workaround, not a real solution, isn't it?

When using this fallback, we are at server's mercy; if a server
checks the name you give it against your IP address, for example,
the "localhost.localdomain" fallback may be rejected and you would
need to figure out the real maildomain name the server wants you to
identify as.  What I am worried about this patch the most is if it
is tightening valid_fqdn too much to make a good maildomain name
that real users are currently using to cause them to instead use the
"localhost.localdomain" fallback, and their SMTP servers are not
as lenient as your case and start rejecting their requests.

With a cursory read of this patch, I think basic "at most 63 Alnum
or dash" DNS label defined in the ASCII-only era may be sufficient
for 99% of the users, so I am not too worried by this particular
change (I do not think anybody uses those UUCP!style!addresses
anymore these days), but this patch is an example why we always
want to be careful not to introduce unintended regressions.

> Upon debugging, I found that the SMTP domain was coming out
> to be "MacBook.." and was being considered as valid.

"as valid." -> "as valid, which prevented the fallback
localhost.localdomain from being used."

> As a result
> the script was failing. The debug logs with the failed script are
> below:

Don't give overly long and irrelevant details.  Say something like

	The SMTP exchange started like this:

	<<< 220 ...outlook.office365.com Microsoft ...
	>>> EHLO MacBook..
	<<< 501 5.5.4 Invalid domain name ...

	Notice that an invalid domain name "MacBook.." is sent by
	git-send-email.  We have a fallback code that checks output
	from Net::Domain::domainname() or asking domain method of an
	Net::SMTP instance to detect a misconfigured hostname and
	replace it with fallback "localhost.localdomain", but
	the valid_fqdn apparently is failing to say "MacBook.." is
	not a valid_fqdn.

	With this patch, the rule used in valid_fqdn is tightened,
	the beginning part of the SMTP exchange looked like this:

	<<< 220 ...outlook.office365.com Microsoft ...
	>>> EHLO localhost.localdomain
	<<< 250-250-PN4P287CA0064.outlook.office365.com Hello ...
	<<< 250 ...

	and the server I was using to test this patch was happy with
	the fallback "localhost.localdomain":

perhaps?

Thanks.

  reply	other threads:[~2025-05-05 23:49 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-04 13:54 [PATCH 0/3] Improve checks for valid_fqdn in send-email and update documentation Aditya Garg
2025-05-04 13:54 ` [PATCH 1/3] send-mail: improve checks for valid_fqdn Aditya Garg
2025-05-04 14:22   ` Kristoffer Haugsbakk
2025-05-04 15:26     ` Aditya Garg
2025-05-04 16:05       ` Kristoffer Haugsbakk
2025-05-04 13:54 ` [PATCH 2/3] docs: improve send-email documentation Aditya Garg
2025-05-04 13:54 ` [PATCH 3/3] docs: add credential helper for outlook and gmail in OAuth list of helpers Aditya Garg
2025-05-05  6:16 ` [PATCH v2 0/3] Improve checks for valid_fqdn in send-email and update documentation Aditya Garg
2025-05-05  6:16   ` [PATCH v2 1/3] send-mail: improve checks for valid_fqdn Aditya Garg
2025-05-05  6:16   ` [PATCH v2 2/3] docs: improve send-email documentation Aditya Garg
2025-05-05 19:20     ` Junio C Hamano
2025-05-05 19:30       ` Aditya Garg
2025-05-05  6:16   ` [PATCH v2 3/3] docs: add credential helper for outlook and gmail in OAuth list of helpers Aditya Garg
2025-05-05 15:23 ` [PATCH v3 0/3] Improve checks for valid_fqdn in send-email and update documentation Aditya Garg
2025-05-05 15:23   ` [PATCH v3 1/3] send-mail: improve checks for valid_fqdn Aditya Garg
2025-05-05 23:49     ` Junio C Hamano [this message]
2025-05-06  5:38       ` Aditya Garg
2025-05-06  9:35         ` Aditya Garg
2025-05-06 16:50           ` Aditya Garg
2025-05-06 21:59             ` Junio C Hamano
2025-05-06 17:11           ` Junio C Hamano
2025-05-06 17:23             ` Aditya Garg
2025-05-06 17:49               ` Aditya Garg
2025-05-06 22:07               ` Junio C Hamano
2025-05-05 15:23   ` [PATCH v3 2/3] docs: improve send-email documentation Aditya Garg
2025-05-05 23:54     ` Junio C Hamano
2025-05-06  5:36       ` Aditya Garg
2025-05-05 15:23   ` [PATCH v3 3/3] docs: add credential helper for outlook and gmail in OAuth list of helpers Aditya Garg
2025-05-07 12:33 ` [PATCH v4 0/3] Improve checks for valid_fqdn in send-email and update documentation Aditya Garg
2025-05-07 12:33   ` [PATCH v4 1/3] send-mail: improve checks for valid_fqdn Aditya Garg
2025-05-07 12:48     ` Aditya Garg
2025-05-07 22:42     ` Junio C Hamano
2025-05-08 10:38       ` Aditya Garg
2025-05-07 12:33   ` [PATCH v4 2/3] docs: improve send-email documentation Aditya Garg
2025-05-07 22:21     ` Junio C Hamano
2025-05-08  3:29       ` Aditya Garg
2025-05-08 13:33         ` Junio C Hamano
2025-05-08 13:52           ` Aditya Garg
2025-05-08 16:23             ` Junio C Hamano
2025-05-08 16:38               ` Aditya Garg
2025-05-08 14:52           ` Junio C Hamano
2025-05-08 15:05             ` Aditya Garg
2025-05-08 15:08               ` Aditya Garg
2025-05-07 12:33   ` [PATCH v4 3/3] docs: add credential helper for outlook and gmail in OAuth list of helpers Aditya Garg
2025-05-08 15:18 ` [PATCH v6 0/3] Improve checks for valid_fqdn in send-email and update documentation Aditya Garg
2025-05-08 15:18   ` [PATCH v6 1/3] send-mail: improve checks for valid_fqdn Aditya Garg
2025-05-08 15:18   ` [PATCH v6 2/3] docs: improve send-email documentation Aditya Garg
2025-05-08 15:18   ` [PATCH v6 3/3] docs: add credential helper for outlook and gmail in OAuth list of helpers Aditya Garg
2025-05-08 17:14 ` [PATCH v7 0/3] Improve checks for valid_fqdn in send-email and update documentation Aditya Garg
2025-05-08 17:14   ` [PATCH v7 1/3] send-mail: improve checks for valid_fqdn Aditya Garg
2025-05-08 17:14   ` [PATCH v7 2/3] docs: improve send-email documentation Aditya Garg
2025-05-08 17:14   ` [PATCH v7 3/3] docs: add credential helper for outlook and gmail in OAuth list of helpers Aditya Garg
2025-05-08 18:08   ` [PATCH v7 0/3] Improve checks for valid_fqdn in send-email and update documentation Junio C Hamano
2025-05-09 16:49   ` [PATCH] send-email: try to get fqdn by running hostname --fqdn on Linux and macOS Aditya Garg
2025-05-09 20:13     ` Junio C Hamano
2025-05-10  7:37     ` [PATCH v2] " Aditya Garg
2025-05-12  7:46       ` Julian Swagemakers
2025-05-12  7:49         ` Aditya Garg
2025-05-12 16:42         ` Junio C Hamano
2025-05-12 16:46           ` Aditya Garg
2025-05-12 17:34             ` Junio C Hamano
2025-05-12 17:42               ` Aditya Garg
2025-05-12 19:05               ` Eric Sunshine
2025-05-12 20:15                 ` Junio C Hamano
2025-05-13 12:28                   ` Aditya Garg
2025-05-12 13:32       ` Junio C Hamano
2025-05-12  8:11     ` [PATCH v3] send-email: try to get fqdn by running hostname -f " Aditya Garg
2025-05-12 17:16     ` [PATCH v4] " Aditya Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqplgmlisy.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=gargaditya08@live.com \
    --cc=git@vger.kernel.org \
    --cc=julian@swagemakers.org \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=mirth.hickford@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    --cc=sunshine@sunshineco.com \
    --cc=ziyao@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).