MXS-2486: Fix listener serialization

The serialization should be done via the parameters. This also makes
SSLContext::serialize redundant.
This commit is contained in:
Markus Mäkelä 2019-05-27 20:21:24 +03:00
parent 075ed00f58
commit cab35b2dea
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
3 changed files with 2 additions and 42 deletions

View File

@ -103,13 +103,6 @@ public:
*/
static std::unique_ptr<SSLContext> create(const MXS_CONFIG_PARAMETER& params);
/**
* Serialize the SSL configuration into a INI file section
*
* @return SSLContext as a INI file section
*/
std::string serialize() const;
/**
* Opens a new OpenSSL session for this configuration context
*/

View File

@ -472,20 +472,10 @@ bool Listener::create_listener_config(const char* filename)
// TODO: Check for return values on all of the dprintf calls
dprintf(file, "[%s]\n", m_name.c_str());
dprintf(file, "type=listener\n");
dprintf(file, "protocol=%s\n", m_protocol.c_str());
dprintf(file, "service=%s\n", m_service->name());
dprintf(file, "address=%s\n", m_address.c_str());
dprintf(file, "port=%u\n", m_port);
dprintf(file, "authenticator=%s\n", m_authenticator.c_str());
if (!m_auth_options.empty())
for (const auto& p : m_params)
{
dprintf(file, "authenticator_options=%s\n", m_auth_options.c_str());
}
if (ssl().context())
{
dprintf(file, "%s", ssl().context()->serialize().c_str());
dprintf(file, "%s=%s\n", p.first.c_str(), p.second.c_str());
}
::close(file);

View File

@ -234,29 +234,6 @@ SSLContext::SSLContext(const SSLConfig& cfg)
{
}
std::string SSLContext::serialize() const
{
std::ostringstream ss;
ss << "ssl=required\n";
if (!m_cfg.cert.empty())
{
ss << "ssl_cert=" << m_cfg.cert << "\n";
}
if (!m_cfg.key.empty())
{
ss << "ssl_key=" << m_cfg.key << "\n";
}
mxb_assert(!m_cfg.ca.empty());
ss << "ssl_ca_cert=" << m_cfg.ca << "\n";
ss << "ssl_version=" << ssl_method_type_to_string(m_cfg.version) << "\n";
ss << "ssl_cert_verify_depth=" << m_cfg.verify_depth << "\n";
ss << "ssl_verify_peer_certificate=" << (m_cfg.verify_peer ? "true" : "false") << "\n";
return ss.str();
}
bool SSLContext::init()
{
bool rval = true;