mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/openssl/ossl.c (ossl_raise): should use ERR_peek_last_error
to get last error on the current thread. And should report errors are on the stack while OpenSSL.debug is true. * ext/openssl/ossl.c (ossl_get_errors): new method for debugging this library. * ext/openssl/ossl_ssl.c (ossl_sslctx_set_ciphers): fix error message. * ext/openssl/ossl_x509req.c (ossl_x509req_set_attributes): get rid of unused variable. * ext/openssl/ossl_x509store.c (ossl_x509store_initialize): should set @time to avoid warning. * ext/openssl/ossl_x509store.c (ossl_x509store_set_default_paths, X509_STORE_add_cert, X509_STORE_add_crl): should raise error if wrapped functions failed. * test/openssl/test_x509store.rb: add test for errors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6d77710327
commit
2ec654a1a0
6 changed files with 79 additions and 7 deletions
|
@ -137,6 +137,7 @@ ossl_x509store_initialize(int argc, VALUE *argv, VALUE self)
|
|||
rb_iv_set(self, "@error", Qnil);
|
||||
rb_iv_set(self, "@error_string", Qnil);
|
||||
rb_iv_set(self, "@chain", Qnil);
|
||||
rb_iv_set(self, "@time", Qnil);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -244,7 +245,9 @@ ossl_x509store_set_default_paths(VALUE self)
|
|||
X509_STORE *store;
|
||||
|
||||
GetX509Store(self, store);
|
||||
X509_STORE_set_default_paths(store);
|
||||
if (X509_STORE_set_default_paths(store) != 1){
|
||||
ossl_raise(eX509StoreError, NULL);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -257,7 +260,9 @@ ossl_x509store_add_cert(VALUE self, VALUE arg)
|
|||
|
||||
cert = GetX509CertPtr(arg); /* NO NEED TO DUP */
|
||||
GetX509Store(self, store);
|
||||
X509_STORE_add_cert(store, cert);
|
||||
if (X509_STORE_add_cert(store, cert) != 1){
|
||||
ossl_raise(eX509StoreError, NULL);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -270,7 +275,9 @@ ossl_x509store_add_crl(VALUE self, VALUE arg)
|
|||
|
||||
crl = GetX509CRLPtr(arg); /* NO NEED TO DUP */
|
||||
GetX509Store(self, store);
|
||||
X509_STORE_add_crl(store, crl);
|
||||
if (X509_STORE_add_crl(store, crl) != 1){
|
||||
ossl_raise(eX509StoreError, NULL);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue