aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/http/httpcli_security_connector.cc
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2017-11-14 11:38:31 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2017-11-14 11:38:31 -0800
commit88a7a9f82e3a78f28b3e6eb1fba474051d72173b (patch)
tree976bbe79a01ef8d71465a9d1690a390667c70816 /src/core/lib/http/httpcli_security_connector.cc
parent684f15b210fe4442b714dc93053f05a75431629e (diff)
parent38107493cd0150bed33d3a8472cc8700b7de8a21 (diff)
Merge branch 'master' of https://github.com/grpc/grpc into inheritance-in-core
Diffstat (limited to 'src/core/lib/http/httpcli_security_connector.cc')
-rw-r--r--src/core/lib/http/httpcli_security_connector.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/core/lib/http/httpcli_security_connector.cc b/src/core/lib/http/httpcli_security_connector.cc
index d029323eac..d25fba538f 100644
--- a/src/core/lib/http/httpcli_security_connector.cc
+++ b/src/core/lib/http/httpcli_security_connector.cc
@@ -42,11 +42,11 @@ static void httpcli_ssl_destroy(grpc_exec_ctx* exec_ctx,
grpc_security_connector* sc) {
grpc_httpcli_ssl_channel_security_connector* c =
(grpc_httpcli_ssl_channel_security_connector*)sc;
- if (c->handshaker_factory != NULL) {
+ if (c->handshaker_factory != nullptr) {
tsi_ssl_client_handshaker_factory_unref(c->handshaker_factory);
- c->handshaker_factory = NULL;
+ c->handshaker_factory = nullptr;
}
- if (c->secure_peer_name != NULL) gpr_free(c->secure_peer_name);
+ if (c->secure_peer_name != nullptr) gpr_free(c->secure_peer_name);
gpr_free(sc);
}
@@ -55,8 +55,8 @@ static void httpcli_ssl_add_handshakers(grpc_exec_ctx* exec_ctx,
grpc_handshake_manager* handshake_mgr) {
grpc_httpcli_ssl_channel_security_connector* c =
(grpc_httpcli_ssl_channel_security_connector*)sc;
- tsi_handshaker* handshaker = NULL;
- if (c->handshaker_factory != NULL) {
+ tsi_handshaker* handshaker = nullptr;
+ if (c->handshaker_factory != nullptr) {
tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker(
c->handshaker_factory, c->secure_peer_name, &handshaker);
if (result != TSI_OK) {
@@ -79,7 +79,7 @@ static void httpcli_ssl_check_peer(grpc_exec_ctx* exec_ctx,
grpc_error* error = GRPC_ERROR_NONE;
/* Check the peer name. */
- if (c->secure_peer_name != NULL &&
+ if (c->secure_peer_name != nullptr &&
!tsi_ssl_peer_matches_name(&peer, c->secure_peer_name)) {
char* msg;
gpr_asprintf(&msg, "Peer name %s is not in peer certificate",
@@ -109,7 +109,7 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
tsi_result result = TSI_OK;
grpc_httpcli_ssl_channel_security_connector* c;
- if (secure_peer_name != NULL && pem_root_certs == NULL) {
+ if (secure_peer_name != nullptr && pem_root_certs == nullptr) {
gpr_log(GPR_ERROR,
"Cannot assert a secure peer name without a trust root.");
return GRPC_SECURITY_ERROR;
@@ -120,16 +120,16 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.vtable = &httpcli_ssl_vtable;
- if (secure_peer_name != NULL) {
+ if (secure_peer_name != nullptr) {
c->secure_peer_name = gpr_strdup(secure_peer_name);
}
result = tsi_create_ssl_client_handshaker_factory(
- NULL, pem_root_certs, NULL, NULL, 0, &c->handshaker_factory);
+ nullptr, pem_root_certs, nullptr, nullptr, 0, &c->handshaker_factory);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result));
httpcli_ssl_destroy(exec_ctx, &c->base.base);
- *sc = NULL;
+ *sc = nullptr;
return GRPC_SECURITY_ERROR;
}
// We don't actually need a channel credentials object in this case,
@@ -157,7 +157,7 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
const char* msg = grpc_error_string(error);
gpr_log(GPR_ERROR, "Secure transport setup failed: %s", msg);
- c->func(exec_ctx, c->arg, NULL);
+ c->func(exec_ctx, c->arg, nullptr);
} else {
grpc_channel_args_destroy(exec_ctx, args->args);
grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer);
@@ -175,15 +175,15 @@ static void ssl_handshake(grpc_exec_ctx* exec_ctx, void* arg,
grpc_endpoint* endpoint)) {
on_done_closure* c = (on_done_closure*)gpr_malloc(sizeof(*c));
const char* pem_root_certs = grpc_get_default_ssl_roots();
- if (pem_root_certs == NULL) {
+ if (pem_root_certs == nullptr) {
gpr_log(GPR_ERROR, "Could not get default pem root certs.");
- on_done(exec_ctx, arg, NULL);
+ on_done(exec_ctx, arg, nullptr);
gpr_free(c);
return;
}
c->func = on_done;
c->arg = arg;
- grpc_channel_security_connector* sc = NULL;
+ grpc_channel_security_connector* sc = nullptr;
GPR_ASSERT(httpcli_ssl_channel_security_connector_create(
exec_ctx, pem_root_certs, host, &sc) == GRPC_SECURITY_OK);
grpc_arg channel_arg = grpc_security_connector_to_arg(&sc->base);
@@ -191,8 +191,8 @@ static void ssl_handshake(grpc_exec_ctx* exec_ctx, void* arg,
c->handshake_mgr = grpc_handshake_manager_create();
grpc_handshakers_add(exec_ctx, HANDSHAKER_CLIENT, &args, c->handshake_mgr);
grpc_handshake_manager_do_handshake(
- exec_ctx, c->handshake_mgr, tcp, NULL /* channel_args */, deadline,
- NULL /* acceptor */, on_handshake_done, c /* user_data */);
+ exec_ctx, c->handshake_mgr, tcp, nullptr /* channel_args */, deadline,
+ nullptr /* acceptor */, on_handshake_done, c /* user_data */);
GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &sc->base, "httpcli");
}