aboutsummaryrefslogtreecommitdiffstats
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim@guixotic.coop>2025-06-25 23:25:11 +0900
committerJunio C Hamano <gitster@pobox.com>2025-06-25 09:43:59 -0700
commit1926d9b6dac2cc7584362fb9275b55c2904891d3 (patch)
tree993980cb19b01d539cbef378399825d1dda772bd /git-send-email.perl
parentcontrib: warn for invalid netrc file ports in git-credential-netrc (diff)
downloadgit-1926d9b6dac2cc7584362fb9275b55c2904891d3.tar.gz
git-1926d9b6dac2cc7584362fb9275b55c2904891d3.zip
contrib: better support symbolic port names in git-credential-netrc
To improve support for symbolic port names in netrc files, this changes does the following: - Treat symbolic port names as ports, not protocols in git-credential-netrc - Validate the SMTP server port provided to send-email - Convert the above symbolic port names to their numerical values. Before this change, it was not possible to have a SMTP server port set to "smtps" in a netrc file (e.g. Emacs' ~/.authinfo.gpg), as it would be registered as a protocol and break the match for a "smtp" protocol host, as queried for by git-send-email. Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl11
1 files changed, 11 insertions, 0 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 659e6c588b..d2cf9b717a 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -2101,6 +2101,17 @@ if ($validate) {
}
}
+ # Validate the SMTP server port, if provided.
+ if (defined $smtp_server_port) {
+ my $port = Git::port_num($smtp_server_port);
+ if ($port) {
+ $smtp_server_port = $port;
+ } else {
+ die sprintf(__("error: invalid SMTP port '%s'\n"),
+ $smtp_server_port);
+ }
+ }
+
# Run the loop once again to avoid gaps in the counter due to FIFO
# arguments provided by the user.
my $num = 1;