diff --git a/server/core/config.cc b/server/core/config.cc index a0de7c547..0c2d9d68c 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -3156,6 +3156,15 @@ const char* param_type_to_str(const MXS_MODULE_PARAM* params, const char* name) return ""; } +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 * @@ -3201,6 +3210,14 @@ static bool check_config_objects(CONFIG_CONTEXT* context) continue; } + // TODO: Separate the listener and server protocol objects, hard-coded checks are not good + if (wrong_protocol_type(type, obj->m_parameters.get_string(CN_PROTOCOL))) + { + MXS_ERROR("Wrong protocol module type for '%s'", obj->m_name.c_str()); + rval = false; + continue; + } + mxb_assert(param_set); std::vector to_be_removed; diff --git a/server/modules/routing/binlogrouter/blr_slave.cc b/server/modules/routing/binlogrouter/blr_slave.cc index 25d93a04f..4b2613f21 100644 --- a/server/modules/routing/binlogrouter/blr_slave.cc +++ b/server/modules/routing/binlogrouter/blr_slave.cc @@ -4287,7 +4287,7 @@ int validate_connection_name(ROUTER_INSTANCE* router, const std::string& name, c int index = -1; - char custom_message[BINLOG_ERROR_MSG_LEN + 1]; + char custom_message[BINLOG_ERROR_MSG_LEN]; const char* message = DEFAULT_MESSAGE;