From 22aeb6373e13929e80da1676b1dc79cbfffc38a4 Mon Sep 17 00:00:00 2001 From: Kazuki Yamaguchi Date: Wed, 19 Feb 2020 05:06:09 +0000 Subject: [ruby/openssl] config: revert to C implementation of OpenSSL::Config Revert OpenSSL::Config to using the OpenSSL API and remove our own parser implementation for the config file syntax. OpenSSL::Config now wraps a CONF object. Accessor methods deal with the object directly rather than Ruby-level internal state. This work is based on the old C code we used before 2010. https://github.com/ruby/openssl/commit/c891e0ea89 --- test/openssl/test_config.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb index 01be28164a..3af9923d2a 100644 --- a/test/openssl/test_config.rb +++ b/test/openssl/test_config.rb @@ -150,6 +150,10 @@ __EOC__ # Include a file by relative path c1 = OpenSSL::Config.parse(include_file) + if c1["sec-main"][".include"] + # OpenSSL < 1.1.1 parses '.include =' as a normal assignment + pend ".include directive is not supported" + end assert_equal(["default", "sec-a", "sec-b", "sec-main"], c1.sections.sort) assert_equal(["file-a", "file-b", "file-main"], c1["default"].keys.sort) assert_equal({"a" => "123"}, c1["sec-a"]) @@ -157,9 +161,9 @@ __EOC__ assert_equal({"main" => "123", "key_outside_section" => "value_a"}, c1["sec-main"]) # Relative paths are from the working directory - assert_raise(OpenSSL::ConfigError) do - Dir.chdir("child") { OpenSSL::Config.parse(include_file) } - end + # Inclusion fails, but the error is ignored silently + c2 = Dir.chdir("child") { OpenSSL::Config.parse(include_file) } + assert_equal(["default", "sec-main"], c2.sections.sort) end end -- cgit v1.2.3