|
|
|
@ -127,25 +127,29 @@ void grpc_server_security_connector_shutdown( |
|
|
|
|
|
|
|
|
|
void grpc_channel_security_connector_do_handshake( |
|
|
|
|
grpc_exec_ctx *exec_ctx, grpc_channel_security_connector *sc, |
|
|
|
|
grpc_endpoint *nonsecure_endpoint, gpr_timespec deadline, |
|
|
|
|
grpc_security_handshake_done_cb cb, void *user_data) { |
|
|
|
|
grpc_endpoint *nonsecure_endpoint, gpr_slice_buffer *read_buffer, |
|
|
|
|
gpr_timespec deadline, grpc_security_handshake_done_cb cb, |
|
|
|
|
void *user_data) { |
|
|
|
|
if (sc == NULL || nonsecure_endpoint == NULL) { |
|
|
|
|
gpr_free(read_buffer); |
|
|
|
|
cb(exec_ctx, user_data, GRPC_SECURITY_ERROR, NULL, NULL); |
|
|
|
|
} else { |
|
|
|
|
sc->do_handshake(exec_ctx, sc, nonsecure_endpoint, deadline, cb, user_data); |
|
|
|
|
sc->do_handshake(exec_ctx, sc, nonsecure_endpoint, read_buffer, deadline, |
|
|
|
|
cb, user_data); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void grpc_server_security_connector_do_handshake( |
|
|
|
|
grpc_exec_ctx *exec_ctx, grpc_server_security_connector *sc, |
|
|
|
|
grpc_tcp_server_acceptor *acceptor, grpc_endpoint *nonsecure_endpoint, |
|
|
|
|
gpr_timespec deadline, grpc_security_handshake_done_cb cb, |
|
|
|
|
void *user_data) { |
|
|
|
|
gpr_slice_buffer *read_buffer, gpr_timespec deadline, |
|
|
|
|
grpc_security_handshake_done_cb cb, void *user_data) { |
|
|
|
|
if (sc == NULL || nonsecure_endpoint == NULL) { |
|
|
|
|
gpr_free(read_buffer); |
|
|
|
|
cb(exec_ctx, user_data, GRPC_SECURITY_ERROR, NULL, NULL); |
|
|
|
|
} else { |
|
|
|
|
sc->do_handshake(exec_ctx, sc, acceptor, nonsecure_endpoint, deadline, cb, |
|
|
|
|
user_data); |
|
|
|
|
sc->do_handshake(exec_ctx, sc, acceptor, nonsecure_endpoint, read_buffer, |
|
|
|
|
deadline, cb, user_data); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -312,23 +316,26 @@ static void fake_channel_check_call_host(grpc_exec_ctx *exec_ctx, |
|
|
|
|
static void fake_channel_do_handshake(grpc_exec_ctx *exec_ctx, |
|
|
|
|
grpc_channel_security_connector *sc, |
|
|
|
|
grpc_endpoint *nonsecure_endpoint, |
|
|
|
|
gpr_slice_buffer *read_buffer, |
|
|
|
|
gpr_timespec deadline, |
|
|
|
|
grpc_security_handshake_done_cb cb, |
|
|
|
|
void *user_data) { |
|
|
|
|
grpc_do_security_handshake(exec_ctx, tsi_create_fake_handshaker(1), &sc->base, |
|
|
|
|
true, nonsecure_endpoint, deadline, cb, user_data); |
|
|
|
|
true, nonsecure_endpoint, read_buffer, deadline, |
|
|
|
|
cb, user_data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void fake_server_do_handshake(grpc_exec_ctx *exec_ctx, |
|
|
|
|
grpc_server_security_connector *sc, |
|
|
|
|
grpc_tcp_server_acceptor *acceptor, |
|
|
|
|
grpc_endpoint *nonsecure_endpoint, |
|
|
|
|
gpr_slice_buffer *read_buffer, |
|
|
|
|
gpr_timespec deadline, |
|
|
|
|
grpc_security_handshake_done_cb cb, |
|
|
|
|
void *user_data) { |
|
|
|
|
grpc_do_security_handshake(exec_ctx, tsi_create_fake_handshaker(0), &sc->base, |
|
|
|
|
false, nonsecure_endpoint, deadline, cb, |
|
|
|
|
user_data); |
|
|
|
|
false, nonsecure_endpoint, read_buffer, deadline, |
|
|
|
|
cb, user_data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static grpc_security_connector_vtable fake_channel_vtable = { |
|
|
|
@ -418,6 +425,7 @@ static grpc_security_status ssl_create_handshaker( |
|
|
|
|
static void ssl_channel_do_handshake(grpc_exec_ctx *exec_ctx, |
|
|
|
|
grpc_channel_security_connector *sc, |
|
|
|
|
grpc_endpoint *nonsecure_endpoint, |
|
|
|
|
gpr_slice_buffer *read_buffer, |
|
|
|
|
gpr_timespec deadline, |
|
|
|
|
grpc_security_handshake_done_cb cb, |
|
|
|
|
void *user_data) { |
|
|
|
@ -430,10 +438,12 @@ static void ssl_channel_do_handshake(grpc_exec_ctx *exec_ctx, |
|
|
|
|
: c->target_name, |
|
|
|
|
&handshaker); |
|
|
|
|
if (status != GRPC_SECURITY_OK) { |
|
|
|
|
gpr_free(read_buffer); |
|
|
|
|
cb(exec_ctx, user_data, status, NULL, NULL); |
|
|
|
|
} else { |
|
|
|
|
grpc_do_security_handshake(exec_ctx, handshaker, &sc->base, true, |
|
|
|
|
nonsecure_endpoint, deadline, cb, user_data); |
|
|
|
|
nonsecure_endpoint, read_buffer, deadline, cb, |
|
|
|
|
user_data); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -441,6 +451,7 @@ static void ssl_server_do_handshake(grpc_exec_ctx *exec_ctx, |
|
|
|
|
grpc_server_security_connector *sc, |
|
|
|
|
grpc_tcp_server_acceptor *acceptor, |
|
|
|
|
grpc_endpoint *nonsecure_endpoint, |
|
|
|
|
gpr_slice_buffer *read_buffer, |
|
|
|
|
gpr_timespec deadline, |
|
|
|
|
grpc_security_handshake_done_cb cb, |
|
|
|
|
void *user_data) { |
|
|
|
@ -450,10 +461,12 @@ static void ssl_server_do_handshake(grpc_exec_ctx *exec_ctx, |
|
|
|
|
grpc_security_status status = |
|
|
|
|
ssl_create_handshaker(c->handshaker_factory, false, NULL, &handshaker); |
|
|
|
|
if (status != GRPC_SECURITY_OK) { |
|
|
|
|
gpr_free(read_buffer); |
|
|
|
|
cb(exec_ctx, user_data, status, NULL, NULL); |
|
|
|
|
} else { |
|
|
|
|
grpc_do_security_handshake(exec_ctx, handshaker, &sc->base, false, |
|
|
|
|
nonsecure_endpoint, deadline, cb, user_data); |
|
|
|
|
nonsecure_endpoint, read_buffer, deadline, cb, |
|
|
|
|
user_data); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|