Skip to content

Commit

Permalink
Fix some bad merge conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewstevenson88 committed Jan 30, 2024
1 parent a300601 commit 9386123
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 156 deletions.
2 changes: 0 additions & 2 deletions grpc.def

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions include/grpc/grpc_security.h
Original file line number Diff line number Diff line change
Expand Up @@ -831,22 +831,6 @@ GRPCAPI void grpc_tls_credentials_options_set_min_tls_version(
GRPCAPI void grpc_tls_credentials_options_set_max_tls_version(
grpc_tls_credentials_options* options, grpc_tls_version max_tls_version);

/**
* EXPERIMENTAL API - Subject to change
*
* Copies a grpc_tls_credentials_options.
*/
GRPCAPI grpc_tls_credentials_options* grpc_tls_credentials_options_copy(
grpc_tls_credentials_options* options);

/**
* EXPERIMENTAL API - Subject to change
*
* Destroys a grpc_tls_credentials_options.
*/
GRPCAPI void grpc_tls_credentials_options_destroy(
grpc_tls_credentials_options* options);

/**
* EXPERIMENTAL API - Subject to change
*
Expand Down
2 changes: 0 additions & 2 deletions include/grpcpp/security/tls_credentials_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ class TlsCredentialsOptions {
// version > 1.1.
void set_crl_directory(const std::string& path);

void set_crl_provider(std::shared_ptr<CrlProvider> crl_provider);

// Sets the minimum TLS version that will be negotiated during the TLS
// handshake. If not set, the underlying SSL library will use TLS v1.2.
// @param tls_version: The minimum TLS version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,6 @@ void grpc_tls_credentials_options_set_tls_session_key_log_file_path(
options->set_tls_session_key_log_file_path(path != nullptr ? path : "");
}

void grpc_tls_credentials_options_set_send_client_ca_list(
grpc_tls_credentials_options* options, bool send_client_ca_list) {
if (options == nullptr) {
return;
}
options->set_send_client_ca_list(send_client_ca_list);
}

void grpc_tls_credentials_options_set_crl_provider(
grpc_tls_credentials_options* options,
std::shared_ptr<grpc_core::experimental::CrlProvider> provider) {
GPR_ASSERT(options != nullptr);
options->set_crl_provider(provider);
}

void grpc_tls_credentials_options_set_min_tls_version(
grpc_tls_credentials_options* options, grpc_tls_version min_tls_version) {
GPR_ASSERT(options != nullptr);
Expand Down
8 changes: 0 additions & 8 deletions src/core/lib/security/credentials/tls/tls_credentials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ bool CredentialOptionSanityCheck(grpc_tls_credentials_options* options,
grpc_tls_credentials_options_destroy(options);
return false;
}
if (!options->crl_directory().empty() && options->crl_provider() != nullptr) {
gpr_log(GPR_ERROR,
"Setting crl_directory and crl_provider not supported. Using the "
"crl_provider.");
// TODO(gtcooke94) - Maybe return false here. Right now object lifetime of
// this options struct is leaky if false is returned and represents a more
// complex fix to handle in another PR.
}
// In the following conditions, there won't be any issues, but it might
// indicate callers are doing something wrong with the API.
if (is_client && options->cert_request_type() !=
Expand Down
5 changes: 0 additions & 5 deletions src/cpp/common/tls_credentials_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ void TlsCredentialsOptions::set_max_tls_version(grpc_tls_version tls_version) {
grpc_tls_credentials_options_set_max_tls_version(options, tls_version);
}

grpc_tls_credentials_options* TlsCredentialsOptions::c_credentials_options()
const {
return grpc_tls_credentials_options_copy(c_credentials_options_);
}

void TlsCredentialsOptions::set_check_call_host(bool check_call_host) {
grpc_tls_credentials_options* options = c_credentials_options();
GPR_ASSERT(options != nullptr);
Expand Down
4 changes: 0 additions & 4 deletions src/ruby/ext/grpc/rb_grpc_imports.generated.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions src/ruby/ext/grpc/rb_grpc_imports.generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/core/surface/public_headers_must_be_c89.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

98 changes: 0 additions & 98 deletions test/cpp/client/credentials_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,104 +396,6 @@ TEST(CredentialsTest, TlsChannelCredentialsWithCrlDirectory) {
GPR_ASSERT(channel_credentials.get() != nullptr);
}

TEST(CredentialsTest, TlsChannelCredentialsWithCrlProvider) {
auto provider = experimental::CreateStaticCrlProvider({});
ASSERT_TRUE(provider.ok());
grpc::experimental::TlsChannelCredentialsOptions options;
options.set_crl_provider(*provider);
auto channel_credentials = grpc::experimental::TlsCredentials(options);
GPR_ASSERT(channel_credentials.get() != nullptr);
}

TEST(CredentialsTest, TlsChannelCredentialsWithCrlProviderAndDirectory) {
auto provider = experimental::CreateStaticCrlProvider({});
ASSERT_TRUE(provider.ok());
grpc::experimental::TlsChannelCredentialsOptions options;
options.set_crl_directory(CRL_DIR_PATH);
options.set_crl_provider(*provider);
auto channel_credentials = grpc::experimental::TlsCredentials(options);
// TODO(gtcooke94) - behavior might change to make this return nullptr in the
// future
GPR_ASSERT(channel_credentials.get() != nullptr);
}

TEST(CredentialsTest, TlsCredentialsOptionsDoesNotLeak) {
TlsCredentialsOptions options;
(void)options;
}

TEST(CredentialsTest, MultipleOptionsOneCertificateProviderDoesNotLeak) {
auto provider = std::make_shared<StaticDataCertificateProvider>("root-pem");
TlsCredentialsOptions options_1;
options_1.set_certificate_provider(provider);
TlsCredentialsOptions options_2;
options_2.set_certificate_provider(provider);
}

TEST(CredentialsTest, MultipleOptionsOneCertificateVerifierDoesNotLeak) {
auto verifier = std::make_shared<NoOpCertificateVerifier>();
TlsCredentialsOptions options_1;
options_1.set_certificate_verifier(verifier);
TlsCredentialsOptions options_2;
options_2.set_certificate_verifier(verifier);
}

TEST(CredentialsTest, MultipleOptionsOneCrlProviderDoesNotLeak) {
auto crl_provider = CreateStaticCrlProvider(/*crls=*/{});
EXPECT_TRUE(crl_provider.ok());
TlsCredentialsOptions options_1;
options_1.set_crl_provider(*crl_provider);
TlsCredentialsOptions options_2;
options_2.set_crl_provider(*crl_provider);
}

TEST(CredentialsTest, TlsChannelCredentialsDoesNotLeak) {
TlsChannelCredentialsOptions options;
auto channel_creds = TlsCredentials(options);
EXPECT_NE(channel_creds, nullptr);
}

TEST(CredentialsTest, MultipleChannelCredentialsSameOptionsDoesNotLeak) {
TlsChannelCredentialsOptions options;
auto channel_creds_1 = TlsCredentials(options);
EXPECT_NE(channel_creds_1, nullptr);
auto channel_creds_2 = TlsCredentials(options);
EXPECT_NE(channel_creds_2, nullptr);
}

TEST(CredentialsTest,
MultipleChannelCredentialsOneCertificateProviderDoesNotLeak) {
TlsChannelCredentialsOptions options;
auto provider = std::make_shared<StaticDataCertificateProvider>("root-pem");
options.set_certificate_provider(provider);
auto channel_creds_1 = TlsCredentials(options);
EXPECT_NE(channel_creds_1, nullptr);
auto channel_creds_2 = TlsCredentials(options);
EXPECT_NE(channel_creds_2, nullptr);
}

TEST(CredentialsTest,
MultipleChannelCredentialsOneCertificateVerifierDoesNotLeak) {
TlsChannelCredentialsOptions options;
auto verifier = std::make_shared<NoOpCertificateVerifier>();
options.set_certificate_verifier(verifier);
auto channel_creds_1 = TlsCredentials(options);
EXPECT_NE(channel_creds_1, nullptr);
auto channel_creds_2 = TlsCredentials(options);
EXPECT_NE(channel_creds_2, nullptr);
}

TEST(CredentialsTest, MultipleChannelCredentialsOneCrlProviderDoesNotLeak) {
TlsChannelCredentialsOptions options;
auto provider = CreateStaticCrlProvider(/*crls=*/{});
EXPECT_TRUE(provider.ok());
options.set_crl_provider(*provider);
auto channel_creds_1 = TlsCredentials(options);
EXPECT_NE(channel_creds_1, nullptr);
auto channel_creds_2 = TlsCredentials(options);
EXPECT_NE(channel_creds_2, nullptr);
}

TEST(CredentialsTest, TlsChannelCredentialsWithGoodMinAndMaxTlsVersions) {
grpc::experimental::TlsChannelCredentialsOptions options;
options.set_min_tls_version(grpc_tls_version::TLS1_2);
Expand Down

0 comments on commit 9386123

Please sign in to comment.