git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 5, 2025, 23:49 UTC
Message-ID
<xmqqplgmlisy.fsf@gitster.g>
In-Reply-To
<PN3PR01MB95971B8A202ADEA412010B35B88E2@PN3PR01MB9597.INDPRD01.PROD.OUTLOOK.COM>
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.
Previous: Aditya GargNext: Aditya Garg
Message 17 of 68 in “Improve checks for valid_fqdn in send-email and update documentation”
  1. 0/3 Improve checks for valid_fqdn in send-email and update documentationAditya Garg, May 4, 2025
  2. 1/3 send-mail: improve checks for valid_fqdnAditya Garg, May 4, 2025
  3. Kristoffer HaugsbakkMay 4, 2025
  4. Aditya GargMay 4, 2025
  5. Kristoffer HaugsbakkMay 4, 2025
  6. 2/3 docs: improve send-email documentationAditya Garg, May 4, 2025
  7. 3/3 docs: add credential helper for outlook and gmail in OAuth list of helpersAditya Garg, May 4, 2025
  8. 0/3 Improve checks for valid_fqdn in send-email and update documentationAditya Garg, May 5, 2025
  9. 1/3 send-mail: improve checks for valid_fqdnAditya Garg, May 5, 2025
  10. 2/3 docs: improve send-email documentationAditya Garg, May 5, 2025
  11. Junio C HamanoMay 5, 2025
  12. Aditya GargMay 5, 2025
  13. 3/3 docs: add credential helper for outlook and gmail in OAuth list of helpersAditya Garg, May 5, 2025
  14. 0/3 Improve checks for valid_fqdn in send-email and update documentationAditya Garg, May 5, 2025
  15. 3/3 docs: add credential helper for outlook and gmail in OAuth list of helpersAditya Garg, May 5, 2025
  16. 1/3 send-mail: improve checks for valid_fqdnAditya Garg, May 5, 2025
  17. Junio C HamanoMay 5, 2025
  18. Aditya GargMay 6, 2025
  19. Aditya GargMay 6, 2025
  20. Aditya GargMay 6, 2025
  21. Junio C HamanoMay 6, 2025
  22. Junio C HamanoMay 6, 2025
  23. Aditya GargMay 6, 2025
  24. Aditya GargMay 6, 2025
  25. Junio C HamanoMay 6, 2025
  26. 2/3 docs: improve send-email documentationAditya Garg, May 5, 2025
  27. Junio C HamanoMay 5, 2025
  28. Aditya GargMay 6, 2025
  29. 0/3 Improve checks for valid_fqdn in send-email and update documentationAditya Garg, May 7, 2025
  30. 1/3 send-mail: improve checks for valid_fqdnAditya Garg, May 7, 2025
  31. Aditya GargMay 7, 2025
  32. Junio C HamanoMay 7, 2025
  33. Aditya GargMay 8, 2025
  34. 2/3 docs: improve send-email documentationAditya Garg, May 7, 2025
  35. Junio C HamanoMay 7, 2025
  36. Aditya GargMay 8, 2025
  37. Junio C HamanoMay 8, 2025
  38. Aditya GargMay 8, 2025
  39. Junio C HamanoMay 8, 2025
  40. Aditya GargMay 8, 2025
  41. Junio C HamanoMay 8, 2025
  42. Aditya GargMay 8, 2025
  43. Aditya GargMay 8, 2025
  44. 3/3 docs: add credential helper for outlook and gmail in OAuth list of helpersAditya Garg, May 7, 2025
  45. 0/3 Improve checks for valid_fqdn in send-email and update documentationAditya Garg, May 8, 2025
  46. 1/3 send-mail: improve checks for valid_fqdnAditya Garg, May 8, 2025
  47. 2/3 docs: improve send-email documentationAditya Garg, May 8, 2025
  48. 3/3 docs: add credential helper for outlook and gmail in OAuth list of helpersAditya Garg, May 8, 2025
  49. 0/3 Improve checks for valid_fqdn in send-email and update documentationAditya Garg, May 8, 2025
  50. 1/3 send-mail: improve checks for valid_fqdnAditya Garg, May 8, 2025
  51. 2/3 docs: improve send-email documentationAditya Garg, May 8, 2025
  52. 3/3 docs: add credential helper for outlook and gmail in OAuth list of helpersAditya Garg, May 8, 2025
  53. Junio C HamanoMay 8, 2025
  54. send-email: try to get fqdn by running hostname --fqdn on Linux and macOSAditya Garg, May 9, 2025
  55. Junio C HamanoMay 9, 2025
  56. send-email: try to get fqdn by running hostname --fqdn on Linux and macOSAditya Garg, May 10, 2025
  57. Julian SwagemakersMay 12, 2025
  58. Aditya GargMay 12, 2025
  59. Junio C HamanoMay 12, 2025
  60. Aditya GargMay 12, 2025
  61. Junio C HamanoMay 12, 2025
  62. Aditya GargMay 12, 2025
  63. Eric SunshineMay 12, 2025
  64. Junio C HamanoMay 12, 2025
  65. Aditya GargMay 13, 2025
  66. Junio C HamanoMay 12, 2025
  67. send-email: try to get fqdn by running hostname -f on Linux and macOSAditya Garg, May 12, 2025
  68. send-email: try to get fqdn by running hostname -f on Linux and macOSAditya Garg, May 12, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.