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

[PATCH] send-email: auth plain/login fix

From
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Date
Sep 29, 2011, 17:02 UTC
Message-ID
<1317315765-5471-1-git-send-email-zbyszek@in.waw.pl>
In-Reply-To
<1317308474.1854.8.camel@Joe-Laptop>

git send-email was not authenticating properly when communicating over TLS with a server supporting only AUTH PLAIN and AUTH LOGIN. This is e.g. the standard server setup under debian with exim4 and probably everywhere where system accounts are used.

The problem (only?) exists when libauthen-sasl-cyrus-perl (Authen::SASL::Cyrus) is installed. Importing Authen::SASL::Perl makes Authen::SASL use the perl implementation which works better.

The solution is based on this forum thread: http://www.perlmonks.org/?node_id=904354.

This patch is tested by sending it. Without this fix, the interaction with the server failed like this:

$ git send-email --smtp-encryption=tls --smtp-server=... --smtp-debug=1 change1.patch ... Net::SMTP::SSL=GLOB(0x238f668)<<< 250-AUTH LOGIN PLAIN Password: Net::SMTP::SSL=GLOB(0x238f668)>>> AUTH Net::SMTP::SSL=GLOB(0x238f668)<<< 501 5.5.2 AUTH mechanism must be specified 5.5.2 AUTH mechanism must be specified

Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
v2:  - the import is performed only if it will be used
v3:  - the import is performed only if it will be used, and failure is ignored
v4:  - improved commit message
v5:  - comment in code
 git-send-email.perl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 98ab33a..f2a6e46 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1095,6 +1095,12 @@ X-Mailer: git-send-email $gitversion
 		}
 
 		if (defined $smtp_authuser) {
+			# Workaround AUTH PLAIN/LOGIN interaction defect
+			# with Authen::SASL::Cyrus
+			eval {
+				require Authen::SASL;
+				Authen::SASL->import(qw(Perl));
+			};
 
 			if (!defined $smtp_authpass) {
 
-- 
1.7.6
Previous: Joe PerchesNext: Junio C Hamano
Message 18 of 19 in “git-send-email: Add AUTH LOGIN support”
  1. git-send-email: Add AUTH LOGIN supportJoe Perches, Aug 6, 2011
  2. Junio C HamanoAug 6, 2011
  3. Joe PerchesAug 6, 2011
  4. Joe PerchesAug 19, 2011
  5. Junio C HamanoAug 19, 2011
  6. Joe PerchesAug 19, 2011
  7. Junio C HamanoAug 20, 2011
  8. send-email: auth plain/login fixZbigniew Jędrzejewski-Szmek, Sep 24, 2011
  9. Junio C HamanoSep 26, 2011
  10. Joe PerchesSep 26, 2011
  11. Jakub NarebskiSep 26, 2011
  12. send-email: auth plain/login fixZbigniew Jędrzejewski-Szmek, Sep 27, 2011
  13. Jeff KingSep 27, 2011
  14. send-email: auth plain/login fixZbigniew Jędrzejewski-Szmek, Sep 28, 2011
  15. Junio C HamanoSep 28, 2011
  16. send-email: auth plain/login fixZbigniew Jędrzejewski-Szmek, Sep 29, 2011
  17. Joe PerchesSep 29, 2011
  18. send-email: auth plain/login fixZbigniew Jędrzejewski-Szmek, Sep 29, 2011
  19. Junio C HamanoSep 29, 2011

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.