Set SSL_CTX_set_verify even if pem_client_root_certs is null

pull/17500/head
jiangtaoli2016 6 years ago
parent 311ee1eda1
commit 4ec4c0b6b4
  1. 11
      src/core/tsi/ssl_transport_security.cc

@ -1850,6 +1850,7 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
break; break;
} }
SSL_CTX_set_client_CA_list(impl->ssl_contexts[i], root_names); SSL_CTX_set_client_CA_list(impl->ssl_contexts[i], root_names);
}
switch (options->client_certificate_request) { switch (options->client_certificate_request) {
case TSI_DONT_REQUEST_CLIENT_CERTIFICATE: case TSI_DONT_REQUEST_CLIENT_CERTIFICATE:
SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_NONE, nullptr); SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_NONE, nullptr);
@ -1862,19 +1863,17 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_PEER, nullptr); SSL_CTX_set_verify(impl->ssl_contexts[i], SSL_VERIFY_PEER, nullptr);
break; break;
case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY: case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY:
SSL_CTX_set_verify( SSL_CTX_set_verify(impl->ssl_contexts[i],
impl->ssl_contexts[i],
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
NullVerifyCallback); NullVerifyCallback);
break; break;
case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY: case TSI_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY:
SSL_CTX_set_verify( SSL_CTX_set_verify(impl->ssl_contexts[i],
impl->ssl_contexts[i], SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr); nullptr);
break; break;
} }
/* TODO(jboeuf): Add revocation verification. */ /* TODO(jboeuf): Add revocation verification. */
}
result = extract_x509_subject_names_from_pem_cert( result = extract_x509_subject_names_from_pem_cert(
options->pem_key_cert_pairs[i].cert_chain, options->pem_key_cert_pairs[i].cert_chain,

Loading…
Cancel
Save