diff options
author | Mehrdad Afshari <mmx@google.com> | 2018-09-17 11:06:13 -0700 |
---|---|---|
committer | Mehrdad Afshari <mmx@google.com> | 2018-09-17 11:08:00 -0700 |
commit | 3586ac1c991f7d33f03e05b258ecfe09c5aa1b11 (patch) | |
tree | 8053a1a6088255535d2597a8b50513ee3bf48810 /src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi | |
parent | a07fcbcc278a8ac29a5d5ae6cd584b92d4ae49b8 (diff) |
Fix SSL channel credential when an argument is None
Diffstat (limited to 'src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi')
-rw-r--r-- | src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi index 38fd9e78b2..63048e8da0 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi @@ -144,8 +144,14 @@ cdef class SSLChannelCredentials(ChannelCredentials): return grpc_ssl_credentials_create( c_pem_root_certificates, NULL, NULL, NULL) else: - c_pem_key_certificate_pair.private_key = self._private_key - c_pem_key_certificate_pair.certificate_chain = self._certificate_chain + if self._private_key: + c_pem_key_certificate_pair.private_key = self._private_key + else: + c_pem_key_certificate_pair.private_key = NULL + if self._certificate_chain: + c_pem_key_certificate_pair.certificate_chain = self._certificate_chain + else: + c_pem_key_certificate_pair.certificate_chain = NULL return grpc_ssl_credentials_create( c_pem_root_certificates, &c_pem_key_certificate_pair, NULL, NULL) |