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