summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-12 13:32:49 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-12 13:32:49 +0000
commitb774137633e23f1afc60570e5664800f80c0d5a1 (patch)
tree850a504a973b5b994c8dce48e6bc0aa544fa320d
parent52b62ca7fb9431d5cdb9552c81ea7fc1c3136853 (diff)
* ext/openssl/ossl_config.c (ossl_config_copy): wrongly updating the
given object with uninitialized CONF data. now OpenSSL::Config#clone works as expected; cloning the config instead of SEGV or empty definition. * test/openssl/test_config.rb: added tests for Config#clone. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@28621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--ext/openssl/ossl_config.c4
-rw-r--r--test/openssl/test_config.rb12
3 files changed, 23 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 47888d4561..904bcc63cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Mon Jul 12 22:26:00 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_config.c (ossl_config_copy): wrongly updating the
+ given object with uninitialized CONF data. now
+ OpenSSL::Config#clone works as expected; cloning the config instead of
+ SEGV or empty definition.
+
+ * test/openssl/test_config.rb: added tests for Config#clone.
+
Sat Jul 10 10:51:29 2010 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* configure.in: fix use_context condition inversion.
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index 366c20feba..6db5450a77 100644
--- a/ext/openssl/ossl_config.c
+++ b/ext/openssl/ossl_config.c
@@ -119,8 +119,8 @@ ossl_config_copy(VALUE self, VALUE other)
VALUE str;
CONF *conf;
- str = rb_funcall(self, rb_intern("to_s"), 0);
- GetConfig(other, conf);
+ str = rb_funcall(other, rb_intern("to_s"), 0);
+ GetConfig(self, conf);
parse_config(str, conf);
return self;
diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb
index 64aadd86b4..46f287c1b7 100644
--- a/test/openssl/test_config.rb
+++ b/test/openssl/test_config.rb
@@ -271,4 +271,16 @@ __EOC__
c['foo'] = [['key', 'wrong']]
end
end
+
+ def test_dup
+ assert(!@it.sections.empty?)
+ c = @it.dup
+ assert_equal(@it.sections.sort, c.sections.sort)
+ end
+
+ def test_clone
+ assert(!@it.sections.empty?)
+ c = @it.clone
+ assert_equal(@it.sections.sort, c.sections.sort)
+ end
end