Close #642: macOS MariaDB plugin requires SSL

Add
 - MYSQL_OPT_SSL_ENFORCE
 - MYSQL_OPT_SSL_VERIFY_SERVER_CERT
 - MARIADB_OPT_TLS_PEER_FP
 - MARIADB_OPT_TLS_PEER_FP_LIST

options to control the SSL behavior.

Especially to disable SSL you need to set
MYSQL_OPT_SSL_VERIFY_SERVER_CERT to false on macosx.
This commit is contained in:
Christian Hohnstaedt 2025-03-23 16:38:47 +01:00
parent 58b2d713a1
commit 2cc90b8ac6
3 changed files with 31 additions and 5 deletions

View File

@ -80,9 +80,10 @@ Also the environment variable XCA_<driver-name>_OPTIONS may be used to set the o
The file must contain the options as ; separated key=value pairs. The recognized options depend
on the database driver. See:
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS for PostgreSQL and
https://doc.qt.io/qt-6/sql-driver.html#connection-options for MySQL and
https://doc.qt.io/qt-6/sql-driver.html#odbc-unicode-support for ODBC.
- https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS for PostgreSQL and
- https://doc.qt.io/qt-6/sql-driver.html#connection-options for MySQL and
- https://doc.qt.io/qt-6/sql-driver.html#odbc-unicode-support for ODBC.
.. _extracting-items:

26
misc/qsqlmysql.patch Normal file
View File

@ -0,0 +1,26 @@
diff --git a/qtbase/src/plugins/sqldrivers/mysql/CMakeLists.txt b/qtbase/src/plugins/sqldrivers/mysql/CMakeLists.txt
index fb28abd9..d7a3f2da 100644
--- a/qtbase/src/plugins/sqldrivers/mysql/CMakeLists.txt
+++ b/qtbase/src/plugins/sqldrivers/mysql/CMakeLists.txt
@@ -21,4 +21,3 @@ qt_internal_add_plugin(QMYSQLDriverPlugin
Qt::SqlPrivate
)
-qt_internal_force_macos_intel_arch(QMYSQLDriverPlugin)
diff --git a/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index 3525c257..84081b22 100644
--- a/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -1288,6 +1288,12 @@ bool QMYSQLDriver::open(const QString &db,
#endif
#if defined(MYSQL_VERSION_ID) && MYSQL_VERSION_ID >= 50711 && !defined(MARIADB_VERSION_ID)
{"MYSQL_OPT_SSL_MODE"_L1, MYSQL_OPT_SSL_MODE, setOptionSslMode},
+#endif
+#if defined(MARIADB_VERSION_ID)
+ {"MYSQL_OPT_SSL_ENFORCE"_L1, MYSQL_OPT_SSL_ENFORCE, setOptionBool},
+ {"MYSQL_OPT_SSL_VERIFY_SERVER_CERT"_L1, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, setOptionBool},
+ {"MARIADB_OPT_TLS_PEER_FP"_L1, MARIADB_OPT_TLS_PEER_FP, setOptionString},
+ {"MARIADB_OPT_TLS_PEER_FP_LIST"_L1, MARIADB_OPT_TLS_PEER_FP_LIST, setOptionString},
#endif
{"MYSQL_OPT_CONNECT_TIMEOUT"_L1, MYSQL_OPT_CONNECT_TIMEOUT, setOptionInt},
{"MYSQL_OPT_READ_TIMEOUT"_L1, MYSQL_OPT_READ_TIMEOUT, setOptionInt},

View File

@ -125,8 +125,7 @@ do_openssl
#do_zstd
#do_mariadb_connector_c
# aqt install-src mac 6.6.3 --archives qtbase
# qtbase/src/plugins/sqldrivers/mysql/CMakeLists.txt:
# -qt_internal_force_macos_intel_arch(QMYSQLDriverPlugin)
# patch -p1 < $XCA_DIR/misc/qsqlmysql.patch
do_qsqlmysql
cmake -B "$BUILDDIR" "$XCA_DIR" \