Project

General

Profile

Bug #12292 » 0001-ext-openssl-check-that-the-SSL-object-is-still-set-a.patch

rhenium (Kazuki Yamaguchi), 04/16/2016 11:08 AM

View differences:

ext/openssl/ossl_ssl.c
ossl_ssl_data_get_struct(self, ssl);
GetOpenFile(ossl_ssl_get_io(self), fptr);
for(;;){
for (;;) {
if (RTYPEDDATA_DATA(self) != ssl)
ossl_raise(eSSLError, "connection is shut down");
ret = func(ssl);
cb_state = rb_ivar_get(self, ID_callback_state);
......
if (ssl) {
if(!nonblock && SSL_pending(ssl) <= 0)
rb_thread_wait_fd(FPTR_TO_FD(fptr));
for (;;){
for (;;) {
if (RTYPEDDATA_DATA(self) != ssl)
ossl_raise(eSSLError, "connection is shut down");
nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LENINT(str));
switch(ssl_get_error(ssl, nread)){
case SSL_ERROR_NONE:
......
GetOpenFile(ossl_ssl_get_io(self), fptr);
if (ssl) {
for (;;){
for (;;) {
if (RTYPEDDATA_DATA(self) != ssl)
ossl_raise(eSSLError, "connection is shut down");
nwrite = SSL_write(ssl, RSTRING_PTR(str), RSTRING_LENINT(str));
switch(ssl_get_error(ssl, nwrite)){
case SSL_ERROR_NONE:
test/openssl/test_ssl.rb
}
end
def test_close_and_socket_close_while_connecting
# test it doesn't cause a segmentation fault
ctx = OpenSSL::SSL::SSLContext.new
ctx.ciphers = "aNULL"
sock1, sock2 = socketpair
ssl1 = OpenSSL::SSL::SSLSocket.new(sock1, ctx)
ssl2 = OpenSSL::SSL::SSLSocket.new(sock2, ctx)
t = Thread.new { ssl1.connect }
ssl2.accept
ssl1.close
sock1.close
t.value rescue nil
ensure
ssl1.close if ssl1
ssl2.close if ssl2
sock1.close if sock1
sock2.close if sock2
end
def test_get_ephemeral_key
return unless OpenSSL::SSL::SSLSocket.method_defined?(:tmp_key)
pkey = OpenSSL::PKey
(1-1/3)