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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]