diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-06-28 23:38:05 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-04 21:38:36 +0900 |
commit | 6dc9b914cae52c8af6e1b4d1156613bcd914eaf5 (patch) | |
tree | 1c08759e790e6daa81cda32a063d6b20b26a9b31 /ext/openssl/ossl_x509revoked.c | |
parent | bf120798efa43c9db6c68e75037fc0a0c4735703 (diff) | |
download | ruby-openssl-6dc9b914cae52c8af6e1b4d1156613bcd914eaf5.tar.gz |
Implement missing initialize_copytopic/fix-initialize-copy
Implement initialize_copy for:
- OpenSSL::PKCS12
- OpenSSL::SSL::SSLSession
- OpenSSL::X509::Attribute
- OpenSSL::X509::Extension
- OpenSSL::X509::Name
- OpenSSL::X509::Revoked
Remove initialize_copy from:
- OpenSSL::SSL::SSLContext
- OpenSSL::SSL::SSLSocket
- OpenSSL::Engine
- OpenSSL::X509::Store
- OpenSSL::X509::StoreContext
[Bug #12381]
Diffstat (limited to 'ext/openssl/ossl_x509revoked.c')
-rw-r--r-- | ext/openssl/ossl_x509revoked.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c index 87a9b323..6f170077 100644 --- a/ext/openssl/ossl_x509revoked.c +++ b/ext/openssl/ossl_x509revoked.c @@ -110,6 +110,25 @@ ossl_x509revoked_initialize(int argc, VALUE *argv, VALUE self) } static VALUE +ossl_x509revoked_initialize_copy(VALUE self, VALUE other) +{ + X509_REVOKED *rev, *rev_other, *rev_new; + + rb_check_frozen(self); + GetX509Rev(self, rev); + SafeGetX509Rev(other, rev_other); + + rev_new = X509_REVOKED_dup(rev_other); + if (!rev_new) + ossl_raise(eX509RevError, "X509_REVOKED_dup"); + + SetX509Rev(self, rev_new); + X509_REVOKED_free(rev); + + return self; +} + +static VALUE ossl_x509revoked_get_serial(VALUE self) { X509_REVOKED *rev; @@ -239,6 +258,7 @@ Init_ossl_x509revoked(void) rb_define_alloc_func(cX509Rev, ossl_x509revoked_alloc); rb_define_method(cX509Rev, "initialize", ossl_x509revoked_initialize, -1); + rb_define_copy_func(cX509Rev, ossl_x509revoked_initialize_copy); rb_define_method(cX509Rev, "serial", ossl_x509revoked_get_serial, 0); rb_define_method(cX509Rev, "serial=", ossl_x509revoked_set_serial, 1); |