Skip to content

Commit ea92561

Browse files
committed
ssl: temporarily remove SSLContext#add_certificate_chain_file
Let's revert the changes for now, as it cannot be included in the 2.2.0 release. My comment on #257: > A blocker is OpenSSL::SSL::SSLContext#add_certificate_chain_file. It > has a pending change and I don't want to include it in an incomplete > state. > > The initial implementation in commit 46e4bdb was not really > useful. The issue is described in #305. #309 extended it > to take the corresponding private key together. However, the new > implementation was incompatible on Windows and was reverted by #320 to > the initial one. > > (The prerequisite to implement it in) an alternative way is #288, and > it's still cooking. This effectively reverts the following commits: - dacd089 ("ssl: suppress test failure with SSLContext#add_certificate_chain_file", 2020-03-09) - 46e4bdb ("Add support for SSL_CTX_use_certificate_chain_file. Fixes #254.", 2019-06-13)
1 parent 306b26a commit ea92561

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

ext/openssl/ossl_ssl.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,21 +1329,6 @@ ossl_sslctx_add_certificate(int argc, VALUE *argv, VALUE self)
13291329
return self;
13301330
}
13311331

1332-
static VALUE
1333-
ossl_sslctx_add_certificate_chain_file(VALUE self, VALUE path)
1334-
{
1335-
SSL_CTX *ctx;
1336-
int ret;
1337-
1338-
GetSSLCTX(self, ctx);
1339-
StringValueCStr(path);
1340-
ret = SSL_CTX_use_certificate_chain_file(ctx, RSTRING_PTR(path));
1341-
if (ret != 1)
1342-
ossl_raise(eSSLError, "SSL_CTX_use_certificate_chain_file");
1343-
1344-
return Qtrue;
1345-
}
1346-
13471332
/*
13481333
* call-seq:
13491334
* ctx.session_add(session) -> true | false
@@ -2795,7 +2780,6 @@ Init_ossl_ssl(void)
27952780
rb_define_method(cSSLContext, "enable_fallback_scsv", ossl_sslctx_enable_fallback_scsv, 0);
27962781
#endif
27972782
rb_define_method(cSSLContext, "add_certificate", ossl_sslctx_add_certificate, -1);
2798-
rb_define_method(cSSLContext, "add_certificate_chain_file", ossl_sslctx_add_certificate_chain_file, 1);
27992783

28002784
rb_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0);
28012785
rb_define_alias(cSSLContext, "freeze", "setup");

test/openssl/test_ssl.rb

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -189,34 +189,6 @@ def test_add_certificate_multiple_certs
189189
end
190190
end
191191

192-
def test_add_certificate_chain_file
193-
# Create chain certificates file
194-
certs = Tempfile.open { |f| f << @svr_cert.to_pem << @ca_cert.to_pem; f }
195-
pkey = Tempfile.open { |f| f << @svr_key.to_pem; f }
196-
197-
ctx_proc = -> ctx {
198-
# FIXME: This is a temporary test case written just to match the current
199-
# state. ctx.add_certificate_chain_file should take two arguments.
200-
ctx.add_certificate_chain_file(certs.path)
201-
# # Unset values set by start_server
202-
# ctx.cert = ctx.key = ctx.extra_chain_cert = nil
203-
# assert_nothing_raised { ctx.add_certificate_chain_file(certs.path, pkey.path) }
204-
}
205-
206-
start_server(ctx_proc: ctx_proc) { |port|
207-
server_connect(port) { |ssl|
208-
assert_equal @svr_cert.subject, ssl.peer_cert.subject
209-
assert_equal [@svr_cert.subject, @ca_cert.subject],
210-
ssl.peer_cert_chain.map(&:subject)
211-
212-
ssl.puts "abc"; assert_equal "abc\n", ssl.gets
213-
}
214-
}
215-
ensure
216-
certs&.unlink
217-
pkey&.unlink
218-
end
219-
220192
def test_sysread_and_syswrite
221193
start_server { |port|
222194
server_connect(port) { |ssl|

0 commit comments

Comments
 (0)