From: Thomas Rast <tr@thomasrast.ch>
To: git@vger.kernel.org
Cc: Ramkumar Ramachandra <artagnon@gmail.com>
Subject: [PATCH 3/3] send-email: set SSL options through IO::Socket::SSL::set_client_defaults
Date: Sun, 1 Dec 2013 23:48:43 +0100 [thread overview]
Message-ID: <c5308d5ffb34b70cbfea5a39e08902904fac1400.1385938050.git.tr@thomasrast.ch> (raw)
In-Reply-To: <3bb0c80c70e1c40236034552bec037cb0c26167c.1385938050.git.tr@thomasrast.ch>
When --smtp-encryption=ssl, we use a Net::SMTP::SSL connection,
passing its ->new all the options that would otherwise go to
Net::SMTP->new (most options) and IO::Socket::SSL->start_SSL (for the
SSL options).
However, while Net::SMTP::SSL replaces the underlying socket class
with an SSL socket, it does nothing to allow passing options to that
socket. So the SSL-relevant options are lost.
Fortunately there is an escape hatch: we can directly set the options
with IO::Socket::SSL::set_client_defaults. They will then persist
within the IO::Socket::SSL module.
Signed-off-by: Thomas Rast <tr@thomasrast.ch>
---
git-send-email.perl | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 9f31c68..2016d9c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1214,11 +1214,14 @@ sub send_message {
$smtp_server_port ||= 465; # ssmtp
require Net::SMTP::SSL;
$smtp_domain ||= maildomain();
+ require IO::Socket::SSL;
+ # Net::SMTP::SSL->new() does not forward any SSL options
+ IO::Socket::SSL::set_client_defaults(
+ ssl_verify_params());
$smtp ||= Net::SMTP::SSL->new($smtp_server,
Hello => $smtp_domain,
Port => $smtp_server_port,
- Debug => $debug_net_smtp,
- ssl_verify_params());
+ Debug => $debug_net_smtp);
}
else {
require Net::SMTP;
--
1.8.5.rc3.5.g2a1fe2f
next prev parent reply other threads:[~2013-12-01 22:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-01 22:48 [PATCH 1/3] send-email: pass Debug to Net::SMTP::SSL::new Thomas Rast
2013-12-01 22:48 ` [PATCH 2/3] send-email: --smtp-ssl-cert-path takes an argument Thomas Rast
2013-12-01 22:48 ` Thomas Rast [this message]
2013-12-02 10:44 ` [PATCH 3/3] send-email: set SSL options through IO::Socket::SSL::set_client_defaults Ramkumar Ramachandra
2013-12-02 23:23 ` Thomas Rast
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c5308d5ffb34b70cbfea5a39e08902904fac1400.1385938050.git.tr@thomasrast.ch \
--to=tr@thomasrast.ch \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).