Skip to content

Commit 23e7365

Browse files
committed
chore: Handle versions that require on libcrypto transitively
1 parent 71f99af commit 23e7365

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

binding.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ Value GetMongoCryptSharedLibraryVersion(const CallbackInfo& args) {
8989
#else
9090
void* lib = dlopen(filename.data(), RTLD_LAZY | RTLD_LOCAL);
9191
if (!lib) {
92+
std::string reported_error = dlerror();
93+
if (reported_error.find("libcrypto.so.1.1") != std::string::npos) {
94+
// This error happens for versions of the library that depend on libcrypto
95+
// (proxy libraries). In this case, we can't really know the version so
96+
// return unknown.
97+
Object result = Object::New(env);
98+
result["version"] = BigInt::New(env, 0);
99+
result["versionStr"] = String::New(env, std::string("mongo_crypt_v1-unknown"));
100+
return result;
101+
}
102+
92103
throw Error::New(env, std::string("dlopen() failed: ") + dlerror());
93104
}
94105
Cleanup cleanup([&]() { dlclose(lib); });

0 commit comments

Comments
 (0)