summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-22 10:18:41 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-05-22 10:18:41 +0000
commit736460bf9f47e8a4d03e76f2ed8f9ac2a0561b08 (patch)
tree28ff71503dec10cf8f0977c6d59af82a489c6e2f
parent06b7b801ff771f95ae92aaf031b2bf3d68e7bdde (diff)
* ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#intialize):
should initialize session id context. [ruby-core:4663] * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): add session id support. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--ext/openssl/lib/openssl/ssl.rb4
-rw-r--r--ext/openssl/ossl_ssl.c13
3 files changed, 23 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b06277a..6f5cc03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+XSun May 22 19:11:35 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
+
+ * ext/openssl/lib/openssl/ssl.rb (OpenSSL::SSL::SSLServer#intialize):
+ should initialize session id context. [ruby-core:4663]
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_setup): add session id support.
+
Sat May 21 10:24:21 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* bcc32/Makefile.sub: tds files were not deleted when DESTDIR
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 4418908..9b287fc 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -98,6 +98,10 @@ module OpenSSL
def initialize(svr, ctx)
@svr = svr
@ctx = ctx
+ unless ctx.session_id_context
+ session_id = OpenSSL::Digest::MD5.hexdigest($0)
+ @ctx.session_id_context = session_id
+ end
@start_immediately = true
end
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index 9af3abf..d974bbc 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -47,6 +47,7 @@ VALUE cSSLSocket;
#define ossl_sslctx_set_extra_cert(o,v) rb_iv_set((o),"@extra_chain_cert",(v))
#define ossl_sslctx_set_client_cert_cb(o,v) rb_iv_set((o),"@client_cert_cb",(v))
#define ossl_sslctx_set_tmp_dh_cb(o,v) rb_iv_set((o),"@tmp_dh_callback",(v))
+#define ossl_sslctx_set_sess_id_ctx(o, v) rb_iv_get((o),"@session_id_context"(v))
#define ossl_sslctx_get_cert(o) rb_iv_get((o),"@cert")
#define ossl_sslctx_get_key(o) rb_iv_get((o),"@key")
@@ -62,12 +63,13 @@ VALUE cSSLSocket;
#define ossl_sslctx_get_extra_cert(o) rb_iv_get((o),"@extra_chain_cert")
#define ossl_sslctx_get_client_cert_cb(o) rb_iv_get((o),"@client_cert_cb")
#define ossl_sslctx_get_tmp_dh_cb(o) rb_iv_get((o),"@tmp_dh_callback")
+#define ossl_sslctx_get_sess_id_ctx(o) rb_iv_get((o),"@session_id_context")
static char *ossl_sslctx_attrs[] = {
"cert", "key", "client_ca", "ca_file", "ca_path",
"timeout", "verify_mode", "verify_depth",
"verify_callback", "options", "cert_store", "extra_chain_cert",
- "client_cert_cb", "tmp_dh_callback",
+ "client_cert_cb", "tmp_dh_callback", "session_id_context",
};
#define ossl_ssl_get_io(o) rb_iv_get((o),"@io")
@@ -392,6 +394,15 @@ ossl_sslctx_setup(VALUE self)
if(!NIL_P(val)) SSL_CTX_set_options(ctx, NUM2LONG(val));
rb_obj_freeze(self);
+ val = ossl_sslctx_get_sess_id_ctx(self);
+ if (!NIL_P(val)){
+ StringValue(val);
+ if (!SSL_CTX_set_session_id_context(ctx, RSTRING(val)->ptr,
+ RSTRING(val)->len)){
+ ossl_raise(eSSLError, "SSL_CTX_set_session_id_context:");
+ }
+ }
+
return Qtrue;
}