summaryrefslogtreecommitdiffstats
path: root/test/test_pair.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@ruby-lang.org>2015-07-25 23:16:49 +0000
committertenderlove <tenderlove@ruby-lang.org>2015-07-25 23:16:49 +0000
commit8c55d4c39a5e654a1082282ccce888a35522cb18 (patch)
treeee16b3e6c1a5753efc1e578abf9e0f9c31279288 /test/test_pair.rb
parentc9c6d7ac0e8e27a5e586fc9ff44e7a929e2a8898 (diff)
downloadruby-openssl-history-8c55d4c39a5e654a1082282ccce888a35522cb18.tar.gz
* ext/openssl/lib/openssl/ssl.rb (module OpenSSL): support
specifically setting the tmp_dh_callback to nil. * ext/openssl/ossl_ssl.c (Init_ossl_ssl): ditto * test/openssl/test_pair.rb (module OpenSSL): add a test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_pair.rb')
-rw-r--r--test/test_pair.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_pair.rb b/test/test_pair.rb
index a8df74d..cd5d5d8 100644
--- a/test/test_pair.rb
+++ b/test/test_pair.rb
@@ -283,6 +283,31 @@ module OpenSSL::TestPairM
serv.close if serv && !serv.closed?
end
+ def test_connect_works_when_setting_dh_callback_to_nil
+ ctx2 = OpenSSL::SSL::SSLContext.new
+ ctx2.ciphers = "DH"
+ ctx2.tmp_dh_callback = nil
+ sock1, sock2 = tcp_pair
+ s2 = OpenSSL::SSL::SSLSocket.new(sock2, ctx2)
+ accepted = s2.accept_nonblock(exception: false)
+
+ ctx1 = OpenSSL::SSL::SSLContext.new
+ ctx1.ciphers = "DH"
+ ctx1.tmp_dh_callback = nil
+ s1 = OpenSSL::SSL::SSLSocket.new(sock1, ctx1)
+ t = Thread.new { s1.connect }
+
+ accept = s2.accept
+ assert_equal s1, t.value
+ assert accept
+ ensure
+ s1.close if s1
+ s2.close if s2
+ sock1.close if sock1
+ sock2.close if sock2
+ accepted.close if accepted.respond_to?(:close)
+ end
+
def test_connect_without_setting_dh_callback
ctx2 = OpenSSL::SSL::SSLContext.new
ctx2.ciphers = "DH"