Add SSL support for created servers

Servers created at runtime can now be configured to use SSL. The
configuration is only possible if the server is not in use.

The `alter server` command in maxadmin now takes a list of `key=value`
strings. This allows the user to define multiple alter operations with one
command.
This commit is contained in:
Markus Makela
2016-11-12 13:23:50 +02:00
parent b893ca7ba8
commit 8b692b0754
3 changed files with 122 additions and 23 deletions

View File

@ -987,6 +987,8 @@ server_update_address(SERVER *server, char *address)
spinlock_acquire(&server_spin);
if (server && address)
{
MXS_NOTICE("Updated the address of server '%s' from '%s' to '%s'.",
server->unique_name, server->name, address);
strcpy(server->name, address);
}
spinlock_release(&server_spin);
@ -1005,6 +1007,8 @@ server_update_port(SERVER *server, unsigned short port)
spinlock_acquire(&server_spin);
if (server && port > 0)
{
MXS_NOTICE("Updated the port of server '%s' from %d to %d.",
server->unique_name, server->port, port);
server->port = port;
}
spinlock_release(&server_spin);
@ -1082,7 +1086,7 @@ bool server_set_version_string(SERVER* server, const char* string)
* @param filename Filename where configuration is written
* @return True on success, false on error
*/
static bool create_server_config(SERVER *server, const char *filename)
static bool create_server_config(const SERVER *server, const char *filename)
{
int file = open(filename, O_EXCL | O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
@ -1182,17 +1186,7 @@ static bool create_server_config(SERVER *server, const char *filename)
return true;
}
/**
* @brief Serialize a server to a file
*
* This converts @c server into an INI format file. This allows created servers
* to be persisted to disk. This will replace any existing files with the same
* name.
*
* @param server Server to serialize
* @return False if the serialization of the server fails, true if it was successful
*/
static bool server_serialize(SERVER *server)
bool server_serialize(const SERVER *server)
{
bool rval = false;
char filename[PATH_MAX];