@@ -1317,6 +1317,20 @@ _get_kms_providers_docs (bson_t *kms_from_file, bson_t *kms_providers, bson_t *t
1317
1317
return true;
1318
1318
}
1319
1319
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
+
1320
1334
static bool
1321
1335
_parse_and_set_auto_encryption_opts (mongoc_client_t * client , bson_t * opts , bson_error_t * error )
1322
1336
{
@@ -1325,6 +1339,7 @@ _parse_and_set_auto_encryption_opts (mongoc_client_t *client, bson_t *opts, bson
1325
1339
bson_t kms_providers = BSON_INITIALIZER ;
1326
1340
bson_t tls_opts = BSON_INITIALIZER ;
1327
1341
BSON_ASSERT (client );
1342
+ bson_t * extra = NULL ;
1328
1343
1329
1344
bson_parser_t * const parser = bson_parser_new ();
1330
1345
@@ -1397,7 +1412,9 @@ _parse_and_set_auto_encryption_opts (mongoc_client_t *client, bson_t *opts, bson
1397
1412
}
1398
1413
1399
1414
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 );
1401
1418
}
1402
1419
1403
1420
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
1406
1423
ret = true;
1407
1424
1408
1425
done :
1426
+ bson_destroy (extra );
1409
1427
mongoc_auto_encryption_opts_destroy (auto_encryption_opts );
1410
1428
bson_destroy (& kms_providers );
1411
1429
bson_destroy (& tls_opts );
0 commit comments