Fix object name tokenization

Spaces must be considered a part of the object name in tokenization. This
ensures that the name normalization process generates correct names and
that tokens are split at correct places.
This commit is contained in:
Markus Mäkelä 2018-07-17 08:42:16 +03:00
parent 4da7e4678f
commit c31e78754d
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
3 changed files with 8 additions and 4 deletions

View File

@ -3188,8 +3188,10 @@ int configure_new_service(CONFIG_CONTEXT *obj)
SERVICE *service = (SERVICE*)obj->element;
ss_dassert(service);
for (auto&& a: mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ", \t"))
for (auto&& a: mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
{
fix_object_name(&a[0]);
if (SERVER* s = server_find_by_unique_name(a.c_str()))
{
serviceAddBackend(service, s);
@ -3226,8 +3228,9 @@ int create_new_monitor(CONFIG_CONTEXT *obj, std::set<std::string>& monitored_ser
bool err = false;
// TODO: Use server list parameter type for this
for (auto&& s: mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ", \t"))
for (auto&& s: mxs::strtok(config_get_string(obj->parameters, CN_SERVERS), ","))
{
fix_object_name(&s[0]);
SERVER* server = server_find_by_unique_name(s.c_str());
if (!server)

View File

@ -142,8 +142,9 @@ MXS_MONITOR* monitor_create(const char *name, const char *module, MXS_CONFIG_PAR
mon->disk_space_check_interval = config_get_integer(params, CN_DISK_SPACE_CHECK_INTERVAL);
spinlock_init(&mon->lock);
for (auto&& s: mxs::strtok(config_get_string(params, CN_SERVERS), ", \t"))
for (auto&& s: mxs::strtok(config_get_string(params, CN_SERVERS), ","))
{
fix_object_name(&s[0]);
monitor_add_server(mon, server_find_by_unique_name(s.c_str()));
}

View File

@ -1129,7 +1129,7 @@ bool service_set_filters(SERVICE* service, const char* filters)
std::vector<MXS_FILTER_DEF*> flist;
uint64_t capabilities = 0;
for (auto&& f: mxs::strtok(filters, "| \t"))
for (auto&& f: mxs::strtok(filters, "|"))
{
fix_object_name(&f[0]);