finished 2nd revision

reviewable/pr15909/r3
Yihua Zhang 7 years ago
parent ff6c5b29c9
commit 587b40ddac
  1. 5
      src/core/lib/security/security_connector/local_security_connector.cc
  2. 11
      test/core/end2end/fixtures/h2_local.cc

@ -34,6 +34,7 @@
#include "src/core/lib/security/transport/security_handshaker.h" #include "src/core/lib/security/transport/security_handshaker.h"
#include "src/core/tsi/local_transport_security.h" #include "src/core/tsi/local_transport_security.h"
#define GRPC_UDS_URL_PATTERN "unix:"
#define GRPC_UDS_URL_SCHEME "unix" #define GRPC_UDS_URL_SCHEME "unix"
#define GRPC_LOCAL_TRANSPORT_SECURITY_TYPE "local" #define GRPC_LOCAL_TRANSPORT_SECURITY_TYPE "local"
@ -189,8 +190,8 @@ grpc_security_status grpc_local_channel_security_connector_create(
const grpc_arg* server_uri_arg = const grpc_arg* server_uri_arg =
grpc_channel_args_find(args, GRPC_ARG_SERVER_URI); grpc_channel_args_find(args, GRPC_ARG_SERVER_URI);
const char* server_uri_str = grpc_channel_arg_get_string(server_uri_arg); const char* server_uri_str = grpc_channel_arg_get_string(server_uri_arg);
if (strncmp(GRPC_UDS_URL_SCHEME, server_uri_str, if (strncmp(GRPC_UDS_URL_PATTERN, server_uri_str,
strlen(GRPC_UDS_URL_SCHEME)) != 0) { strlen(GRPC_UDS_URL_PATTERN)) != 0) {
gpr_log(GPR_ERROR, gpr_log(GPR_ERROR,
"Invalid target_name to " "Invalid target_name to "
"grpc_local_channel_security_connector_create()"); "grpc_local_channel_security_connector_create()");

@ -73,16 +73,21 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_credentials_release(creds); grpc_channel_credentials_release(creds);
} }
static int fail_server_auth_check(grpc_channel_args* server_args) { /*
* Check if server should fail auth check. If it is true, a different metadata
* processor will be installed that always fails in processing client's
* metadata.
*/
static bool fail_server_auth_check(grpc_channel_args* server_args) {
size_t i; size_t i;
if (server_args == nullptr) return 0; if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) { for (i = 0; i < server_args->num_args; i++) {
if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) == if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) ==
0) { 0) {
return 1; return true;
} }
} }
return 0; return false;
} }
static void process_auth_failure(void* state, grpc_auth_context* ctx, static void process_auth_failure(void* state, grpc_auth_context* ctx,

Loading…
Cancel
Save