git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] send-email: enable SSL level 1 debug output
@ 2015-11-25  0:02 John Keeping
  2015-12-03 21:47 ` [PATCH v2] " John Keeping
  0 siblings, 1 reply; 2+ messages in thread
From: John Keeping @ 2015-11-25  0:02 UTC (permalink / raw)
  To: git; +Cc: Jeff King, John Keeping

If a server's certificate isn't accepted by send-email, the output is:

	Unable to initialize SMTP properly. Check config and use --smtp-debug.

but adding --smtp-debug=1 just produces the same output since we don't
get as far as talking SMTP.

Turning on SSL debug at level 1 gives:

	DEBUG: .../IO/Socket/SSL.pm:1796: SSL connect attempt failed error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
	DEBUG: .../IO/Socket/SSL.pm:673: fatal SSL error: SSL connect attempt failed error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
	DEBUG: .../IO/Socket/SSL.pm:1780: IO::Socket::IP configuration failed

IO::Socket::SSL defines level 1 debug as "print out errors from
IO::Socket::SSL and ciphers from Net::SSLeay".  In fact, it aliases
Net::SSLeay::trace which is defined to guarantee silence at level 0 and
only emit error messages at level 1, so let's enable it by default.

Signed-off-by: John Keeping <john@keeping.me.uk>
---
This is the result of a previous discussion [0] but I decided to drop
the switch on --smtp-debug since level 1 only gives output on errors.

[0] http://marc.info/?l=git&m=144840344331208&w=2

 git-send-email.perl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index e907e0e..918aafa 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1318,6 +1318,7 @@ Message-Id: $message_id
 			require Net::SMTP::SSL;
 			$smtp_domain ||= maildomain();
 			require IO::Socket::SSL;
+			$IO::Socket::SSL::DEBUG = 1;
 			# Net::SMTP::SSL->new() does not forward any SSL options
 			IO::Socket::SSL::set_client_defaults(
 				ssl_verify_params());
-- 
2.6.3.462.gbe2c914

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v2] send-email: enable SSL level 1 debug output
  2015-11-25  0:02 [PATCH] send-email: enable SSL level 1 debug output John Keeping
@ 2015-12-03 21:47 ` John Keeping
  0 siblings, 0 replies; 2+ messages in thread
From: John Keeping @ 2015-12-03 21:47 UTC (permalink / raw)
  To: git; +Cc: John Keeping

If a server's certificate isn't accepted by send-email, the output is:

	Unable to initialize SMTP properly. Check config and use --smtp-debug.

but adding --smtp-debug=1 just produces the same output since we don't
get as far as talking SMTP.

Turning on SSL debug at level 1 gives:

	DEBUG: .../IO/Socket/SSL.pm:1796: SSL connect attempt failed error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
	DEBUG: .../IO/Socket/SSL.pm:673: fatal SSL error: SSL connect attempt failed error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
	DEBUG: .../IO/Socket/SSL.pm:1780: IO::Socket::IP configuration failed

IO::Socket::SSL defines level 1 debug as "print out errors from
IO::Socket::SSL and ciphers from Net::SSLeay".  In fact, it aliases
Net::SSLeay::trace which is defined to guarantee silence at level 0 and
only emit error messages at level 1, so let's enable it by default.

The modification of warnings is needed to avoid a warning about:

	Name "IO::Socket::SSL::DEBUG" used only once: possible typo

Signed-off-by: John Keeping <john@keeping.me.uk>
---
Sorry about the delay following up with this.

I don't particularly like the need for brackets and modifying the
warnings here, but AFAIK there is no other way to avoid a warning that
is likely to upset users (although I am far from a Perl expert).

 git-send-email.perl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index e907e0e..72508be 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1318,6 +1318,13 @@ Message-Id: $message_id
 			require Net::SMTP::SSL;
 			$smtp_domain ||= maildomain();
 			require IO::Socket::SSL;
+
+			# Suppress "variable accessed once" warning.
+			{
+				no warnings 'once';
+				$IO::Socket::SSL::DEBUG = 1;
+			}
+
 			# Net::SMTP::SSL->new() does not forward any SSL options
 			IO::Socket::SSL::set_client_defaults(
 				ssl_verify_params());
-- 
2.6.3.462.gbe2c914

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-03 21:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25  0:02 [PATCH] send-email: enable SSL level 1 debug output John Keeping
2015-12-03 21:47 ` [PATCH v2] " John Keeping

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).