Merge pull request #16640 from mehrdada/fix-ssl-credentials-null

Fix SSL channel credential when an argument is None
pull/16641/head
Mehrdad Afshari 6 years ago committed by GitHub
commit 14610176e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi

@ -144,8 +144,14 @@ cdef class SSLChannelCredentials(ChannelCredentials):
return grpc_ssl_credentials_create( return grpc_ssl_credentials_create(
c_pem_root_certificates, NULL, NULL, NULL) c_pem_root_certificates, NULL, NULL, NULL)
else: else:
c_pem_key_certificate_pair.private_key = self._private_key if self._private_key:
c_pem_key_certificate_pair.certificate_chain = self._certificate_chain 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( return grpc_ssl_credentials_create(
c_pem_root_certificates, &c_pem_key_certificate_pair, NULL, NULL) c_pem_root_certificates, &c_pem_key_certificate_pair, NULL, NULL)

Loading…
Cancel
Save