|
8 | 8 | #include "ssl-test.h"
|
9 | 9 | #include "TestSuite.h"
|
10 | 10 | #include "test-libmongoc.h"
|
| 11 | +#include "test-conveniences.h" |
11 | 12 |
|
12 | 13 | #if !defined(MONGOC_ENABLE_SSL_SECURE_CHANNEL) && \
|
13 | 14 | !defined(MONGOC_ENABLE_SSL_LIBRESSL)
|
@@ -387,6 +388,31 @@ test_mongoc_tls_trust_dir (void)
|
387 | 388 |
|
388 | 389 | #endif /* !MONGOC_ENABLE_SSL_SECURE_CHANNEL && !MONGOC_ENABLE_SSL_LIBRESSL */
|
389 | 390 |
|
| 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 | + |
390 | 416 | void
|
391 | 417 | test_stream_tls_install (TestSuite *suite)
|
392 | 418 | {
|
@@ -418,5 +444,8 @@ test_stream_tls_install (TestSuite *suite)
|
418 | 444 | defined(MONGOC_ENABLE_SSL_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10000000L
|
419 | 445 | TestSuite_Add (suite, "/TLS/trust_dir", test_mongoc_tls_trust_dir);
|
420 | 446 | #endif
|
| 447 | + |
| 448 | + TestSuite_AddLive ( |
| 449 | + suite, "/TLS/insecure_nowarning", test_mongoc_tls_insecure_nowarning); |
421 | 450 | #endif
|
422 | 451 | }
|
0 commit comments