Skip to content

Commit 36f6d7f

Browse files
authored
CDRIVER-5901 maybe set cryptSharedLibPath (#2060)
1 parent 5d362cc commit 36f6d7f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/libmongoc/tests/unified/entity-map.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,20 @@ _get_kms_providers_docs (bson_t *kms_from_file, bson_t *kms_providers, bson_t *t
13171317
return true;
13181318
}
13191319

1320+
static void
1321+
maybe_set_extra_crypt_shared (bson_t *extra)
1322+
{
1323+
if (bson_has_field (extra, "cryptSharedLibPath")) {
1324+
return; // Already set.
1325+
}
1326+
1327+
char *const path = test_framework_getenv ("MONGOC_TEST_CRYPT_SHARED_LIB_PATH");
1328+
if (path) {
1329+
BSON_APPEND_UTF8 (extra, "cryptSharedLibPath", path);
1330+
bson_free (path);
1331+
}
1332+
}
1333+
13201334
static bool
13211335
_parse_and_set_auto_encryption_opts (mongoc_client_t *client, bson_t *opts, bson_error_t *error)
13221336
{
@@ -1325,6 +1339,7 @@ _parse_and_set_auto_encryption_opts (mongoc_client_t *client, bson_t *opts, bson
13251339
bson_t kms_providers = BSON_INITIALIZER;
13261340
bson_t tls_opts = BSON_INITIALIZER;
13271341
BSON_ASSERT (client);
1342+
bson_t *extra = NULL;
13281343

13291344
bson_parser_t *const parser = bson_parser_new ();
13301345

@@ -1397,7 +1412,9 @@ _parse_and_set_auto_encryption_opts (mongoc_client_t *client, bson_t *opts, bson
13971412
}
13981413

13991414
if (extra_options) {
1400-
mongoc_auto_encryption_opts_set_extra (auto_encryption_opts, extra_options);
1415+
extra = bson_copy (extra_options);
1416+
maybe_set_extra_crypt_shared (extra);
1417+
mongoc_auto_encryption_opts_set_extra (auto_encryption_opts, extra);
14011418
}
14021419

14031420
if (!mongoc_client_enable_auto_encryption (client, auto_encryption_opts, error)) {
@@ -1406,6 +1423,7 @@ _parse_and_set_auto_encryption_opts (mongoc_client_t *client, bson_t *opts, bson
14061423
ret = true;
14071424

14081425
done:
1426+
bson_destroy (extra);
14091427
mongoc_auto_encryption_opts_destroy (auto_encryption_opts);
14101428
bson_destroy (&kms_providers);
14111429
bson_destroy (&tls_opts);

0 commit comments

Comments
 (0)