diff options
author | Craig Tiller <ctiller@google.com> | 2017-01-12 13:41:52 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-01-12 13:41:52 -0800 |
commit | 95beab22843369189836828a0116a9760482ce7f (patch) | |
tree | 607151de481b16a18df4fdaaf83aaf74eb743f2b /src/core | |
parent | e5d8e02aa6efd3ce97f788560df3994473df8327 (diff) |
Uncover the badness
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lib/iomgr/closure.c | 1 | ||||
-rw-r--r-- | src/core/lib/iomgr/closure.h | 1 | ||||
-rw-r--r-- | src/core/lib/iomgr/combiner.c | 12 | ||||
-rw-r--r-- | src/core/lib/iomgr/ev_epoll_linux.c | 2 | ||||
-rw-r--r-- | src/core/lib/iomgr/exec_ctx.c | 2 | ||||
-rw-r--r-- | src/core/lib/iomgr/executor.c | 4 | ||||
-rw-r--r-- | src/core/lib/security/credentials/plugin/plugin_credentials.c | 11 | ||||
-rw-r--r-- | src/core/lib/security/transport/client_auth_filter.c | 24 |
8 files changed, 26 insertions, 31 deletions
diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index da0ec878a3..8e4efd3370 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -34,6 +34,7 @@ #include "src/core/lib/iomgr/closure.h" #include <grpc/support/alloc.h> +#include <grpc/support/log.h> #include "src/core/lib/profiling/timers.h" diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index ee386fbc76..6748b21e59 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -66,6 +66,7 @@ typedef struct grpc_closure_scheduler_vtable { grpc_error *error); void (*sched)(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error); + const char *name; } grpc_closure_scheduler_vtable; /** Abstract type that can schedule closures for execution */ diff --git a/src/core/lib/iomgr/combiner.c b/src/core/lib/iomgr/combiner.c index c26a73b2b7..ba6c7087a9 100644 --- a/src/core/lib/iomgr/combiner.c +++ b/src/core/lib/iomgr/combiner.c @@ -86,13 +86,17 @@ static void combiner_finally_exec_covered(grpc_exec_ctx *exec_ctx, grpc_error *error); static const grpc_closure_scheduler_vtable scheduler_uncovered = { - combiner_exec_uncovered, combiner_exec_uncovered}; + combiner_exec_uncovered, combiner_exec_uncovered, + "combiner:immediately:uncovered"}; static const grpc_closure_scheduler_vtable scheduler_covered = { - combiner_exec_covered, combiner_exec_covered}; + combiner_exec_covered, combiner_exec_covered, + "combiner:immediately:covered"}; static const grpc_closure_scheduler_vtable finally_scheduler_uncovered = { - combiner_finally_exec_uncovered, combiner_finally_exec_uncovered}; + combiner_finally_exec_uncovered, combiner_finally_exec_uncovered, + "combiner:finally:uncovered"}; static const grpc_closure_scheduler_vtable finally_scheduler_covered = { - combiner_finally_exec_covered, combiner_finally_exec_covered}; + combiner_finally_exec_covered, combiner_finally_exec_covered, + "combiner:finally:covered"}; static void offload(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error); diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c index d6664aead2..39b5c0032e 100644 --- a/src/core/lib/iomgr/ev_epoll_linux.c +++ b/src/core/lib/iomgr/ev_epoll_linux.c @@ -321,7 +321,7 @@ gpr_atm g_epoll_sync; #endif /* defined(GRPC_TSAN) */ static const grpc_closure_scheduler_vtable workqueue_scheduler_vtable = { - workqueue_enqueue, workqueue_enqueue}; + workqueue_enqueue, workqueue_enqueue, "workqueue"}; static void pi_add_ref(polling_island *pi); static void pi_unref(grpc_exec_ctx *exec_ctx, polling_island *pi); diff --git a/src/core/lib/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c index 6aa788f8e5..fabe6c6988 100644 --- a/src/core/lib/iomgr/exec_ctx.c +++ b/src/core/lib/iomgr/exec_ctx.c @@ -101,6 +101,6 @@ void grpc_exec_ctx_global_init(void) {} void grpc_exec_ctx_global_shutdown(void) {} static const grpc_closure_scheduler_vtable exec_ctx_scheduler_vtable = { - exec_ctx_run, exec_ctx_sched}; + exec_ctx_run, exec_ctx_sched, "exec_ctx"}; static grpc_closure_scheduler exec_ctx_scheduler = {&exec_ctx_scheduler_vtable}; grpc_closure_scheduler *grpc_schedule_on_exec_ctx = &exec_ctx_scheduler; diff --git a/src/core/lib/iomgr/executor.c b/src/core/lib/iomgr/executor.c index 852775564f..a5b62aa888 100644 --- a/src/core/lib/iomgr/executor.c +++ b/src/core/lib/iomgr/executor.c @@ -158,7 +158,7 @@ void grpc_executor_shutdown(grpc_exec_ctx *exec_ctx) { gpr_mu_destroy(&g_executor.mu); } -static const grpc_closure_scheduler_vtable executor_vtable = {executor_push, - executor_push}; +static const grpc_closure_scheduler_vtable executor_vtable = { + executor_push, executor_push, "executor"}; static grpc_closure_scheduler executor_scheduler = {&executor_vtable}; grpc_closure_scheduler *grpc_executor_scheduler = &executor_scheduler; diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.c b/src/core/lib/security/credentials/plugin/plugin_credentials.c index c5e8d67039..afce6a6b12 100644 --- a/src/core/lib/security/credentials/plugin/plugin_credentials.c +++ b/src/core/lib/security/credentials/plugin/plugin_credentials.c @@ -44,6 +44,7 @@ #include "src/core/lib/slice/slice_internal.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/surface/api_trace.h" +#include "src/core/lib/surface/validate_metadata.h" typedef struct { void *user_data; @@ -78,14 +79,14 @@ static void plugin_md_request_metadata_ready(void *request, bool seen_illegal_header = false; grpc_credentials_md *md_array = NULL; for (i = 0; i < num_md; i++) { - if (!grpc_header_key_is_legal(md[i].key)) { - char *key = grpc_slice_to_c_string(md[i].key); - gpr_log(GPR_ERROR, "Plugin added invalid metadata key: %s", key); - gpr_free(key); + if (!GRPC_LOG_IF_ERROR("validate_metadata_from_plugin", + grpc_validate_header_key_is_legal(md[i].key))) { seen_illegal_header = true; break; } else if (!grpc_is_binary_header(md[i].key) && - !grpc_header_nonbin_value_is_legal(md[i].value)) { + !GRPC_LOG_IF_ERROR( + "validate_metadata_from_plugin", + grpc_validate_header_nonbin_value_is_legal(md[i].value))) { gpr_log(GPR_ERROR, "Plugin added invalid metadata value."); seen_illegal_header = true; break; diff --git a/src/core/lib/security/transport/client_auth_filter.c b/src/core/lib/security/transport/client_auth_filter.c index cf7de49345..cf056e8008 100644 --- a/src/core/lib/security/transport/client_auth_filter.c +++ b/src/core/lib/security/transport/client_auth_filter.c @@ -123,24 +123,12 @@ static void on_credentials_metadata(grpc_exec_ctx *exec_ctx, void *user_data, GPR_ASSERT(op->send_initial_metadata != NULL); mdb = op->send_initial_metadata; for (i = 0; i < num_md; i++) { - if (!grpc_header_key_is_legal(md_elems[i].key)) { - char *str = grpc_slice_to_c_string(md_elems[i].key); - gpr_log(GPR_ERROR, "attempt to send invalid metadata key: %s", str); - gpr_free(str); - } else if (!grpc_is_binary_header(md_elems[i].key) && - !grpc_header_nonbin_value_is_legal(md_elems[i].value)) { - char *str = - grpc_dump_slice(md_elems[i].value, GPR_DUMP_HEX | GPR_DUMP_ASCII); - gpr_log(GPR_ERROR, "attempt to send invalid metadata value: %s", str); - gpr_free(str); - } else { - add_error(&error, - grpc_metadata_batch_add_tail( - exec_ctx, mdb, &calld->md_links[i], - grpc_mdelem_from_slices( - exec_ctx, grpc_slice_ref_internal(md_elems[i].key), - grpc_slice_ref_internal(md_elems[i].value)))); - } + add_error(&error, + grpc_metadata_batch_add_tail( + exec_ctx, mdb, &calld->md_links[i], + grpc_mdelem_from_slices( + exec_ctx, grpc_slice_ref_internal(md_elems[i].key), + grpc_slice_ref_internal(md_elems[i].value)))); } } if (error == GRPC_ERROR_NONE) { |