Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dbConnect option for MySQL "use_ssl=0" #3307

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Server/dbconmy/CDatabaseConnectionMySql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CDatabaseConnectionMySql : public CDatabaseConnection
bool m_bInAutomaticTransaction;
CTickCount m_AutomaticTransactionStartTime;
int m_bMultipleStatements;
int m_bUseSSL;
};

///////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -85,6 +86,7 @@ CDatabaseConnectionMySql::CDatabaseConnectionMySql(CDatabaseType* pManager, cons
optionsMap.Get("autoreconnect", m_bAutomaticReconnect, 1);
optionsMap.Get("batch", m_bAutomaticTransactionsEnabled, 1);
optionsMap.Get("multi_statements", m_bMultipleStatements, 0);
optionsMap.Get("use_ssl", m_bUseSSL, 0);

SString strHostname;
SString strDatabaseName;
Expand All @@ -106,7 +108,9 @@ CDatabaseConnectionMySql::CDatabaseConnectionMySql(CDatabaseType* pManager, cons
if (m_handle)
{
bool reconnect = m_bAutomaticReconnect;
uint const ssl_mode = m_bUseSSL ? SSL_MODE_REQUIRED : SSL_MODE_DISABLED;
mysql_options(m_handle, MYSQL_OPT_RECONNECT, &reconnect);
mysql_options(m_handle, MYSQL_OPT_SSL_MODE, &ssl_mode);
if (!strCharset.empty())
mysql_options(m_handle, MYSQL_SET_CHARSET_NAME, strCharset);
if (m_bMultipleStatements)
Expand Down
Loading