From 276ff705067ad5993d3707cc1f6a9fca2bd61ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 21 Aug 2018 11:53:41 +0300 Subject: [PATCH] MXS-1929: Prevent alterations to `filters` and `servers` These parameters must not be altered at runtime via the `alter service` or `alter monitor` commands. --- server/core/config_runtime.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/server/core/config_runtime.cc b/server/core/config_runtime.cc index bc1d59940..84f564d65 100644 --- a/server/core/config_runtime.cc +++ b/server/core/config_runtime.cc @@ -522,6 +522,11 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va { return false; } + else if (strcmp(key, "servers") == 0) + { + config_runtime_error("Parameter '%s' cannot be altered via this method", key); + return false; + } mxs::SpinLockGuard guard(crt_lock); monitor_stop(monitor); @@ -604,15 +609,20 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va bool runtime_alter_service(Service *service, const char* zKey, const char* zValue) { const MXS_MODULE* mod = get_module(service->routerModule, MODULE_ROUTER); + std::string key(zKey); + std::string value(zValue); if (!validate_param(config_service_params, mod->parameters, zKey, zValue)) { return false; } + else if (key == "filters" || key == "servers") + { + config_runtime_error("Parameter '%s' cannot be altered via this method", zKey); + return false; + } mxs::SpinLockGuard guard(crt_lock); - std::string key(zKey); - std::string value(zValue); bool rval = true; if (service->is_basic_parameter(key))