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

[PATCH] git-send-email: allow overriding smtp-encryption config to 'none'

From
Brian Norris <computersforpeace@gmail.com>
Date
Feb 15, 2012, 21:42 UTC
Message-ID
<1329342178-14540-1-git-send-email-computersforpeace@gmail.com>
According to the manpage:
 --smtp-encryption=<encryption>
        Specify the encryption to use, either ssl or tls. Any other value
	reverts to plain SMTP.  Default is the value of
        sendemail.smtpencryption.

However, if I have already set sendemail.smtpencryption but try to override it with something like 'no', the authentication code block still tries to ask for a password (and fails).

This patch forces $smtp_encryption to 'none' when a proper encryption type is not provided, then checks $smtp_encryption before proceeding to authentication.

Example execution:
 $ git send-email --smtp-encryption=no --smtp-domain=<xxx> \
        --smtp-server=<xxx> --smtp-server-port=25 myfile.patch
 Password:
 Command unknown: 'AUTH' at /usr/local/libexec/git-core/git-send-email
 line 1115, <STDIN> line 1.
Tested on Git 1.7.5.4 and 1.7.9.1.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 git-send-email.perl |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index ef30c55..fa0a384 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -385,8 +385,9 @@ foreach my $setting (values %config_bool_settings) {
 	${$setting->[0]} = $setting->[1] unless (defined (${$setting->[0]}));
 }
 
-# 'default' encryption is none -- this only prevents a warning
-$smtp_encryption = '' unless (defined $smtp_encryption);
+# 'default' encryption is none
+$smtp_encryption = 'none' unless (defined $smtp_encryption);
+$smtp_encryption = 'none' unless ($smtp_encryption eq 'tls' || $smtp_encryption eq 'ssl');
 
 # Set CC suppressions
 my(%suppress_cc);
@@ -1113,7 +1114,7 @@ X-Mailer: git-send-email $gitversion
 			    defined $smtp_server_port ? " port=$smtp_server_port" : "";
 		}
 
-		if (defined $smtp_authuser) {
+		if (defined $smtp_authuser && $smtp_encryption ne 'none') {
 			# Workaround AUTH PLAIN/LOGIN interaction defect
 			# with Authen::SASL::Cyrus
 			eval {
-- 
1.7.5.4
Next: Jeff King
Message 1 of 6 in “git-send-email: allow overriding smtp-encryption config to 'none'”
  1. git-send-email: allow overriding smtp-encryption config to 'none'Brian Norris, Feb 15, 2012
  2. Jeff KingFeb 15, 2012
  3. Brian NorrisFeb 15, 2012
  4. Jeff KingFeb 16, 2012
  5. Brian NorrisFeb 18, 2012
  6. Jeff KingFeb 18, 2012

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.