Skip to content

Commit 25a283d

Browse files
committed
CDRIVER-3408 do not default ocsp opts
1 parent 9a8cd82 commit 25a283d

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

src/libmongoc/src/mongoc/mongoc-ssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ _mongoc_ssl_opts_from_uri (mongoc_ssl_opt_t *ssl_opt,
114114
ssl_opt->internal = internal;
115115
internal->tls_disable_certificate_revocation_check =
116116
mongoc_uri_get_option_as_bool (
117-
uri, MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK, insecure);
117+
uri, MONGOC_URI_TLSDISABLECERTIFICATEREVOCATIONCHECK, false);
118118
internal->tls_disable_ocsp_endpoint_check = mongoc_uri_get_option_as_bool (
119-
uri, MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK, insecure);
119+
uri, MONGOC_URI_TLSDISABLEOCSPENDPOINTCHECK, false);
120120
}
121121

122122
void

src/libmongoc/tests/test-mongoc-stream-tls.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "ssl-test.h"
99
#include "TestSuite.h"
1010
#include "test-libmongoc.h"
11+
#include "test-conveniences.h"
1112

1213
#if !defined(MONGOC_ENABLE_SSL_SECURE_CHANNEL) && \
1314
!defined(MONGOC_ENABLE_SSL_LIBRESSL)
@@ -387,6 +388,31 @@ test_mongoc_tls_trust_dir (void)
387388

388389
#endif /* !MONGOC_ENABLE_SSL_SECURE_CHANNEL && !MONGOC_ENABLE_SSL_LIBRESSL */
389390

391+
void
392+
test_mongoc_tls_insecure_nowarning (void)
393+
{
394+
mongoc_uri_t *uri;
395+
mongoc_client_t *client;
396+
397+
if (!test_framework_get_ssl ()) {
398+
return;
399+
}
400+
uri = test_framework_get_uri ();
401+
mongoc_uri_set_option_as_bool (uri, MONGOC_URI_TLSINSECURE, true);
402+
client = mongoc_client_new_from_uri (uri);
403+
404+
capture_logs (true);
405+
mongoc_client_command_simple (client,
406+
"admin",
407+
tmp_bson ("{'ping': 1}"),
408+
NULL /* read prefs */,
409+
NULL /* reply */,
410+
NULL /* error */);
411+
ASSERT_NO_CAPTURED_LOGS ("has no effect");
412+
mongoc_client_destroy (client);
413+
mongoc_uri_destroy (uri);
414+
}
415+
390416
void
391417
test_stream_tls_install (TestSuite *suite)
392418
{
@@ -418,5 +444,8 @@ test_stream_tls_install (TestSuite *suite)
418444
defined(MONGOC_ENABLE_SSL_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10000000L
419445
TestSuite_Add (suite, "/TLS/trust_dir", test_mongoc_tls_trust_dir);
420446
#endif
447+
448+
TestSuite_AddLive (
449+
suite, "/TLS/insecure_nowarning", test_mongoc_tls_insecure_nowarning);
421450
#endif
422451
}

0 commit comments

Comments
 (0)