MXS-2483: Minor SSL usage cleanup

Changed getter function return values to std::string, converted
MXS_CONFIG_PARAMETER::set_from_list to take std::strings instead of const
char pointers.
This commit is contained in:
Markus Mäkelä
2019-05-17 17:19:05 +03:00
parent 82add11e86
commit c78e907da0
4 changed files with 10 additions and 9 deletions

View File

@ -438,7 +438,7 @@ public:
*/ */
void set_multiple(const MXS_CONFIG_PARAMETER& source); void set_multiple(const MXS_CONFIG_PARAMETER& source);
void set_from_list(std::vector<std::pair<const char*, const char*>> list, void set_from_list(std::vector<std::pair<std::string, std::string>> list,
const MXS_MODULE_PARAM* module_params = NULL); const MXS_MODULE_PARAM* module_params = NULL);
/** /**

View File

@ -92,21 +92,21 @@ public:
} }
// Private key // Private key
const char* ssl_key() const const std::string& ssl_key() const
{ {
return m_key.c_str(); return m_key;
} }
// Public cert // Public cert
const char* ssl_cert() const const std::string& ssl_cert() const
{ {
return m_cert.c_str(); return m_cert;
} }
// Certificate authority // Certificate authority
const char* ssl_ca() const const std::string& ssl_ca() const
{ {
return m_ca.c_str(); return m_ca;
} }
// Convert to JSON representation // Convert to JSON representation

View File

@ -2167,7 +2167,7 @@ void MXS_CONFIG_PARAMETER::set_multiple(const MXS_CONFIG_PARAMETER& source)
} }
} }
void MXS_CONFIG_PARAMETER::set_from_list(std::vector<std::pair<const char*, const char*>> list, void MXS_CONFIG_PARAMETER::set_from_list(std::vector<std::pair<std::string, std::string>> list,
const MXS_MODULE_PARAM* module_params) const MXS_MODULE_PARAM* module_params)
{ {
// Add custom values. // Add custom values.

View File

@ -159,7 +159,8 @@ MYSQL* mxs_mysql_real_connect(MYSQL* con, SERVER* server, const char* user, cons
if (ssl) if (ssl)
{ {
mysql_ssl_set(con, ssl->ssl_key(), ssl->ssl_cert(), ssl->ssl_ca(), NULL, NULL); mysql_ssl_set(con, ssl->ssl_key().c_str(), ssl->ssl_cert().c_str(), ssl->ssl_ca().c_str(),
NULL, NULL);
} }
char yes = 1; char yes = 1;