Skip to content

Commit bfdcb57

Browse files
quinnjclaude
andauthored
Fix OpenSSL library loading for MariaDB authentication plugins (#233)
MariaDB authentication plugins (e.g., caching_sha2_password) depend on OpenSSL, but when MariaDB loads them via dlopen at runtime, the dynamic linker can't find OpenSSL because it's in a different JLL artifact. This fix pre-loads OpenSSL libraries with RTLD_GLOBAL when the API module initializes. This makes OpenSSL symbols globally available to subsequently loaded libraries, allowing the plugins to find them. Fixes #232 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d5c20f9 commit bfdcb57

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
name = "MySQL"
22
uuid = "39abe10b-433b-5dbd-92d4-e302a9df00cd"
33
author = ["quinnj"]
4-
version = "1.5.0"
4+
version = "1.5.1"
55

66
[deps]
77
DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"
88
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
99
DecFP = "55939f99-70c6-5e9b-8bb0-5071ed7d61fd"
1010
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
1111
MariaDB_Connector_C_jll = "aabc7e14-95f1-5e66-9f32-aea603782360"
12+
OpenSSL_jll = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
1213
Parsers = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
1314
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1415
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
@@ -17,6 +18,7 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
1718
DBInterface = "2.5"
1819
DecFP = "0.4.9, 0.4.10, 1"
1920
MariaDB_Connector_C_jll = "3.1.12"
21+
OpenSSL_jll = "3"
2022
Parsers = "0.3, 1, 2"
2123
Tables = "1"
2224
julia = "1.6"

src/api/API.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
11
module API
22

3-
using Dates, DecFP
3+
using Dates, DecFP, Libdl
44

55
export DateAndTime
66

77
using MariaDB_Connector_C_jll
8+
using OpenSSL_jll: libssl, libcrypto
9+
810
const PLUGIN_DIR = joinpath(MariaDB_Connector_C_jll.artifact_dir, "lib", "mariadb", "plugin")
911

12+
# Pre-load OpenSSL libraries so they're available when MariaDB loads plugins.
13+
# MariaDB authentication plugins (e.g., caching_sha2_password) depend on OpenSSL,
14+
# but when MariaDB loads them via dlopen, the dynamic linker can't find OpenSSL
15+
# because it's in a different artifact. By loading OpenSSL with RTLD_GLOBAL first,
16+
# its symbols become available to subsequently loaded libraries.
17+
# See: https://github.com/JuliaDatabases/MySQL.jl/issues/232
18+
function __init__()
19+
@static if !Sys.iswindows()
20+
Libdl.dlopen(libcrypto, Libdl.RTLD_GLOBAL)
21+
Libdl.dlopen(libssl, Libdl.RTLD_GLOBAL)
22+
end
23+
end
24+
1025
# const definitions from mysql client library
1126
include("consts.jl")
1227

0 commit comments

Comments
 (0)