[前][次][番号順一覧][スレッド一覧]

ruby-changes:39298

From: tenderlove <ko1@a...>
Date: Sun, 26 Jul 2015 06:23:47 +0900 (JST)
Subject: [ruby-changes:39298] tenderlove:r51379 (trunk): * test/openssl/test_pair.rb: add a test ensuring that the default DH

tenderlove	2015-07-26 06:23:22 +0900 (Sun, 26 Jul 2015)

  New Revision: 51379

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51379

  Log:
    * test/openssl/test_pair.rb: add a test ensuring that the default DH
      callback is used when no DH callback is specified.

  Modified files:
    trunk/ChangeLog
    trunk/test/openssl/test_pair.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51378)
+++ ChangeLog	(revision 51379)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Jul 26 06:22:24 2015  Aaron Patterson <tenderlove@r...>
+
+	* test/openssl/test_pair.rb: add a test ensuring that the default DH
+	  callback is used when no DH callback is specified.
+
 Sun Jul 26 04:08:27 2015  Aaron Patterson <tenderlove@r...>
 
 	* ext/openssl/lib/openssl/ssl.rb (module OpenSSL): add missing
Index: test/openssl/test_pair.rb
===================================================================
--- test/openssl/test_pair.rb	(revision 51378)
+++ test/openssl/test_pair.rb	(revision 51379)
@@ -283,6 +283,29 @@ module OpenSSL::TestPairM https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pair.rb#L283
     serv.close if serv && !serv.closed?
   end
 
+  def test_connect_without_setting_dh_callback
+    ctx2 = OpenSSL::SSL::SSLContext.new
+    ctx2.ciphers = "DH"
+    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"
+    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_ecdh_callback
     called = false
     ctx2 = OpenSSL::SSL::SSLContext.new

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]