aboutsummaryrefslogtreecommitdiff
path: root/src/modules/extra/m_mysql.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-05-30 11:05:50 +0100
committerGravatar Sadie Powell2026-05-30 11:16:34 +0100
commitc1a681edc5cc2ff42d5df77af38049d83fecee31 (patch)
treea7ec498e84afbf4f8e5acdaccae7c7a1ace317e3 /src/modules/extra/m_mysql.cpp
parentFix <database:ssl> not being called <database:tls> as documented. (diff)
Allow <database:tls> to work on MySQL forks that use the old API.
Closes #2212.
Diffstat (limited to 'src/modules/extra/m_mysql.cpp')
-rw-r--r--src/modules/extra/m_mysql.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index e1d505afb..ecd8806e7 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -334,10 +334,13 @@ public:
mysql_options(connection, MYSQL_OPT_CONNECT_TIMEOUT, &timeout);
// Enable SSL if requested.
+ const bool tls = config->getBool("tls", config->getBool("ssl"));
#if defined LIBMYSQL_VERSION_ID && LIBMYSQL_VERSION_ID > 80000
- const bool usetls = config->getBool("tls", config->getBool("ssl"));
- unsigned int ssl = usetls ? SSL_MODE_REQUIRED : SSL_MODE_PREFERRED;
- mysql_options(connection, MYSQL_OPT_SSL_MODE, &ssl);
+ unsigned int sslmode = tls ? SSL_MODE_REQUIRED : SSL_MODE_PREFERRED;
+ mysql_options(connection, MYSQL_OPT_SSL_MODE, &sslmode);
+#else
+ // my_bool and bool function the same with regards to truthiness.
+ mysql_options(connection, MYSQL_OPT_SSL_ENFORCE, &tls);
#endif
// Attempt to connect to the database.