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

ruby-changes:18131

From: tenderlove <ko1@a...>
Date: Fri, 10 Dec 2010 10:24:30 +0900 (JST)
Subject: [ruby-changes:18131] Ruby:r30152 (trunk): * ext/openssl/ossl_x509store.c (ossl_x509stctx_cleanup): removing C

tenderlove	2010-12-10 02:18:54 +0900 (Fri, 10 Dec 2010)

  New Revision: 30152

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

  Log:
    * ext/openssl/ossl_x509store.c (ossl_x509stctx_cleanup): removing C
      implementation of `cleanup`.
    
    * ext/openssl/lib/openssl/x509.rb: adding ruby implementation of
      `cleanup`.  OpenSSL::X509::StoreContext#cleanup is deprecated since
      reusing the underlying struct doesn't make sense. [ruby-dev:42546]

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/lib/openssl/x509.rb
    trunk/ext/openssl/lib/openssl.rb
    trunk/ext/openssl/ossl_x509store.c
    trunk/test/openssl/test_x509store.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30151)
+++ ChangeLog	(revision 30152)
@@ -1,3 +1,12 @@
+Fri Dec 10 02:18:02 2010  Aaron Patterson <aaron@t...>
+
+	* ext/openssl/ossl_x509store.c (ossl_x509stctx_cleanup): removing C
+	  implementation of `cleanup`.
+
+	* ext/openssl/lib/openssl/x509.rb: adding ruby implementation of
+	  `cleanup`.  OpenSSL::X509::StoreContext#cleanup is deprecated since
+	  reusing the underlying struct doesn't make sense. [ruby-dev:42546]
+
 Thu Dec  9 20:14:39 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* parse.y (lvar_defined_gen, shadowing_lvar_gen, dvar_defined): no
Index: ext/openssl/ossl_x509store.c
===================================================================
--- ext/openssl/ossl_x509store.c	(revision 30151)
+++ ext/openssl/ossl_x509store.c	(revision 30152)
@@ -511,17 +511,6 @@
 }
 
 static VALUE
-ossl_x509stctx_cleanup(VALUE self)
-{
-    X509_STORE_CTX *ctx;
-
-    GetX509StCtx(self, ctx);
-    X509_STORE_CTX_cleanup(ctx);
-
-    return self;
-}
-
-static VALUE
 ossl_x509stctx_set_flags(VALUE self, VALUE flags)
 {
     X509_STORE_CTX *store;
@@ -615,7 +604,6 @@
     rb_define_method(x509stctx,"error_depth", ossl_x509stctx_get_err_depth, 0);
     rb_define_method(x509stctx,"current_cert",ossl_x509stctx_get_curr_cert, 0);
     rb_define_method(x509stctx,"current_crl", ossl_x509stctx_get_curr_crl, 0);
-    rb_define_method(x509stctx,"cleanup",     ossl_x509stctx_cleanup, 0);
     rb_define_method(x509stctx,"flags=",      ossl_x509stctx_set_flags, 1);
     rb_define_method(x509stctx,"purpose=",    ossl_x509stctx_set_purpose, 1);
     rb_define_method(x509stctx,"trust=",      ossl_x509stctx_set_trust, 1);
Index: ext/openssl/lib/openssl/x509.rb
===================================================================
--- ext/openssl/lib/openssl/x509.rb	(revision 30151)
+++ ext/openssl/lib/openssl/x509.rb	(revision 30152)
@@ -1 +1,9 @@
-require 'openssl'
+module OpenSSL
+  module X509
+    class StoreContext
+      def cleanup
+        warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
+      end
+    end
+  end
+end
Index: ext/openssl/lib/openssl.rb
===================================================================
--- ext/openssl/lib/openssl.rb	(revision 30151)
+++ ext/openssl/lib/openssl.rb	(revision 30152)
@@ -20,6 +20,7 @@
 require 'openssl/cipher'
 require 'openssl/config'
 require 'openssl/digest'
+require 'openssl/x509'
 require 'openssl/ssl-internal'
 require 'openssl/x509-internal'
 
Index: test/openssl/test_x509store.rb
===================================================================
--- test/openssl/test_x509store.rb	(revision 30151)
+++ test/openssl/test_x509store.rb	(revision 30152)
@@ -22,6 +22,14 @@
   def teardown
   end
 
+  def test_nosegv_on_cleanup
+    cert  = OpenSSL::X509::Certificate.new
+    store = OpenSSL::X509::Store.new
+    ctx   = OpenSSL::X509::StoreContext.new(store, cert, [])
+    ctx.cleanup
+    ctx.verify
+  end
+
   def issue_cert(*args)
     OpenSSL::TestUtils.issue_cert(*args)
   end

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

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