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

[PATCH] send-email: report host and port separately when calling git credential

From
Michal Nazarewicz <mina86@mina86.com>
Date
Mar 31, 2018, 18:05 UTC
Message-ID
<20180331180514.14628-1-mina86@mina86.com>

When git-send-email uses git-credential to get SMTP password, it will communicate SMTP host and port (if both are provided) as a single entry ‘host=<host>:<port>’. This trips the ‘git-credential-store’ helper which expects those values as separate keys (‘host’ and ‘port’).

Send the values as separate pieces of information so things work smoothly.

Signed-off-by: Michał Nazarewicz <mina86@mina86.com>
---
 git-send-email.perl | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 2fa7818ca..2a9f89a58 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1229,14 +1229,6 @@ sub maildomain {
 	return maildomain_net() || maildomain_mta() || 'localhost.localdomain';
 }
 
-sub smtp_host_string {
-	if (defined $smtp_server_port) {
-		return "$smtp_server:$smtp_server_port";
-	} else {
-		return $smtp_server;
-	}
-}
-
 # Returns 1 if authentication succeeded or was not necessary
 # (smtp_user was not specified), and 0 otherwise.
 
@@ -1263,7 +1255,8 @@ sub smtp_auth_maybe {
 	# reject credentials.
 	$auth = Git::credential({
 		'protocol' => 'smtp',
-		'host' => smtp_host_string(),
+		'host' => $smtp_server,
+		'port' => $smtp_server_port,
 		'username' => $smtp_authuser,
 		# if there's no password, "git credential fill" will
 		# give us one, otherwise it'll just pass this one.
-- 
2.16.2
Next: Junio C Hamano
Message 1 of 7 in “send-email: report host and port separately when calling git credential”
  1. send-email: report host and port separately when calling git credentialMichal Nazarewicz, Mar 31, 2018
  2. Junio C HamanoApr 2, 2018
  3. send-email: fix docs regarding storing password with git credentialMichal Nazarewicz, Apr 2, 2018
  4. Jeff KingApr 4, 2018
  5. send-email: simplify Gmail example in the documentationMichal Nazarewicz, Apr 7, 2018
  6. Michał NazarewiczApr 7, 2018
  7. Jeff KingApr 4, 2018

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.