diff options
| author | 2026-05-30 11:05:50 +0100 | |
|---|---|---|
| committer | 2026-05-30 11:16:34 +0100 | |
| commit | c1a681edc5cc2ff42d5df77af38049d83fecee31 (patch) | |
| tree | a7ec498e84afbf4f8e5acdaccae7c7a1ace317e3 /src/modules/extra/m_mysql.cpp | |
| parent | Fix <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.cpp | 9 |
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. |
