@@ -116,19 +116,35 @@ test_client_side_encryption_cb (bson_t *scenario)
116
116
"\x4f\x69\x37\x36\x36\x4a\x7a\x58\x5a\x42\x64\x42\x64\x62\x64\x4d\x75\x72" \
117
117
"\x64\x6f\x6e\x4a\x31\x64"
118
118
119
- /* Convenience helper to check if spawning mongocryptd should be bypassed */
120
119
static void
121
- _check_bypass ( mongoc_auto_encryption_opts_t * opts )
120
+ _set_extra_bypass ( bson_t * extra )
122
121
{
123
122
if (test_framework_getenv_bool ("MONGOC_TEST_MONGOCRYPTD_BYPASS_SPAWN" )) {
124
- bson_t * extra ;
123
+ BSON_APPEND_BOOL (extra , "mongocryptdBypassSpawn" , true);
124
+ }
125
+ }
125
126
126
- extra = BCON_NEW ("mongocryptdBypassSpawn" , BCON_BOOL (true));
127
- mongoc_auto_encryption_opts_set_extra (opts , extra );
128
- bson_destroy (extra );
127
+ static void
128
+ _set_extra_crypt_shared (bson_t * extra )
129
+ {
130
+ char * const path =
131
+ test_framework_getenv ("MONGOC_TEST_CRYPT_SHARED_LIB_PATH" );
132
+ if (path ) {
133
+ BSON_APPEND_UTF8 (extra , "cryptSharedLibPath" , path );
134
+ bson_free (path );
129
135
}
130
136
}
131
137
138
+ /* Convenience helper to check if spawning mongocryptd should be bypassed */
139
+ static void
140
+ _check_bypass (mongoc_auto_encryption_opts_t * opts )
141
+ {
142
+ bson_t extra = BSON_INITIALIZER ;
143
+ _set_extra_bypass (& extra );
144
+ mongoc_auto_encryption_opts_set_extra (opts , & extra );
145
+ bson_destroy (& extra );
146
+ }
147
+
132
148
static bson_t *
133
149
_make_aws_kms_provider (bson_t * kms_providers )
134
150
{
@@ -2115,16 +2131,11 @@ _reset (mongoc_client_pool_t **pool,
2115
2131
mongoc_auto_encryption_opts_destroy (* opts );
2116
2132
* opts = mongoc_auto_encryption_opts_new ();
2117
2133
{
2118
- bson_t * const extra =
2119
- BCON_NEW ("mongocryptdBypassSpawn" , BCON_BOOL (true));
2120
- char * env_cryptSharedLibPath =
2121
- test_framework_getenv ("MONGOC_TEST_CRYPT_SHARED_LIB_PATH" );
2122
- if (env_cryptSharedLibPath ) {
2123
- BSON_APPEND_UTF8 (extra , "cryptSharedLibPath" , env_cryptSharedLibPath );
2124
- bson_free (env_cryptSharedLibPath );
2125
- }
2126
- mongoc_auto_encryption_opts_set_extra (* opts , extra );
2127
- bson_destroy (extra );
2134
+ bson_t extra = BSON_INITIALIZER ;
2135
+ _set_extra_bypass (& extra );
2136
+ _set_extra_crypt_shared (& extra );
2137
+ mongoc_auto_encryption_opts_set_extra (* opts , & extra );
2138
+ bson_destroy (& extra );
2128
2139
}
2129
2140
mongoc_auto_encryption_opts_set_keyvault_namespace (* opts , "db" , "keyvault" );
2130
2141
kms_providers = _make_kms_providers (false /* aws */ , true /* local */ );
0 commit comments