[前][次][番号順一覧][スレッド一覧]

ruby-changes:28628

From: yugui <ko1@a...>
Date: Mon, 13 May 2013 11:09:10 +0900 (JST)
Subject: [ruby-changes:28628] yugui:r40680 (trunk): * ext/openssl/ossl_ssl.c: Disabled OpenSSL::SSL::SSLSocket if

yugui	2013-05-13 11:08:59 +0900 (Mon, 13 May 2013)

  New Revision: 40680

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40680

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/ossl_ssl.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40679)
+++ ChangeLog	(revision 40680)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon May 13 10:20:59 2013  Yuki Yugui Sonoda  <yugui@g...>
+
+	* 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@z...>
 
 	* hash.c: Hash[] and {} are not equivalent by @eam [Fixes GH-301]
Index: ext/openssl/ossl_ssl.c
===================================================================
--- ext/openssl/ossl_ssl.c	(revision 40679)
+++ ext/openssl/ossl_ssl.c	(revision 40680)
@@ -1095,6 +1095,7 @@ ossl_sslctx_flush_sessions(int argc, VAL https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1095
 /*
  * SSLSocket class
  */
+#ifndef OPENSSL_NO_SOCK
 static void
 ossl_ssl_shutdown(SSL *ssl)
 {
@@ -1795,7 +1796,7 @@ ossl_ssl_get_client_ca_list(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1796
     return ossl_x509name_sk2ary(ca);
 }
 
-#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+# ifdef HAVE_OPENSSL_NPN_NEGOTIATED
 /*
  * call-seq:
  *    ssl.npn_protocol => String
@@ -1818,7 +1819,8 @@ ossl_ssl_npn_protocol(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L1819
     else
 	return rb_str_new((const char *) out, outlen);
 }
-#endif
+# endif
+#endif /* !defined(OPENSSL_NO_SOCK) */
 
 void
 Init_ossl_ssl()
@@ -2149,6 +2151,9 @@ Init_ossl_ssl() https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L2151
      *
      */
     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);
     for(i = 0; i < numberof(ossl_ssl_attr_readers); i++)
         rb_attr(cSSLSocket, rb_intern(ossl_ssl_attr_readers[i]), 1, 0, Qfalse);
@@ -2177,8 +2182,9 @@ Init_ossl_ssl() https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ssl.c#L2182
     rb_define_method(cSSLSocket, "session=",    ossl_ssl_set_session, 1);
     rb_define_method(cSSLSocket, "verify_result", ossl_ssl_get_verify_result, 0);
     rb_define_method(cSSLSocket, "client_ca", ossl_ssl_get_client_ca_list, 0);
-#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+# ifdef HAVE_OPENSSL_NPN_NEGOTIATED
     rb_define_method(cSSLSocket, "npn_protocol", ossl_ssl_npn_protocol, 0);
+# endif
 #endif
 
 #define ossl_ssl_def_const(x) rb_define_const(mSSL, #x, INT2NUM(SSL_##x))

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]