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/.
This commit is contained in:
Markus Mäkelä 2017-01-12 12:51:49 +02:00
parent 813704440a
commit 463b2fb468
2 changed files with 4 additions and 38 deletions

View File

@ -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);

View File

@ -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);
}