1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/openssl/ossl_ssl.c: Disabled OpenSSL::SSL::SSLSocket if

defined(OPENSSL_NO_SOCK).

  This fixes a linkage error on platforms which do not have socket.
  OpenSSL itself is still useful as a set of cryptographic functions
  even on such platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2013-05-13 02:08:59 +00:00
parent 0dc6dcfb6a
commit ee22fad45d
2 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,12 @@
Mon May 13 10:20:59 2013 Yuki Yugui Sonoda <yugui@google.com>
* ext/openssl/ossl_ssl.c: Disabled OpenSSL::SSL::SSLSocket if
defined(OPENSSL_NO_SOCK).
This fixes a linkage error on platforms which do not have socket.
OpenSSL itself is still useful as a set of cryptographic functions
even on such platforms.
Mon May 13 10:30:04 2013 Zachary Scott <zachary@zacharyscott.net> Mon May 13 10:30:04 2013 Zachary Scott <zachary@zacharyscott.net>
* hash.c: Hash[] and {} are not equivalent by @eam [Fixes GH-301] * hash.c: Hash[] and {} are not equivalent by @eam [Fixes GH-301]

View file

@ -1095,6 +1095,7 @@ ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self)
/* /*
* SSLSocket class * SSLSocket class
*/ */
#ifndef OPENSSL_NO_SOCK
static void static void
ossl_ssl_shutdown(SSL *ssl) ossl_ssl_shutdown(SSL *ssl)
{ {
@ -1819,6 +1820,7 @@ ossl_ssl_npn_protocol(VALUE self)
return rb_str_new((const char *) out, outlen); return rb_str_new((const char *) out, outlen);
} }
# endif # endif
#endif /* !defined(OPENSSL_NO_SOCK) */
void void
Init_ossl_ssl() Init_ossl_ssl()
@ -2149,6 +2151,9 @@ Init_ossl_ssl()
* *
*/ */
cSSLSocket = rb_define_class_under(mSSL, "SSLSocket", rb_cObject); cSSLSocket = rb_define_class_under(mSSL, "SSLSocket", rb_cObject);
#ifdef OPENSSL_NO_SOCK
rb_define_method(cSSLSocket, "initialize", rb_notimplement, -1);
#else
rb_define_alloc_func(cSSLSocket, ossl_ssl_s_alloc); rb_define_alloc_func(cSSLSocket, ossl_ssl_s_alloc);
for(i = 0; i < numberof(ossl_ssl_attr_readers); i++) for(i = 0; i < numberof(ossl_ssl_attr_readers); i++)
rb_attr(cSSLSocket, rb_intern(ossl_ssl_attr_readers[i]), 1, 0, Qfalse); rb_attr(cSSLSocket, rb_intern(ossl_ssl_attr_readers[i]), 1, 0, Qfalse);
@ -2180,6 +2185,7 @@ Init_ossl_ssl()
# ifdef HAVE_OPENSSL_NPN_NEGOTIATED # ifdef HAVE_OPENSSL_NPN_NEGOTIATED
rb_define_method(cSSLSocket, "npn_protocol", ossl_ssl_npn_protocol, 0); rb_define_method(cSSLSocket, "npn_protocol", ossl_ssl_npn_protocol, 0);
# endif # endif
#endif
#define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, INT2NUM(SSL_##x)) #define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, INT2NUM(SSL_##x))