Skip to content

Commit 16a166d

Browse files
committed
* 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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 2dc98cd commit 16a166d

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Fri Dec 10 02:18:02 2010 Aaron Patterson <[email protected]>
2+
3+
* ext/openssl/ossl_x509store.c (ossl_x509stctx_cleanup): removing C
4+
implementation of `cleanup`.
5+
6+
* ext/openssl/lib/openssl/x509.rb: adding ruby implementation of
7+
`cleanup`. OpenSSL::X509::StoreContext#cleanup is deprecated since
8+
reusing the underlying struct doesn't make sense. [ruby-dev:42546]
9+
110
Thu Dec 9 20:14:39 2010 Nobuyoshi Nakada <[email protected]>
211

312
* parse.y (lvar_defined_gen, shadowing_lvar_gen, dvar_defined): no

ext/openssl/lib/openssl.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
require 'openssl/cipher'
2121
require 'openssl/config'
2222
require 'openssl/digest'
23+
require 'openssl/x509'
2324
require 'openssl/ssl-internal'
2425
require 'openssl/x509-internal'
2526

ext/openssl/lib/openssl/x509.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
require 'openssl'
1+
module OpenSSL
2+
module X509
3+
class StoreContext
4+
def cleanup
5+
warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
6+
end
7+
end
8+
end
9+
end

ext/openssl/ossl_x509store.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -510,17 +510,6 @@ ossl_x509stctx_get_curr_crl(VALUE self)
510510
#endif
511511
}
512512

513-
static VALUE
514-
ossl_x509stctx_cleanup(VALUE self)
515-
{
516-
X509_STORE_CTX *ctx;
517-
518-
GetX509StCtx(self, ctx);
519-
X509_STORE_CTX_cleanup(ctx);
520-
521-
return self;
522-
}
523-
524513
static VALUE
525514
ossl_x509stctx_set_flags(VALUE self, VALUE flags)
526515
{
@@ -615,7 +604,6 @@ Init_ossl_x509store()
615604
rb_define_method(x509stctx,"error_depth", ossl_x509stctx_get_err_depth, 0);
616605
rb_define_method(x509stctx,"current_cert",ossl_x509stctx_get_curr_cert, 0);
617606
rb_define_method(x509stctx,"current_crl", ossl_x509stctx_get_curr_crl, 0);
618-
rb_define_method(x509stctx,"cleanup", ossl_x509stctx_cleanup, 0);
619607
rb_define_method(x509stctx,"flags=", ossl_x509stctx_set_flags, 1);
620608
rb_define_method(x509stctx,"purpose=", ossl_x509stctx_set_purpose, 1);
621609
rb_define_method(x509stctx,"trust=", ossl_x509stctx_set_trust, 1);

test/openssl/test_x509store.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ def setup
2222
def teardown
2323
end
2424

25+
def test_nosegv_on_cleanup
26+
cert = OpenSSL::X509::Certificate.new
27+
store = OpenSSL::X509::Store.new
28+
ctx = OpenSSL::X509::StoreContext.new(store, cert, [])
29+
ctx.cleanup
30+
ctx.verify
31+
end
32+
2533
def issue_cert(*args)
2634
OpenSSL::TestUtils.issue_cert(*args)
2735
end

0 commit comments

Comments
 (0)