From c5089caba939f78eb30fada173325eddfd1cd249 Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 8 Dec 2010 08:09:36 +0000 Subject: merges r29784,r29787 and r29788 from trunk into ruby_1_9_2. -- * etc/openssl/ossl_ssl.c (ossl_ssl_get_cert): raise exception if pointer is invalid. Thanks Ippei Obayashi! [ruby-dev:42573] -- STDIN is not valid when ruby doesn't have tty. -- making ssl test a little better git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/openssl/ossl_ssl.c | 2 +- test/openssl/test_ssl.rb | 6 ++++++ version.h | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b7260d4d5..94fab3e330 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Nov 15 06:43:48 2010 Aaron Patterson + + * etc/openssl/ossl_ssl.c (ossl_ssl_get_cert): raise exception if + pointer is invalid. Thanks Ippei Obayashi! [ruby-dev:42573] + Mon Dec 6 22:53:49 2010 Yuki Sonoda (Yugui) * cygwin/GNUMakefile.in ($(RCFILES)): fixes [ruby-core:33525]. diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 5c958f0ac3..f112903a2a 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -1337,7 +1337,7 @@ ossl_ssl_get_cert(VALUE self) X509 *cert = NULL; Data_Get_Struct(self, SSL, ssl); - if (ssl) { + if (!ssl) { rb_warning("SSL session is not started yet."); return Qnil; } diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 558bf1bce4..a0939dacbe 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -160,6 +160,12 @@ class OpenSSL::TestSSL < Test::Unit::TestCase assert_equal(ctx.setup, nil) end + def test_not_started_session + open(__FILE__) do |f| + assert_nil OpenSSL::SSL::SSLSocket.new(f).cert + end + end + def test_ssl_read_nonblock start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |server, port| sock = TCPSocket.new("127.0.0.1", port) diff --git a/version.h b/version.h index ea30e3ec43..4fd26d90a2 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 91 +#define RUBY_PATCHLEVEL 92 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- cgit v1.2.3