MXS-1731: Treat empty parameters as errors
If a parameter is defined without a value, it is now treated as an error.
This commit is contained in:

committed by
Johan Wikman

parent
436c563da7
commit
433528aa59
@ -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
|
@ -20,6 +20,7 @@ const char *bad_configs[] =
|
|||||||
"mxs720_line_with_no_equal",
|
"mxs720_line_with_no_equal",
|
||||||
"mxs720_wierd_line",
|
"mxs720_wierd_line",
|
||||||
"mxs799",
|
"mxs799",
|
||||||
|
"mxs1731_empty_param",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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 the timeout to prevent hangs with configurations that work
|
||||||
set_timeout(20);
|
set_timeout(20);
|
||||||
|
|
||||||
return maxscales->ssh_node(m, "cp maxscale.cnf /etc/maxscale.cnf; service maxscale stop; "
|
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", false) == 0;
|
"maxscale -U maxscale -lstdout &> /dev/null && sleep 1 && pkill -9 maxscale") == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dump_status(const StringSet& current, const StringSet& expected)
|
std::string dump_status(const StringSet& current, const StringSet& expected)
|
||||||
|
@ -463,6 +463,19 @@ void fix_section_name(char *section)
|
|||||||
replace_whitespace(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
|
* 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 *cntxt = (CONFIG_CONTEXT *)userdata;
|
||||||
CONFIG_CONTEXT *ptr = cntxt;
|
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 (config_get_global_options()->substitute_variables)
|
||||||
{
|
{
|
||||||
if (*value == '$')
|
if (*value == '$')
|
||||||
|
Reference in New Issue
Block a user