grpc 1.17.1 → 1.18.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +1228 -988
- data/etc/roots.pem +242 -30
- data/include/grpc/grpc.h +2 -1
- data/include/grpc/grpc_security_constants.h +3 -3
- data/include/grpc/impl/codegen/atm_gcc_sync.h +2 -0
- data/include/grpc/impl/codegen/atm_windows.h +2 -0
- data/include/grpc/impl/codegen/compression_types.h +2 -1
- data/include/grpc/impl/codegen/grpc_types.h +1 -1
- data/include/grpc/impl/codegen/port_platform.h +9 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +163 -882
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +2 -4
- data/src/core/ext/filters/client_channel/health/health_check_client.h +2 -3
- data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -17
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +176 -216
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +20 -23
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +49 -52
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +13 -35
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +31 -30
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +69 -225
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +20 -23
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +2 -84
- data/src/core/ext/filters/client_channel/request_routing.cc +936 -0
- data/src/core/ext/filters/client_channel/request_routing.h +177 -0
- data/src/core/ext/filters/client_channel/resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver.h +1 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +37 -26
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +30 -18
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +119 -100
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +8 -5
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +5 -4
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_posix.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +12 -14
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +5 -9
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -1
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -2
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +17 -17
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +45 -52
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +13 -17
- data/src/core/ext/filters/client_channel/server_address.cc +103 -0
- data/src/core/ext/filters/client_channel/server_address.h +108 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +10 -8
- data/src/core/ext/filters/client_channel/subchannel.h +9 -6
- data/src/core/ext/filters/client_channel/subchannel_index.cc +20 -27
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +3 -2
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +8 -9
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +8 -11
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +24 -54
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -1
- data/src/core/ext/transport/chttp2/transport/context_list.cc +67 -0
- data/src/core/ext/transport/chttp2/transport/context_list.h +53 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +38 -11
- data/src/core/ext/transport/chttp2/transport/writing.cc +5 -0
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -1
- data/src/core/lib/channel/channelz.cc +19 -18
- data/src/core/lib/channel/channelz.h +7 -1
- data/src/core/lib/channel/channelz_registry.cc +3 -2
- data/src/core/lib/debug/trace.cc +3 -0
- data/src/core/lib/debug/trace.h +5 -3
- data/src/core/lib/gpr/sync_posix.cc +96 -4
- data/src/core/lib/gprpp/inlined_vector.h +25 -19
- data/src/core/lib/gprpp/memory.h +2 -11
- data/src/core/lib/gprpp/orphanable.h +18 -82
- data/src/core/lib/gprpp/ref_counted.h +75 -84
- data/src/core/lib/gprpp/ref_counted_ptr.h +22 -17
- data/src/core/lib/http/httpcli_security_connector.cc +101 -94
- data/src/core/lib/http/parser.h +5 -5
- data/src/core/lib/iomgr/buffer_list.cc +16 -5
- data/src/core/lib/iomgr/buffer_list.h +10 -3
- data/src/core/lib/iomgr/call_combiner.cc +50 -2
- data/src/core/lib/iomgr/call_combiner.h +29 -2
- data/src/core/lib/iomgr/dynamic_annotations.h +67 -0
- data/src/core/lib/iomgr/endpoint.cc +4 -0
- data/src/core/lib/iomgr/endpoint.h +3 -0
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +4 -0
- data/src/core/lib/iomgr/ev_epollex_linux.cc +4 -0
- data/src/core/lib/iomgr/ev_poll_posix.cc +4 -0
- data/src/core/lib/iomgr/ev_posix.cc +15 -7
- data/src/core/lib/iomgr/ev_posix.h +10 -0
- data/src/core/lib/iomgr/exec_ctx.cc +13 -0
- data/src/core/lib/iomgr/fork_posix.cc +1 -1
- data/src/core/lib/iomgr/internal_errqueue.cc +36 -3
- data/src/core/lib/iomgr/internal_errqueue.h +7 -1
- data/src/core/lib/iomgr/iomgr.cc +7 -0
- data/src/core/lib/iomgr/iomgr.h +4 -0
- data/src/core/lib/iomgr/iomgr_custom.cc +3 -1
- data/src/core/lib/iomgr/iomgr_internal.cc +4 -0
- data/src/core/lib/iomgr/iomgr_internal.h +4 -0
- data/src/core/lib/iomgr/iomgr_posix.cc +6 -1
- data/src/core/lib/iomgr/iomgr_windows.cc +4 -1
- data/src/core/lib/iomgr/port.h +1 -2
- data/src/core/lib/iomgr/resource_quota.cc +1 -0
- data/src/core/lib/iomgr/sockaddr_utils.cc +1 -0
- data/src/core/lib/iomgr/tcp_custom.cc +4 -1
- data/src/core/lib/iomgr/tcp_posix.cc +95 -35
- data/src/core/lib/iomgr/tcp_windows.cc +4 -1
- data/src/core/lib/iomgr/timer_manager.cc +6 -0
- data/src/core/lib/security/context/security_context.cc +75 -108
- data/src/core/lib/security/context/security_context.h +59 -35
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +36 -48
- data/src/core/lib/security/credentials/alts/alts_credentials.h +37 -10
- data/src/core/lib/security/credentials/composite/composite_credentials.cc +97 -157
- data/src/core/lib/security/credentials/composite/composite_credentials.h +60 -24
- data/src/core/lib/security/credentials/credentials.cc +18 -142
- data/src/core/lib/security/credentials/credentials.h +119 -95
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +46 -71
- data/src/core/lib/security/credentials/fake/fake_credentials.h +23 -5
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +144 -51
- data/src/core/lib/security/credentials/google_default/google_default_credentials.h +28 -5
- data/src/core/lib/security/credentials/iam/iam_credentials.cc +27 -35
- data/src/core/lib/security/credentials/iam/iam_credentials.h +18 -4
- data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +60 -69
- data/src/core/lib/security/credentials/jwt/jwt_credentials.h +29 -10
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +2 -0
- data/src/core/lib/security/credentials/local/local_credentials.cc +19 -32
- data/src/core/lib/security/credentials/local/local_credentials.h +32 -11
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +130 -149
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +74 -29
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +59 -77
- data/src/core/lib/security/credentials/plugin/plugin_credentials.h +40 -17
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +66 -83
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +58 -15
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +152 -177
- data/src/core/lib/security/security_connector/alts/alts_security_connector.h +12 -10
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +210 -215
- data/src/core/lib/security/security_connector/fake/fake_security_connector.h +9 -6
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +176 -169
- data/src/core/lib/security/security_connector/local/local_security_connector.h +10 -9
- data/src/core/lib/security/security_connector/security_connector.cc +41 -124
- data/src/core/lib/security/security_connector/security_connector.h +102 -105
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +348 -370
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.h +14 -12
- data/src/core/lib/security/security_connector/ssl_utils.cc +13 -9
- data/src/core/lib/security/security_connector/ssl_utils.h +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +50 -50
- data/src/core/lib/security/transport/secure_endpoint.cc +7 -1
- data/src/core/lib/security/transport/security_handshaker.cc +82 -66
- data/src/core/lib/security/transport/server_auth_filter.cc +15 -13
- data/src/core/lib/surface/init.cc +1 -0
- data/src/core/lib/surface/server.cc +13 -11
- data/src/core/lib/surface/server.h +6 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata.cc +1 -0
- data/src/core/lib/transport/static_metadata.cc +228 -221
- data/src/core/lib/transport/static_metadata.h +75 -71
- data/src/core/lib/transport/transport.cc +2 -1
- data/src/core/lib/transport/transport.h +5 -1
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +9 -2
- data/src/core/tsi/ssl_transport_security.cc +35 -24
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +1 -1
- data/src/ruby/lib/grpc/generic/rpc_server.rb +61 -0
- data/src/ruby/lib/grpc/generic/service.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/grpc/health/checker.rb +2 -3
- data/src/ruby/spec/generic/rpc_server_spec.rb +22 -0
- data/src/ruby/spec/support/services.rb +1 -0
- metadata +37 -32
- data/src/core/ext/filters/client_channel/lb_policy_factory.cc +0 -163
@@ -25,6 +25,7 @@
|
|
25
25
|
|
26
26
|
#include "src/core/lib/security/security_connector/security_connector.h"
|
27
27
|
|
28
|
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
28
29
|
#include "src/core/tsi/ssl_transport_security.h"
|
29
30
|
#include "src/core/tsi/transport_security_interface.h"
|
30
31
|
|
@@ -47,20 +48,21 @@ typedef struct {
|
|
47
48
|
This function returns GRPC_SECURITY_OK in case of success or a
|
48
49
|
specific error code otherwise.
|
49
50
|
*/
|
50
|
-
|
51
|
-
|
52
|
-
|
51
|
+
grpc_core::RefCountedPtr<grpc_channel_security_connector>
|
52
|
+
grpc_ssl_channel_security_connector_create(
|
53
|
+
grpc_core::RefCountedPtr<grpc_channel_credentials> channel_creds,
|
54
|
+
grpc_core::RefCountedPtr<grpc_call_credentials> request_metadata_creds,
|
53
55
|
const grpc_ssl_config* config, const char* target_name,
|
54
56
|
const char* overridden_target_name,
|
55
|
-
tsi_ssl_session_cache* ssl_session_cache
|
56
|
-
grpc_channel_security_connector** sc);
|
57
|
+
tsi_ssl_session_cache* ssl_session_cache);
|
57
58
|
|
58
59
|
/* Config for ssl servers. */
|
59
60
|
typedef struct {
|
60
|
-
tsi_ssl_pem_key_cert_pair* pem_key_cert_pairs;
|
61
|
-
size_t num_key_cert_pairs;
|
62
|
-
char* pem_root_certs;
|
63
|
-
grpc_ssl_client_certificate_request_type client_certificate_request
|
61
|
+
tsi_ssl_pem_key_cert_pair* pem_key_cert_pairs = nullptr;
|
62
|
+
size_t num_key_cert_pairs = 0;
|
63
|
+
char* pem_root_certs = nullptr;
|
64
|
+
grpc_ssl_client_certificate_request_type client_certificate_request =
|
65
|
+
GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE;
|
64
66
|
} grpc_ssl_server_config;
|
65
67
|
|
66
68
|
/* Creates an SSL server_security_connector.
|
@@ -69,9 +71,9 @@ typedef struct {
|
|
69
71
|
This function returns GRPC_SECURITY_OK in case of success or a
|
70
72
|
specific error code otherwise.
|
71
73
|
*/
|
72
|
-
|
73
|
-
|
74
|
-
|
74
|
+
grpc_core::RefCountedPtr<grpc_server_security_connector>
|
75
|
+
grpc_ssl_server_security_connector_create(
|
76
|
+
grpc_core::RefCountedPtr<grpc_server_credentials> server_credentials);
|
75
77
|
|
76
78
|
#endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_SSL_SSL_SECURITY_CONNECTOR_H \
|
77
79
|
*/
|
@@ -30,6 +30,7 @@
|
|
30
30
|
#include "src/core/lib/gpr/env.h"
|
31
31
|
#include "src/core/lib/gpr/host_port.h"
|
32
32
|
#include "src/core/lib/gpr/string.h"
|
33
|
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
33
34
|
#include "src/core/lib/iomgr/load_file.h"
|
34
35
|
#include "src/core/lib/security/context/security_context.h"
|
35
36
|
#include "src/core/lib/security/security_connector/load_system_roots.h"
|
@@ -141,16 +142,17 @@ int grpc_ssl_host_matches_name(const tsi_peer* peer, const char* peer_name) {
|
|
141
142
|
return r;
|
142
143
|
}
|
143
144
|
|
144
|
-
grpc_auth_context
|
145
|
+
grpc_core::RefCountedPtr<grpc_auth_context> grpc_ssl_peer_to_auth_context(
|
146
|
+
const tsi_peer* peer) {
|
145
147
|
size_t i;
|
146
|
-
grpc_auth_context* ctx = nullptr;
|
147
148
|
const char* peer_identity_property_name = nullptr;
|
148
149
|
|
149
150
|
/* The caller has checked the certificate type property. */
|
150
151
|
GPR_ASSERT(peer->property_count >= 1);
|
151
|
-
ctx =
|
152
|
+
grpc_core::RefCountedPtr<grpc_auth_context> ctx =
|
153
|
+
grpc_core::MakeRefCounted<grpc_auth_context>(nullptr);
|
152
154
|
grpc_auth_context_add_cstring_property(
|
153
|
-
ctx, GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME,
|
155
|
+
ctx.get(), GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME,
|
154
156
|
GRPC_SSL_TRANSPORT_SECURITY_TYPE);
|
155
157
|
for (i = 0; i < peer->property_count; i++) {
|
156
158
|
const tsi_peer_property* prop = &peer->properties[i];
|
@@ -160,24 +162,26 @@ grpc_auth_context* grpc_ssl_peer_to_auth_context(const tsi_peer* peer) {
|
|
160
162
|
if (peer_identity_property_name == nullptr) {
|
161
163
|
peer_identity_property_name = GRPC_X509_CN_PROPERTY_NAME;
|
162
164
|
}
|
163
|
-
grpc_auth_context_add_property(ctx, GRPC_X509_CN_PROPERTY_NAME,
|
165
|
+
grpc_auth_context_add_property(ctx.get(), GRPC_X509_CN_PROPERTY_NAME,
|
164
166
|
prop->value.data, prop->value.length);
|
165
167
|
} else if (strcmp(prop->name,
|
166
168
|
TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY) == 0) {
|
167
169
|
peer_identity_property_name = GRPC_X509_SAN_PROPERTY_NAME;
|
168
|
-
grpc_auth_context_add_property(ctx, GRPC_X509_SAN_PROPERTY_NAME,
|
170
|
+
grpc_auth_context_add_property(ctx.get(), GRPC_X509_SAN_PROPERTY_NAME,
|
169
171
|
prop->value.data, prop->value.length);
|
170
172
|
} else if (strcmp(prop->name, TSI_X509_PEM_CERT_PROPERTY) == 0) {
|
171
|
-
grpc_auth_context_add_property(ctx,
|
173
|
+
grpc_auth_context_add_property(ctx.get(),
|
174
|
+
GRPC_X509_PEM_CERT_PROPERTY_NAME,
|
172
175
|
prop->value.data, prop->value.length);
|
173
176
|
} else if (strcmp(prop->name, TSI_SSL_SESSION_REUSED_PEER_PROPERTY) == 0) {
|
174
|
-
grpc_auth_context_add_property(ctx,
|
177
|
+
grpc_auth_context_add_property(ctx.get(),
|
178
|
+
GRPC_SSL_SESSION_REUSED_PROPERTY,
|
175
179
|
prop->value.data, prop->value.length);
|
176
180
|
}
|
177
181
|
}
|
178
182
|
if (peer_identity_property_name != nullptr) {
|
179
183
|
GPR_ASSERT(grpc_auth_context_set_peer_identity_property_name(
|
180
|
-
ctx, peer_identity_property_name) == 1);
|
184
|
+
ctx.get(), peer_identity_property_name) == 1);
|
181
185
|
}
|
182
186
|
return ctx;
|
183
187
|
}
|
@@ -26,6 +26,7 @@
|
|
26
26
|
#include <grpc/grpc_security.h>
|
27
27
|
#include <grpc/slice_buffer.h>
|
28
28
|
|
29
|
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
29
30
|
#include "src/core/tsi/ssl_transport_security.h"
|
30
31
|
#include "src/core/tsi/transport_security_interface.h"
|
31
32
|
|
@@ -47,7 +48,8 @@ grpc_get_tsi_client_certificate_request_type(
|
|
47
48
|
const char** grpc_fill_alpn_protocol_strings(size_t* num_alpn_protocols);
|
48
49
|
|
49
50
|
/* Exposed for testing only. */
|
50
|
-
grpc_auth_context
|
51
|
+
grpc_core::RefCountedPtr<grpc_auth_context> grpc_ssl_peer_to_auth_context(
|
52
|
+
const tsi_peer* peer);
|
51
53
|
tsi_peer grpc_shallow_peer_from_ssl_auth_context(
|
52
54
|
const grpc_auth_context* auth_context);
|
53
55
|
void grpc_shallow_peer_destruct(tsi_peer* peer);
|
@@ -55,7 +55,7 @@ struct call_data {
|
|
55
55
|
// that the memory is not initialized.
|
56
56
|
void destroy() {
|
57
57
|
grpc_credentials_mdelem_array_destroy(&md_array);
|
58
|
-
|
58
|
+
creds.reset();
|
59
59
|
grpc_slice_unref_internal(host);
|
60
60
|
grpc_slice_unref_internal(method);
|
61
61
|
grpc_auth_metadata_context_reset(&auth_md_context);
|
@@ -64,7 +64,7 @@ struct call_data {
|
|
64
64
|
gpr_arena* arena;
|
65
65
|
grpc_call_stack* owning_call;
|
66
66
|
grpc_call_combiner* call_combiner;
|
67
|
-
grpc_call_credentials
|
67
|
+
grpc_core::RefCountedPtr<grpc_call_credentials> creds;
|
68
68
|
grpc_slice host = grpc_empty_slice();
|
69
69
|
grpc_slice method = grpc_empty_slice();
|
70
70
|
/* pollset{_set} bound to this call; if we need to make external
|
@@ -83,8 +83,18 @@ struct call_data {
|
|
83
83
|
|
84
84
|
/* We can have a per-channel credentials. */
|
85
85
|
struct channel_data {
|
86
|
-
grpc_channel_security_connector* security_connector
|
87
|
-
|
86
|
+
channel_data(grpc_channel_security_connector* security_connector,
|
87
|
+
grpc_auth_context* auth_context)
|
88
|
+
: security_connector(
|
89
|
+
security_connector->Ref(DEBUG_LOCATION, "client_auth_filter")),
|
90
|
+
auth_context(auth_context->Ref(DEBUG_LOCATION, "client_auth_filter")) {}
|
91
|
+
~channel_data() {
|
92
|
+
security_connector.reset(DEBUG_LOCATION, "client_auth_filter");
|
93
|
+
auth_context.reset(DEBUG_LOCATION, "client_auth_filter");
|
94
|
+
}
|
95
|
+
|
96
|
+
grpc_core::RefCountedPtr<grpc_channel_security_connector> security_connector;
|
97
|
+
grpc_core::RefCountedPtr<grpc_auth_context> auth_context;
|
88
98
|
};
|
89
99
|
} // namespace
|
90
100
|
|
@@ -98,10 +108,11 @@ void grpc_auth_metadata_context_reset(
|
|
98
108
|
gpr_free(const_cast<char*>(auth_md_context->method_name));
|
99
109
|
auth_md_context->method_name = nullptr;
|
100
110
|
}
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
111
|
+
if (auth_md_context->channel_auth_context != nullptr) {
|
112
|
+
const_cast<grpc_auth_context*>(auth_md_context->channel_auth_context)
|
113
|
+
->Unref(DEBUG_LOCATION, "grpc_auth_metadata_context");
|
114
|
+
auth_md_context->channel_auth_context = nullptr;
|
115
|
+
}
|
105
116
|
}
|
106
117
|
|
107
118
|
static void add_error(grpc_error** combined, grpc_error* error) {
|
@@ -175,7 +186,10 @@ void grpc_auth_metadata_context_build(
|
|
175
186
|
auth_md_context->service_url = service_url;
|
176
187
|
auth_md_context->method_name = method_name;
|
177
188
|
auth_md_context->channel_auth_context =
|
178
|
-
|
189
|
+
auth_context == nullptr
|
190
|
+
? nullptr
|
191
|
+
: auth_context->Ref(DEBUG_LOCATION, "grpc_auth_metadata_context")
|
192
|
+
.release();
|
179
193
|
gpr_free(service);
|
180
194
|
gpr_free(host_and_port);
|
181
195
|
}
|
@@ -184,8 +198,8 @@ static void cancel_get_request_metadata(void* arg, grpc_error* error) {
|
|
184
198
|
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
|
185
199
|
call_data* calld = static_cast<call_data*>(elem->call_data);
|
186
200
|
if (error != GRPC_ERROR_NONE) {
|
187
|
-
|
188
|
-
|
201
|
+
calld->creds->cancel_get_request_metadata(&calld->md_array,
|
202
|
+
GRPC_ERROR_REF(error));
|
189
203
|
}
|
190
204
|
}
|
191
205
|
|
@@ -197,7 +211,7 @@ static void send_security_metadata(grpc_call_element* elem,
|
|
197
211
|
static_cast<grpc_client_security_context*>(
|
198
212
|
batch->payload->context[GRPC_CONTEXT_SECURITY].value);
|
199
213
|
grpc_call_credentials* channel_call_creds =
|
200
|
-
chand->security_connector->
|
214
|
+
chand->security_connector->mutable_request_metadata_creds();
|
201
215
|
int call_creds_has_md = (ctx != nullptr) && (ctx->creds != nullptr);
|
202
216
|
|
203
217
|
if (channel_call_creds == nullptr && !call_creds_has_md) {
|
@@ -207,8 +221,9 @@ static void send_security_metadata(grpc_call_element* elem,
|
|
207
221
|
}
|
208
222
|
|
209
223
|
if (channel_call_creds != nullptr && call_creds_has_md) {
|
210
|
-
calld->creds =
|
211
|
-
|
224
|
+
calld->creds = grpc_core::RefCountedPtr<grpc_call_credentials>(
|
225
|
+
grpc_composite_call_credentials_create(channel_call_creds,
|
226
|
+
ctx->creds.get(), nullptr));
|
212
227
|
if (calld->creds == nullptr) {
|
213
228
|
grpc_transport_stream_op_batch_finish_with_failure(
|
214
229
|
batch,
|
@@ -220,22 +235,22 @@ static void send_security_metadata(grpc_call_element* elem,
|
|
220
235
|
return;
|
221
236
|
}
|
222
237
|
} else {
|
223
|
-
calld->creds =
|
224
|
-
call_creds_has_md ? ctx->creds : channel_call_creds);
|
238
|
+
calld->creds =
|
239
|
+
call_creds_has_md ? ctx->creds->Ref() : channel_call_creds->Ref();
|
225
240
|
}
|
226
241
|
|
227
242
|
grpc_auth_metadata_context_build(
|
228
|
-
chand->security_connector->
|
229
|
-
chand->auth_context, &calld->auth_md_context);
|
243
|
+
chand->security_connector->url_scheme(), calld->host, calld->method,
|
244
|
+
chand->auth_context.get(), &calld->auth_md_context);
|
230
245
|
|
231
246
|
GPR_ASSERT(calld->pollent != nullptr);
|
232
247
|
GRPC_CALL_STACK_REF(calld->owning_call, "get_request_metadata");
|
233
248
|
GRPC_CLOSURE_INIT(&calld->async_result_closure, on_credentials_metadata,
|
234
249
|
batch, grpc_schedule_on_exec_ctx);
|
235
250
|
grpc_error* error = GRPC_ERROR_NONE;
|
236
|
-
if (
|
237
|
-
calld->
|
238
|
-
&calld->
|
251
|
+
if (calld->creds->get_request_metadata(
|
252
|
+
calld->pollent, calld->auth_md_context, &calld->md_array,
|
253
|
+
&calld->async_result_closure, &error)) {
|
239
254
|
// Synchronous return; invoke on_credentials_metadata() directly.
|
240
255
|
on_credentials_metadata(batch, error);
|
241
256
|
GRPC_ERROR_UNREF(error);
|
@@ -279,9 +294,8 @@ static void cancel_check_call_host(void* arg, grpc_error* error) {
|
|
279
294
|
call_data* calld = static_cast<call_data*>(elem->call_data);
|
280
295
|
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
281
296
|
if (error != GRPC_ERROR_NONE) {
|
282
|
-
|
283
|
-
|
284
|
-
GRPC_ERROR_REF(error));
|
297
|
+
chand->security_connector->cancel_check_call_host(
|
298
|
+
&calld->async_result_closure, GRPC_ERROR_REF(error));
|
285
299
|
}
|
286
300
|
}
|
287
301
|
|
@@ -299,16 +313,16 @@ static void auth_start_transport_stream_op_batch(
|
|
299
313
|
GPR_ASSERT(batch->payload->context != nullptr);
|
300
314
|
if (batch->payload->context[GRPC_CONTEXT_SECURITY].value == nullptr) {
|
301
315
|
batch->payload->context[GRPC_CONTEXT_SECURITY].value =
|
302
|
-
grpc_client_security_context_create(calld->arena);
|
316
|
+
grpc_client_security_context_create(calld->arena, /*creds=*/nullptr);
|
303
317
|
batch->payload->context[GRPC_CONTEXT_SECURITY].destroy =
|
304
318
|
grpc_client_security_context_destroy;
|
305
319
|
}
|
306
320
|
grpc_client_security_context* sec_ctx =
|
307
321
|
static_cast<grpc_client_security_context*>(
|
308
322
|
batch->payload->context[GRPC_CONTEXT_SECURITY].value);
|
309
|
-
|
323
|
+
sec_ctx->auth_context.reset(DEBUG_LOCATION, "client_auth_filter");
|
310
324
|
sec_ctx->auth_context =
|
311
|
-
|
325
|
+
chand->auth_context->Ref(DEBUG_LOCATION, "client_auth_filter");
|
312
326
|
}
|
313
327
|
|
314
328
|
if (batch->send_initial_metadata) {
|
@@ -327,8 +341,8 @@ static void auth_start_transport_stream_op_batch(
|
|
327
341
|
grpc_schedule_on_exec_ctx);
|
328
342
|
char* call_host = grpc_slice_to_c_string(calld->host);
|
329
343
|
grpc_error* error = GRPC_ERROR_NONE;
|
330
|
-
if (
|
331
|
-
|
344
|
+
if (chand->security_connector->check_call_host(
|
345
|
+
call_host, chand->auth_context.get(),
|
332
346
|
&calld->async_result_closure, &error)) {
|
333
347
|
// Synchronous return; invoke on_host_checked() directly.
|
334
348
|
on_host_checked(batch, error);
|
@@ -374,6 +388,10 @@ static void destroy_call_elem(grpc_call_element* elem,
|
|
374
388
|
/* Constructor for channel_data */
|
375
389
|
static grpc_error* init_channel_elem(grpc_channel_element* elem,
|
376
390
|
grpc_channel_element_args* args) {
|
391
|
+
/* The first and the last filters tend to be implemented differently to
|
392
|
+
handle the case that there's no 'next' filter to call on the up or down
|
393
|
+
path */
|
394
|
+
GPR_ASSERT(!args->is_last);
|
377
395
|
grpc_security_connector* sc =
|
378
396
|
grpc_security_connector_find_in_args(args->channel_args);
|
379
397
|
if (sc == nullptr) {
|
@@ -386,33 +404,15 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
|
|
386
404
|
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
387
405
|
"Auth context missing from client auth filter args");
|
388
406
|
}
|
389
|
-
|
390
|
-
|
391
|
-
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
392
|
-
|
393
|
-
/* The first and the last filters tend to be implemented differently to
|
394
|
-
handle the case that there's no 'next' filter to call on the up or down
|
395
|
-
path */
|
396
|
-
GPR_ASSERT(!args->is_last);
|
397
|
-
|
398
|
-
/* initialize members */
|
399
|
-
chand->security_connector =
|
400
|
-
reinterpret_cast<grpc_channel_security_connector*>(
|
401
|
-
GRPC_SECURITY_CONNECTOR_REF(sc, "client_auth_filter"));
|
402
|
-
chand->auth_context =
|
403
|
-
GRPC_AUTH_CONTEXT_REF(auth_context, "client_auth_filter");
|
407
|
+
new (elem->channel_data) channel_data(
|
408
|
+
static_cast<grpc_channel_security_connector*>(sc), auth_context);
|
404
409
|
return GRPC_ERROR_NONE;
|
405
410
|
}
|
406
411
|
|
407
412
|
/* Destructor for channel data */
|
408
413
|
static void destroy_channel_elem(grpc_channel_element* elem) {
|
409
|
-
/* grab pointers to our data from the channel element */
|
410
414
|
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
|
411
|
-
|
412
|
-
if (sc != nullptr) {
|
413
|
-
GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "client_auth_filter");
|
414
|
-
}
|
415
|
-
GRPC_AUTH_CONTEXT_UNREF(chand->auth_context, "client_auth_filter");
|
415
|
+
chand->~channel_data();
|
416
416
|
}
|
417
417
|
|
418
418
|
const grpc_channel_filter grpc_client_auth_filter = {
|
@@ -416,6 +416,11 @@ static grpc_resource_user* endpoint_get_resource_user(
|
|
416
416
|
return grpc_endpoint_get_resource_user(ep->wrapped_ep);
|
417
417
|
}
|
418
418
|
|
419
|
+
static bool endpoint_can_track_err(grpc_endpoint* secure_ep) {
|
420
|
+
secure_endpoint* ep = reinterpret_cast<secure_endpoint*>(secure_ep);
|
421
|
+
return grpc_endpoint_can_track_err(ep->wrapped_ep);
|
422
|
+
}
|
423
|
+
|
419
424
|
static const grpc_endpoint_vtable vtable = {endpoint_read,
|
420
425
|
endpoint_write,
|
421
426
|
endpoint_add_to_pollset,
|
@@ -425,7 +430,8 @@ static const grpc_endpoint_vtable vtable = {endpoint_read,
|
|
425
430
|
endpoint_destroy,
|
426
431
|
endpoint_get_resource_user,
|
427
432
|
endpoint_get_peer,
|
428
|
-
endpoint_get_fd
|
433
|
+
endpoint_get_fd,
|
434
|
+
endpoint_can_track_err};
|
429
435
|
|
430
436
|
grpc_endpoint* grpc_secure_endpoint_create(
|
431
437
|
struct tsi_frame_protector* protector,
|
@@ -30,6 +30,7 @@
|
|
30
30
|
#include "src/core/lib/channel/channel_args.h"
|
31
31
|
#include "src/core/lib/channel/handshaker.h"
|
32
32
|
#include "src/core/lib/channel/handshaker_registry.h"
|
33
|
+
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
33
34
|
#include "src/core/lib/security/context/security_context.h"
|
34
35
|
#include "src/core/lib/security/transport/secure_endpoint.h"
|
35
36
|
#include "src/core/lib/security/transport/tsi_error.h"
|
@@ -38,34 +39,62 @@
|
|
38
39
|
|
39
40
|
#define GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE 256
|
40
41
|
|
41
|
-
|
42
|
+
namespace {
|
43
|
+
struct security_handshaker {
|
44
|
+
security_handshaker(tsi_handshaker* handshaker,
|
45
|
+
grpc_security_connector* connector);
|
46
|
+
~security_handshaker() {
|
47
|
+
gpr_mu_destroy(&mu);
|
48
|
+
tsi_handshaker_destroy(handshaker);
|
49
|
+
tsi_handshaker_result_destroy(handshaker_result);
|
50
|
+
if (endpoint_to_destroy != nullptr) {
|
51
|
+
grpc_endpoint_destroy(endpoint_to_destroy);
|
52
|
+
}
|
53
|
+
if (read_buffer_to_destroy != nullptr) {
|
54
|
+
grpc_slice_buffer_destroy_internal(read_buffer_to_destroy);
|
55
|
+
gpr_free(read_buffer_to_destroy);
|
56
|
+
}
|
57
|
+
gpr_free(handshake_buffer);
|
58
|
+
grpc_slice_buffer_destroy_internal(&outgoing);
|
59
|
+
auth_context.reset(DEBUG_LOCATION, "handshake");
|
60
|
+
connector.reset(DEBUG_LOCATION, "handshake");
|
61
|
+
}
|
62
|
+
|
63
|
+
void Ref() { refs.Ref(); }
|
64
|
+
void Unref() {
|
65
|
+
if (refs.Unref()) {
|
66
|
+
grpc_core::Delete(this);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
42
70
|
grpc_handshaker base;
|
43
71
|
|
44
72
|
// State set at creation time.
|
45
73
|
tsi_handshaker* handshaker;
|
46
|
-
grpc_security_connector
|
74
|
+
grpc_core::RefCountedPtr<grpc_security_connector> connector;
|
47
75
|
|
48
76
|
gpr_mu mu;
|
49
|
-
|
77
|
+
grpc_core::RefCount refs;
|
50
78
|
|
51
|
-
bool shutdown;
|
79
|
+
bool shutdown = false;
|
52
80
|
// Endpoint and read buffer to destroy after a shutdown.
|
53
|
-
grpc_endpoint* endpoint_to_destroy;
|
54
|
-
grpc_slice_buffer* read_buffer_to_destroy;
|
81
|
+
grpc_endpoint* endpoint_to_destroy = nullptr;
|
82
|
+
grpc_slice_buffer* read_buffer_to_destroy = nullptr;
|
55
83
|
|
56
84
|
// State saved while performing the handshake.
|
57
|
-
grpc_handshaker_args* args;
|
58
|
-
grpc_closure* on_handshake_done;
|
85
|
+
grpc_handshaker_args* args = nullptr;
|
86
|
+
grpc_closure* on_handshake_done = nullptr;
|
59
87
|
|
60
|
-
unsigned char* handshake_buffer;
|
61
88
|
size_t handshake_buffer_size;
|
89
|
+
unsigned char* handshake_buffer;
|
62
90
|
grpc_slice_buffer outgoing;
|
63
91
|
grpc_closure on_handshake_data_sent_to_peer;
|
64
92
|
grpc_closure on_handshake_data_received_from_peer;
|
65
93
|
grpc_closure on_peer_checked;
|
66
|
-
grpc_auth_context
|
67
|
-
tsi_handshaker_result* handshaker_result;
|
68
|
-
}
|
94
|
+
grpc_core::RefCountedPtr<grpc_auth_context> auth_context;
|
95
|
+
tsi_handshaker_result* handshaker_result = nullptr;
|
96
|
+
};
|
97
|
+
} // namespace
|
69
98
|
|
70
99
|
static size_t move_read_buffer_into_handshake_buffer(security_handshaker* h) {
|
71
100
|
size_t bytes_in_read_buffer = h->args->read_buffer->length;
|
@@ -85,26 +114,6 @@ static size_t move_read_buffer_into_handshake_buffer(security_handshaker* h) {
|
|
85
114
|
return bytes_in_read_buffer;
|
86
115
|
}
|
87
116
|
|
88
|
-
static void security_handshaker_unref(security_handshaker* h) {
|
89
|
-
if (gpr_unref(&h->refs)) {
|
90
|
-
gpr_mu_destroy(&h->mu);
|
91
|
-
tsi_handshaker_destroy(h->handshaker);
|
92
|
-
tsi_handshaker_result_destroy(h->handshaker_result);
|
93
|
-
if (h->endpoint_to_destroy != nullptr) {
|
94
|
-
grpc_endpoint_destroy(h->endpoint_to_destroy);
|
95
|
-
}
|
96
|
-
if (h->read_buffer_to_destroy != nullptr) {
|
97
|
-
grpc_slice_buffer_destroy_internal(h->read_buffer_to_destroy);
|
98
|
-
gpr_free(h->read_buffer_to_destroy);
|
99
|
-
}
|
100
|
-
gpr_free(h->handshake_buffer);
|
101
|
-
grpc_slice_buffer_destroy_internal(&h->outgoing);
|
102
|
-
GRPC_AUTH_CONTEXT_UNREF(h->auth_context, "handshake");
|
103
|
-
GRPC_SECURITY_CONNECTOR_UNREF(h->connector, "handshake");
|
104
|
-
gpr_free(h);
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
117
|
// Set args fields to NULL, saving the endpoint and read buffer for
|
109
118
|
// later destruction.
|
110
119
|
static void cleanup_args_for_failure_locked(security_handshaker* h) {
|
@@ -194,7 +203,7 @@ static void on_peer_checked_inner(security_handshaker* h, grpc_error* error) {
|
|
194
203
|
tsi_handshaker_result_destroy(h->handshaker_result);
|
195
204
|
h->handshaker_result = nullptr;
|
196
205
|
// Add auth context to channel args.
|
197
|
-
grpc_arg auth_context_arg = grpc_auth_context_to_arg(h->auth_context);
|
206
|
+
grpc_arg auth_context_arg = grpc_auth_context_to_arg(h->auth_context.get());
|
198
207
|
grpc_channel_args* tmp_args = h->args->args;
|
199
208
|
h->args->args =
|
200
209
|
grpc_channel_args_copy_and_add(tmp_args, &auth_context_arg, 1);
|
@@ -211,7 +220,7 @@ static void on_peer_checked(void* arg, grpc_error* error) {
|
|
211
220
|
gpr_mu_lock(&h->mu);
|
212
221
|
on_peer_checked_inner(h, error);
|
213
222
|
gpr_mu_unlock(&h->mu);
|
214
|
-
|
223
|
+
h->Unref();
|
215
224
|
}
|
216
225
|
|
217
226
|
static grpc_error* check_peer_locked(security_handshaker* h) {
|
@@ -222,8 +231,8 @@ static grpc_error* check_peer_locked(security_handshaker* h) {
|
|
222
231
|
return grpc_set_tsi_error_result(
|
223
232
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Peer extraction failed"), result);
|
224
233
|
}
|
225
|
-
|
226
|
-
|
234
|
+
h->connector->check_peer(peer, h->args->endpoint, &h->auth_context,
|
235
|
+
&h->on_peer_checked);
|
227
236
|
return GRPC_ERROR_NONE;
|
228
237
|
}
|
229
238
|
|
@@ -281,7 +290,7 @@ static void on_handshake_next_done_grpc_wrapper(
|
|
281
290
|
if (error != GRPC_ERROR_NONE) {
|
282
291
|
security_handshake_failed_locked(h, error);
|
283
292
|
gpr_mu_unlock(&h->mu);
|
284
|
-
|
293
|
+
h->Unref();
|
285
294
|
} else {
|
286
295
|
gpr_mu_unlock(&h->mu);
|
287
296
|
}
|
@@ -317,7 +326,7 @@ static void on_handshake_data_received_from_peer(void* arg, grpc_error* error) {
|
|
317
326
|
h, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
318
327
|
"Handshake read failed", &error, 1));
|
319
328
|
gpr_mu_unlock(&h->mu);
|
320
|
-
|
329
|
+
h->Unref();
|
321
330
|
return;
|
322
331
|
}
|
323
332
|
// Copy all slices received.
|
@@ -329,7 +338,7 @@ static void on_handshake_data_received_from_peer(void* arg, grpc_error* error) {
|
|
329
338
|
if (error != GRPC_ERROR_NONE) {
|
330
339
|
security_handshake_failed_locked(h, error);
|
331
340
|
gpr_mu_unlock(&h->mu);
|
332
|
-
|
341
|
+
h->Unref();
|
333
342
|
} else {
|
334
343
|
gpr_mu_unlock(&h->mu);
|
335
344
|
}
|
@@ -343,7 +352,7 @@ static void on_handshake_data_sent_to_peer(void* arg, grpc_error* error) {
|
|
343
352
|
h, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
|
344
353
|
"Handshake write failed", &error, 1));
|
345
354
|
gpr_mu_unlock(&h->mu);
|
346
|
-
|
355
|
+
h->Unref();
|
347
356
|
return;
|
348
357
|
}
|
349
358
|
// We may be done.
|
@@ -355,7 +364,7 @@ static void on_handshake_data_sent_to_peer(void* arg, grpc_error* error) {
|
|
355
364
|
if (error != GRPC_ERROR_NONE) {
|
356
365
|
security_handshake_failed_locked(h, error);
|
357
366
|
gpr_mu_unlock(&h->mu);
|
358
|
-
|
367
|
+
h->Unref();
|
359
368
|
return;
|
360
369
|
}
|
361
370
|
}
|
@@ -368,7 +377,7 @@ static void on_handshake_data_sent_to_peer(void* arg, grpc_error* error) {
|
|
368
377
|
|
369
378
|
static void security_handshaker_destroy(grpc_handshaker* handshaker) {
|
370
379
|
security_handshaker* h = reinterpret_cast<security_handshaker*>(handshaker);
|
371
|
-
|
380
|
+
h->Unref();
|
372
381
|
}
|
373
382
|
|
374
383
|
static void security_handshaker_shutdown(grpc_handshaker* handshaker,
|
@@ -393,14 +402,14 @@ static void security_handshaker_do_handshake(grpc_handshaker* handshaker,
|
|
393
402
|
gpr_mu_lock(&h->mu);
|
394
403
|
h->args = args;
|
395
404
|
h->on_handshake_done = on_handshake_done;
|
396
|
-
|
405
|
+
h->Ref();
|
397
406
|
size_t bytes_received_size = move_read_buffer_into_handshake_buffer(h);
|
398
407
|
grpc_error* error =
|
399
408
|
do_handshaker_next_locked(h, h->handshake_buffer, bytes_received_size);
|
400
409
|
if (error != GRPC_ERROR_NONE) {
|
401
410
|
security_handshake_failed_locked(h, error);
|
402
411
|
gpr_mu_unlock(&h->mu);
|
403
|
-
|
412
|
+
h->Unref();
|
404
413
|
return;
|
405
414
|
}
|
406
415
|
gpr_mu_unlock(&h->mu);
|
@@ -410,27 +419,32 @@ static const grpc_handshaker_vtable security_handshaker_vtable = {
|
|
410
419
|
security_handshaker_destroy, security_handshaker_shutdown,
|
411
420
|
security_handshaker_do_handshake, "security"};
|
412
421
|
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
on_handshake_data_sent_to_peer, h,
|
422
|
+
namespace {
|
423
|
+
security_handshaker::security_handshaker(tsi_handshaker* handshaker,
|
424
|
+
grpc_security_connector* connector)
|
425
|
+
: handshaker(handshaker),
|
426
|
+
connector(connector->Ref(DEBUG_LOCATION, "handshake")),
|
427
|
+
handshake_buffer_size(GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE),
|
428
|
+
handshake_buffer(
|
429
|
+
static_cast<uint8_t*>(gpr_malloc(handshake_buffer_size))) {
|
430
|
+
grpc_handshaker_init(&security_handshaker_vtable, &base);
|
431
|
+
gpr_mu_init(&mu);
|
432
|
+
grpc_slice_buffer_init(&outgoing);
|
433
|
+
GRPC_CLOSURE_INIT(&on_handshake_data_sent_to_peer,
|
434
|
+
::on_handshake_data_sent_to_peer, this,
|
427
435
|
grpc_schedule_on_exec_ctx);
|
428
|
-
GRPC_CLOSURE_INIT(&
|
429
|
-
on_handshake_data_received_from_peer,
|
436
|
+
GRPC_CLOSURE_INIT(&on_handshake_data_received_from_peer,
|
437
|
+
::on_handshake_data_received_from_peer, this,
|
430
438
|
grpc_schedule_on_exec_ctx);
|
431
|
-
GRPC_CLOSURE_INIT(&
|
439
|
+
GRPC_CLOSURE_INIT(&on_peer_checked, ::on_peer_checked, this,
|
432
440
|
grpc_schedule_on_exec_ctx);
|
433
|
-
|
441
|
+
}
|
442
|
+
} // namespace
|
443
|
+
|
444
|
+
static grpc_handshaker* security_handshaker_create(
|
445
|
+
tsi_handshaker* handshaker, grpc_security_connector* connector) {
|
446
|
+
security_handshaker* h =
|
447
|
+
grpc_core::New<security_handshaker>(handshaker, connector);
|
434
448
|
return &h->base;
|
435
449
|
}
|
436
450
|
|
@@ -477,8 +491,9 @@ static void client_handshaker_factory_add_handshakers(
|
|
477
491
|
grpc_channel_security_connector* security_connector =
|
478
492
|
reinterpret_cast<grpc_channel_security_connector*>(
|
479
493
|
grpc_security_connector_find_in_args(args));
|
480
|
-
|
481
|
-
|
494
|
+
if (security_connector) {
|
495
|
+
security_connector->add_handshakers(interested_parties, handshake_mgr);
|
496
|
+
}
|
482
497
|
}
|
483
498
|
|
484
499
|
static void server_handshaker_factory_add_handshakers(
|
@@ -488,8 +503,9 @@ static void server_handshaker_factory_add_handshakers(
|
|
488
503
|
grpc_server_security_connector* security_connector =
|
489
504
|
reinterpret_cast<grpc_server_security_connector*>(
|
490
505
|
grpc_security_connector_find_in_args(args));
|
491
|
-
|
492
|
-
|
506
|
+
if (security_connector) {
|
507
|
+
security_connector->add_handshakers(interested_parties, handshake_mgr);
|
508
|
+
}
|
493
509
|
}
|
494
510
|
|
495
511
|
static void handshaker_factory_destroy(
|