diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs1731_empty_param b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1731_empty_param new file mode 100644 index 000000000..7816ef422 --- /dev/null +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1731_empty_param @@ -0,0 +1,59 @@ +[maxscale] +threads=###threads### + +[server1] +type=server +address=###node_server_IP_1### +port=###node_server_port_1### +protocol=MySQLBackend + +[server2] +type=server +address=###node_server_IP_2### +port=###node_server_port_2### +protocol=MySQLBackend + +[server3] +type=server +address=###node_server_IP_3### +port=###node_server_port_3### +protocol=MySQLBackend + +[server4] +type=server +address=###node_server_IP_4### +port=###node_server_port_4### +protocol=MySQLBackend + +[MySQL Monitor] +type=monitor +module=mysqlmon +###repl51### +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql +monitor_interval=1000 + +[RW Split Router] +type=service +router=readwritesplit +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql +version_string= + +[RW Split Listener] +type=listener +service=RW Split Router +protocol=MySQLClient +port=4006 + +[CLI] +type=service +router=cli + +[CLI Listener] +type=listener +service=CLI +protocol=maxscaled +socket=default diff --git a/maxscale-system-test/config_test.cpp b/maxscale-system-test/config_test.cpp index adfc4cc63..35d27dede 100644 --- a/maxscale-system-test/config_test.cpp +++ b/maxscale-system-test/config_test.cpp @@ -20,6 +20,7 @@ const char *bad_configs[] = "mxs720_line_with_no_equal", "mxs720_wierd_line", "mxs799", + "mxs1731_empty_param", NULL }; diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 1b437907e..c3978ebb9 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -1911,8 +1911,8 @@ bool TestConnections::test_bad_config(int m, const char *config) // Set the timeout to prevent hangs with configurations that work set_timeout(20); - return maxscales->ssh_node(m, "cp maxscale.cnf /etc/maxscale.cnf; service maxscale stop; " - "maxscale -U maxscale -lstdout &> /dev/null && sleep 1 && pkill -9 maxscale", false) == 0; + return maxscales->ssh_node_f(m, true, "cp maxscale.cnf /etc/maxscale.cnf; service maxscale stop; " + "maxscale -U maxscale -lstdout &> /dev/null && sleep 1 && pkill -9 maxscale") == 0; } std::string dump_status(const StringSet& current, const StringSet& expected) diff --git a/server/core/config.cc b/server/core/config.cc index 06a2c540a..4bc683fe3 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -463,6 +463,19 @@ void fix_section_name(char *section) replace_whitespace(section); } +static bool is_empty_string(const char* str) +{ + for (const char* p = str; *p; p++) + { + if (!isspace(*p)) + { + return false; + } + } + + return true; +} + /** * Config item handler for the ini file reader * @@ -477,6 +490,12 @@ static int ini_handler(void *userdata, const char *section, const char *name, co CONFIG_CONTEXT *cntxt = (CONFIG_CONTEXT *)userdata; CONFIG_CONTEXT *ptr = cntxt; + if (is_empty_string(value)) + { + MXS_ERROR("Empty value given to parameter '%s'", name); + return 0; + } + if (config_get_global_options()->substitute_variables) { if (*value == '$')