Skip to content

Commit 5508f3e

Browse files
trastgitster
authored andcommitted
send-email: set SSL options through IO::Socket::SSL::set_client_defaults
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 979e652 commit 5508f3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

git-send-email.perl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,11 +1214,14 @@ sub send_message {
12141214
$smtp_server_port ||= 465; # ssmtp
12151215
require Net::SMTP::SSL;
12161216
$smtp_domain ||= maildomain();
1217+
require IO::Socket::SSL;
1218+
# Net::SMTP::SSL->new() does not forward any SSL options
1219+
IO::Socket::SSL::set_client_defaults(
1220+
ssl_verify_params());
12171221
$smtp ||= Net::SMTP::SSL->new($smtp_server,
12181222
Hello => $smtp_domain,
12191223
Port => $smtp_server_port,
1220-
Debug => $debug_net_smtp,
1221-
ssl_verify_params());
1224+
Debug => $debug_net_smtp);
12221225
}
12231226
else {
12241227
require Net::SMTP;

0 commit comments

Comments
 (0)