summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 5178e7a79..48337f884 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -481,15 +481,27 @@ bool TQMYSQLDriver::open( const TQString& db,
TQStringList raw = TQStringList::split( ';', connOpts );
TQStringList opts;
TQStringList::ConstIterator it;
+ TQString ssl_key, ssl_cert, ssl_ca, ssl_capath, ssl_cipher;
// extract the real options from the string
for ( it = raw.begin(); it != raw.end(); ++it ) {
- TQString tmp( *it );
+ TQString tmp( *it ), name;
int idx;
if ( (idx = tmp.find( '=' )) != -1 ) {
TQString val( tmp.mid( idx + 1 ) );
val.simplifyWhiteSpace();
- if ( val == "TRUE" || val == "1" )
+ name = tmp.left( idx );
+ if (name == "MYSQL_SSL_KEY")
+ ssl_key = val;
+ else if (name == "MYSQL_SSL_CERT")
+ ssl_cert = val;
+ else if (name == "MYSQL_SSL_CA")
+ ssl_ca = val;
+ else if (name == "MYSQL_SSL_CAPATH")
+ ssl_capath = val;
+ else if (name == "MYSQL_SSL_CIPHER")
+ ssl_capath = val;
+ else if ( val == "TRUE" || val == "1" )
opts << tmp.left( idx );
else
tqWarning( "TQMYSQLDriver::open: Illegal connect option value '%s'", tmp.latin1() );
@@ -528,6 +540,15 @@ bool TQMYSQLDriver::open( const TQString& db,
tqWarning( "TQMYSQLDriver::open: Unknown connect option '%s'", (*it).latin1() );
}
+ if (clientOptionFlags & CLIENT_SSL) {
+ mysql_ssl_set(d->mysql,
+ ssl_key.isEmpty()? static_cast<const char *>(0):ssl_key.local8Bit(),
+ ssl_cert.isEmpty()? static_cast<const char *>(0):ssl_cert.local8Bit(),
+ ssl_ca.isEmpty()? static_cast<const char *>(0):ssl_ca.local8Bit(),
+ ssl_capath.isEmpty()? static_cast<const char *>(0):ssl_capath.local8Bit(),
+ ssl_cipher.isEmpty()? static_cast<const char *>(0):ssl_cipher.local8Bit()
+ );
+ }
mysql_options(d->mysql, MYSQL_OPT_RECONNECT, &reconnect);
if ( mysql_real_connect( d->mysql,