Skip to content
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/imap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4110,7 +4110,7 @@ def coerce_search_array_arg_to_seqset?(obj)

def build_ssl_ctx(ssl)
if ssl
params = (Hash.try_convert(ssl) || {}).freeze
params = (Hash.try_convert(ssl) || {}).clone(freeze: true)
context = OpenSSL::SSL::SSLContext.new
context.set_params(params)
context.setup
Expand Down
7 changes: 5 additions & 2 deletions test/net/imap/test_imap_tls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ def test_imaps_with_ca_file
# Assert verified *after* the imaps_test and assert_nothing_raised blocks.
# Otherwise, failures can't logout and need to wait for the timeout.
verified, imap = :unknown, nil
ssl_ctx_params = { ca_file: CA_FILE }
assert_nothing_raised do
begin
imaps_test do |port|
imap = Net::IMAP.new("localhost",
port: port,
ssl: { :ca_file => CA_FILE })
ssl: ssl_ctx_params)
verified = imap.tls_verified?
imap
rescue SystemCallError
Expand All @@ -75,7 +76,9 @@ def test_imaps_with_ca_file
end
assert_equal true, verified
assert_tls_verified imap
assert_equal({ca_file: CA_FILE}, imap.ssl_ctx_params)
assert_equal ssl_ctx_params, imap.ssl_ctx_params
refute_same ssl_ctx_params, imap.ssl_ctx_params
refute ssl_ctx_params.frozen?
assert_equal(CA_FILE, imap.ssl_ctx.ca_file)
assert_equal(OpenSSL::SSL::VERIFY_PEER, imap.ssl_ctx.verify_mode)
assert imap.ssl_ctx.verify_hostname
Expand Down
Loading