Guest User

Untitled

a guest
Jul 16th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. diff --git a/ext/openssl/lib/openssl.rb b/ext/openssl/lib/openssl.rb
  2. index 3cff8d9..fb215cd 100644
  3. --- a/ext/openssl/lib/openssl.rb
  4. +++ b/ext/openssl/lib/openssl.rb
  5. @@ -20,6 +20,7 @@ require 'openssl/bn'
  6. require 'openssl/cipher'
  7. require 'openssl/config'
  8. require 'openssl/digest'
  9. +require 'openssl/x509'
  10. require 'openssl/ssl-internal'
  11. require 'openssl/x509-internal'
  12.  
  13. diff --git a/ext/openssl/lib/openssl/x509.rb b/ext/openssl/lib/openssl/x509.rb
  14. index 3f17f5a..aae75a3 100644
  15. --- a/ext/openssl/lib/openssl/x509.rb
  16. +++ b/ext/openssl/lib/openssl/x509.rb
  17. @@ -1 +1,9 @@
  18. -require 'openssl'
  19. +module OpenSSL
  20. + module X509
  21. + class StoreContext
  22. + def cleanup
  23. + warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE
  24. + end
  25. + end
  26. + end
  27. +end
  28. diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
  29. index 7b4a005..317fc35 100644
  30. --- a/ext/openssl/ossl_x509store.c
  31. +++ b/ext/openssl/ossl_x509store.c
  32. @@ -511,17 +511,6 @@ ossl_x509stctx_get_curr_crl(VALUE self)
  33. }
  34.  
  35. static VALUE
  36. -ossl_x509stctx_cleanup(VALUE self)
  37. -{
  38. - X509_STORE_CTX *ctx;
  39. -
  40. - GetX509StCtx(self, ctx);
  41. - X509_STORE_CTX_cleanup(ctx);
  42. -
  43. - return self;
  44. -}
  45. -
  46. -static VALUE
  47. ossl_x509stctx_set_flags(VALUE self, VALUE flags)
  48. {
  49. X509_STORE_CTX *store;
  50. @@ -615,7 +604,6 @@ Init_ossl_x509store()
  51. rb_define_method(x509stctx,"error_depth", ossl_x509stctx_get_err_depth, 0);
  52. rb_define_method(x509stctx,"current_cert",ossl_x509stctx_get_curr_cert, 0);
  53. rb_define_method(x509stctx,"current_crl", ossl_x509stctx_get_curr_crl, 0);
  54. - rb_define_method(x509stctx,"cleanup", ossl_x509stctx_cleanup, 0);
  55. rb_define_method(x509stctx,"flags=", ossl_x509stctx_set_flags, 1);
  56. rb_define_method(x509stctx,"purpose=", ossl_x509stctx_set_purpose, 1);
  57. rb_define_method(x509stctx,"trust=", ossl_x509stctx_set_trust, 1);
  58. diff --git a/test/openssl/test_x509store.rb b/test/openssl/test_x509store.rb
  59. index 238ee90..81fa0b0 100644
  60. --- a/test/openssl/test_x509store.rb
  61. +++ b/test/openssl/test_x509store.rb
  62. @@ -22,6 +22,14 @@ class OpenSSL::TestX509Store < Test::Unit::TestCase
  63. def teardown
  64. end
  65.  
  66. + def test_nosegv_on_cleanup
  67. + cert = OpenSSL::X509::Certificate.new
  68. + store = OpenSSL::X509::Store.new
  69. + ctx = OpenSSL::X509::StoreContext.new(store, cert, [])
  70. + ctx.cleanup
  71. + ctx.verify
  72. + end
  73. +
  74. def issue_cert(*args)
  75. OpenSSL::TestUtils.issue_cert(*args)
  76. end
Add Comment
Please, Sign In to add comment