diff options
author | Craig Tiller <ctiller@google.com> | 2017-03-10 10:20:17 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-03-10 10:20:17 -0800 |
commit | 72920cc08ac8bee1816422974468502ce43e9b7b (patch) | |
tree | 0428d022df797c0ed3b4e0bb5287144f0fd62d6b /src/core/lib/security | |
parent | 8c09d6795a8702585e9bb6596c2ae8da33709078 (diff) |
Conversion progress
Diffstat (limited to 'src/core/lib/security')
-rw-r--r-- | src/core/lib/security/transport/client_auth_filter.c | 26 | ||||
-rw-r--r-- | src/core/lib/security/transport/server_auth_filter.c | 18 |
2 files changed, 26 insertions, 18 deletions
diff --git a/src/core/lib/security/transport/client_auth_filter.c b/src/core/lib/security/transport/client_auth_filter.c index a23082a866..98ef36518a 100644 --- a/src/core/lib/security/transport/client_auth_filter.c +++ b/src/core/lib/security/transport/client_auth_filter.c @@ -120,8 +120,8 @@ static void on_credentials_metadata(grpc_exec_ctx *exec_ctx, void *user_data, GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAUTHENTICATED); } else { GPR_ASSERT(num_md <= MAX_CREDENTIALS_METADATA_COUNT); - GPR_ASSERT(op->send_initial_metadata != NULL); - mdb = op->send_initial_metadata; + GPR_ASSERT(op->send_initial_metadata); + mdb = op->payload->send_initial_metadata.send_initial_metadata; for (i = 0; i < num_md; i++) { add_error(&error, grpc_metadata_batch_add_tail( @@ -174,7 +174,9 @@ static void send_security_metadata(grpc_exec_ctx *exec_ctx, call_data *calld = elem->call_data; channel_data *chand = elem->channel_data; grpc_client_security_context *ctx = - (grpc_client_security_context *)op->context[GRPC_CONTEXT_SECURITY].value; + (grpc_client_security_context *)op->payload + ->context[GRPC_CONTEXT_SECURITY] + .value; grpc_call_credentials *channel_call_creds = chand->security_connector->request_metadata_creds; int call_creds_has_md = (ctx != NULL) && (ctx->creds != NULL); @@ -248,23 +250,25 @@ static void auth_start_transport_op(grpc_exec_ctx *exec_ctx, grpc_linked_mdelem *l; grpc_client_security_context *sec_ctx = NULL; - if (calld->security_context_set == 0 && op->cancel_error == GRPC_ERROR_NONE) { + if (calld->security_context_set == 0 && !op->cancel_stream) { calld->security_context_set = 1; - GPR_ASSERT(op->context); - if (op->context[GRPC_CONTEXT_SECURITY].value == NULL) { - op->context[GRPC_CONTEXT_SECURITY].value = + GPR_ASSERT(op->payload->context != NULL); + if (op->payload->context[GRPC_CONTEXT_SECURITY].value == NULL) { + op->payload->context[GRPC_CONTEXT_SECURITY].value = grpc_client_security_context_create(); - op->context[GRPC_CONTEXT_SECURITY].destroy = + op->payload->context[GRPC_CONTEXT_SECURITY].destroy = grpc_client_security_context_destroy; } - sec_ctx = op->context[GRPC_CONTEXT_SECURITY].value; + sec_ctx = op->payload->context[GRPC_CONTEXT_SECURITY].value; GRPC_AUTH_CONTEXT_UNREF(sec_ctx->auth_context, "client auth filter"); sec_ctx->auth_context = GRPC_AUTH_CONTEXT_REF(chand->auth_context, "client_auth_filter"); } - if (op->send_initial_metadata != NULL) { - for (l = op->send_initial_metadata->list.head; l != NULL; l = l->next) { + if (op->send_initial_metadata) { + for (l = op->payload->send_initial_metadata.send_initial_metadata->list + .head; + l != NULL; l = l->next) { grpc_mdelem md = l->md; /* Pointer comparison is OK for md_elems created from the same context. */ diff --git a/src/core/lib/security/transport/server_auth_filter.c b/src/core/lib/security/transport/server_auth_filter.c index 14619d97ca..afd07d6917 100644 --- a/src/core/lib/security/transport/server_auth_filter.c +++ b/src/core/lib/security/transport/server_auth_filter.c @@ -139,9 +139,10 @@ static void on_md_processing_done( ? error_details : "Authentication metadata processing failed."; calld->transport_op->send_initial_metadata = NULL; - if (calld->transport_op->send_message != NULL) { - grpc_byte_stream_destroy(&exec_ctx, calld->transport_op->send_message); - calld->transport_op->send_message = NULL; + if (calld->transport_op->send_message) { + grpc_byte_stream_destroy( + &exec_ctx, calld->transport_op->payload->send_message.send_message); + calld->transport_op->send_message = false; } calld->transport_op->send_trailing_metadata = NULL; grpc_closure_sched(&exec_ctx, calld->on_done_recv, @@ -173,11 +174,14 @@ static void set_recv_ops_md_callbacks(grpc_call_element *elem, grpc_transport_stream_op *op) { call_data *calld = elem->call_data; - if (op->recv_initial_metadata != NULL) { + if (op->recv_initial_metadata) { /* substitute our callback for the higher callback */ - calld->recv_initial_metadata = op->recv_initial_metadata; - calld->on_done_recv = op->recv_initial_metadata_ready; - op->recv_initial_metadata_ready = &calld->auth_on_recv; + calld->recv_initial_metadata = + op->payload->recv_initial_metadata.recv_initial_metadata; + calld->on_done_recv = + op->payload->recv_initial_metadata.recv_initial_metadata_ready; + op->payload->recv_initial_metadata.recv_initial_metadata_ready = + &calld->auth_on_recv; calld->transport_op = op; } } |