From 463b2fb4685b5a0ba80f3f898333ecfd2343e6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 12 Jan 2017 12:51:49 +0200 Subject: [PATCH] Remove relative path processing from filters The filters don't need to process relative paths as the core handles that. All path parameters are interpreted as relative to the module configuration directory, /etc/maxscale.modules.d/. --- server/modules/filter/cache/cachefilter.cc | 30 ++----------------- .../modules/filter/masking/maskingfilter.cc | 12 +------- 2 files changed, 4 insertions(+), 38 deletions(-) diff --git a/server/modules/filter/cache/cachefilter.cc b/server/modules/filter/cache/cachefilter.cc index d01db8ecb..84990b71d 100644 --- a/server/modules/filter/cache/cachefilter.cc +++ b/server/modules/filter/cache/cachefilter.cc @@ -315,35 +315,11 @@ bool CacheFilter::process_params(char **pzOptions, CONFIG_PARAMETER *ppParams, C error = true; } - const CONFIG_PARAMETER *pParam = config_get_param(ppParams, "rules"); + config.rules = config_copy_string(ppParams, "rules"); + + const CONFIG_PARAMETER *pParam = config_get_param(ppParams, "storage_options"); if (pParam) - { - if (*pParam->value == '/') - { - config.rules = MXS_STRDUP(pParam->value); - } - else - { - const char* datadir = get_datadir(); - size_t len = strlen(datadir) + 1 + strlen(pParam->value) + 1; - - char *rules = (char*)MXS_MALLOC(len); - - if (rules) - { - sprintf(rules, "%s/%s", datadir, pParam->value); - config.rules = rules; - } - } - - if (!config.rules) - { - error = true; - } - } - - if ((pParam = config_get_param(ppParams, "storage_options"))) { config.storage_options = MXS_STRDUP(pParam->value); diff --git a/server/modules/filter/masking/maskingfilter.cc b/server/modules/filter/masking/maskingfilter.cc index 710cc44b6..7895a4c22 100644 --- a/server/modules/filter/masking/maskingfilter.cc +++ b/server/modules/filter/masking/maskingfilter.cc @@ -181,16 +181,6 @@ void MaskingFilter::reload(DCB* pOut) // static void MaskingFilter::process_params(char **pzOptions, CONFIG_PARAMETER *pParams, Config& config) { - const char *value = config_get_string(pParams, "rules_file"); - string rules_file; - - if (*value != '/') - { - // A relative path is interpreted relative to the data directory. - rules_file += get_datadir(); - rules_file += "/"; - } - - rules_file += value; + string rules_file = config_get_string(pParams, "rules_file"); config.set_rules_file(rules_file); }