diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-12-10 16:41:11 -0800 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-12-10 17:09:06 -0800 |
commit | a6b2c4ce468f06094810252cfa7f136d398ddd9e (patch) | |
tree | 4f6d9caf605e3e103185992da362965c8c489ce8 /src/ruby/ext/grpc/rb_channel_credentials.c | |
parent | d574049b8b1b0c7f19abb549612968cf89372c42 (diff) |
Get rid of SSL_CERT_FILE env entirely
Diffstat (limited to 'src/ruby/ext/grpc/rb_channel_credentials.c')
-rw-r--r-- | src/ruby/ext/grpc/rb_channel_credentials.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/ruby/ext/grpc/rb_channel_credentials.c b/src/ruby/ext/grpc/rb_channel_credentials.c index 072a6f54ab..c7f4914997 100644 --- a/src/ruby/ext/grpc/rb_channel_credentials.c +++ b/src/ruby/ext/grpc/rb_channel_credentials.c @@ -148,11 +148,13 @@ static ID id_pem_cert_chain; /* call-seq: - creds1 = Credentials.new(pem_root_certs) + creds1 = Credentials.new() ... - creds2 = Credentials.new(pem_root_certs, pem_private_key, + creds2 = Credentials.new(pem_root_certs) + ... + creds3 = Credentials.new(pem_root_certs, pem_private_key, pem_cert_chain) - pem_root_certs: (required) PEM encoding of the server root certificate + pem_root_certs: (optional) PEM encoding of the server root certificate pem_private_key: (optional) PEM encoding of the client's private key pem_cert_chain: (optional) PEM encoding of the client's cert chain Initializes Credential instances. */ @@ -164,21 +166,16 @@ static VALUE grpc_rb_channel_credentials_init(int argc, VALUE *argv, VALUE self) grpc_channel_credentials *creds = NULL; grpc_ssl_pem_key_cert_pair key_cert_pair; MEMZERO(&key_cert_pair, grpc_ssl_pem_key_cert_pair, 1); - /* TODO: Remove mandatory arg when we support default roots. */ - /* "12" == 1 mandatory arg, 2 (credentials) is optional */ - rb_scan_args(argc, argv, "12", &pem_root_certs, &pem_private_key, + /* "03" == no mandatory arg, 3 optional */ + rb_scan_args(argc, argv, "03", &pem_root_certs, &pem_private_key, &pem_cert_chain); TypedData_Get_Struct(self, grpc_rb_channel_credentials, &grpc_rb_channel_credentials_data_type, wrapper); - if (pem_root_certs == Qnil) { - rb_raise(rb_eRuntimeError, - "could not create a credential: nil pem_root_certs"); - return Qnil; - } if (pem_private_key == Qnil && pem_cert_chain == Qnil) { - creds = - grpc_ssl_credentials_create(RSTRING_PTR(pem_root_certs), NULL, NULL); + creds = grpc_ssl_credentials_create( + pem_root_certs == Qnil ? NULL : RSTRING_PTR(pem_root_certs), + NULL, NULL); } else { key_cert_pair.private_key = RSTRING_PTR(pem_private_key); key_cert_pair.cert_chain = RSTRING_PTR(pem_cert_chain); |