MXS-1851: Add hard-coded protocol module check
This way a hard to track crash is avoided and the user knows how to fix it.
This commit is contained in:
@ -3066,6 +3066,15 @@ const char* param_type_to_str(const MXS_MODULE_PARAM* params, const char* name)
|
|||||||
return "<unknown parameter name>";
|
return "<unknown parameter name>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool wrong_protocol_type(const std::string& type, const std::string& protocol)
|
||||||
|
{
|
||||||
|
bool have_server_proto = strcasecmp(protocol.c_str(), "mariadbbackend") == 0
|
||||||
|
|| strcasecmp(protocol.c_str(), "mysqlbackend") == 0;
|
||||||
|
bool have_server_type = type == CN_SERVER;
|
||||||
|
|
||||||
|
return have_server_proto != have_server_type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check that the configuration objects have valid parameters
|
* @brief Check that the configuration objects have valid parameters
|
||||||
*
|
*
|
||||||
@ -3111,6 +3120,14 @@ static bool check_config_objects(CONFIG_CONTEXT* context)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Separate the listener and server protocol objects, hard-coded checks are not good
|
||||||
|
if (wrong_protocol_type(type, config_get_string(obj->parameters, CN_PROTOCOL)))
|
||||||
|
{
|
||||||
|
MXS_ERROR("Wrong protocol module type for '%s'", obj->object);
|
||||||
|
rval = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
mxb_assert(param_set);
|
mxb_assert(param_set);
|
||||||
std::vector<std::string> to_be_removed;
|
std::vector<std::string> to_be_removed;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user