Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS should not check the host name by default. #6

Merged
merged 1 commit into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/net/smtp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ def tlsconnect(s)
logging "TLS connection started"
s.sync_close = true
ssl_socket_connect(s, @open_timeout)
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
if @ssl_context.verify_mode && @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
verified = true
Expand Down
4 changes: 3 additions & 1 deletion test/net/smtp/test_ssl_socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ def post_connection_check omg
end
}

ssl_context = OpenSSL::SSL::SSLContext.new
ssl_context.verify_mode = OpenSSL::SSL::VERIFY_PEER
connection = MySMTP.new('localhost', 25)
connection.enable_starttls_auto
connection.enable_starttls_auto(ssl_context)
connection.fake_tcp = tcp_socket
connection.fake_ssl = ssl_socket

Expand Down