diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2020-02-19 05:06:09 +0000 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2021-03-16 19:16:10 +0900 |
commit | 22aeb6373e13929e80da1676b1dc79cbfffc38a4 (patch) | |
tree | 5e8d670bacb07bda665145a5987cbeaf2cbed304 /test/openssl/test_config.rb | |
parent | 7c13d2b3cc503790d044a6f5a34a61c50bc643c3 (diff) | |
download | ruby-22aeb6373e13929e80da1676b1dc79cbfffc38a4.tar.gz |
[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
Diffstat (limited to 'test/openssl/test_config.rb')
-rw-r--r-- | test/openssl/test_config.rb | 10 |
1 files changed, 7 insertions, 3 deletions
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 |