Masking Filter: removed extra constraints which cause some tests to fail
Masking Filter: removed extra constraints which cause some tests to fail
This commit is contained in:
@ -848,9 +848,9 @@ bool rule_get_value_fill(json_t* pRule,
|
|||||||
// Get value from 'with' object
|
// Get value from 'with' object
|
||||||
json_t* pTheValue = json_object_get(pWith, KEY_VALUE);
|
json_t* pTheValue = json_object_get(pWith, KEY_VALUE);
|
||||||
|
|
||||||
// Check values
|
// Check Json strings
|
||||||
if ((!pTheFill || !json_is_string(pTheFill)) ||
|
if ((pTheFill && !json_is_string(pTheFill)) ||
|
||||||
(!pTheValue || !json_is_string(pTheValue)))
|
(pTheValue && !json_is_string(pTheValue)))
|
||||||
{
|
{
|
||||||
MXS_ERROR("A masking '%s' rule has '%s' and/or '%s' "
|
MXS_ERROR("A masking '%s' rule has '%s' and/or '%s' "
|
||||||
"invalid Json strings.",
|
"invalid Json strings.",
|
||||||
@ -859,13 +859,18 @@ bool rule_get_value_fill(json_t* pRule,
|
|||||||
KEY_FILL);
|
KEY_FILL);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// Update the string values
|
||||||
|
if (pTheFill)
|
||||||
{
|
{
|
||||||
// Update the string buffers
|
|
||||||
pFill->assign(json_string_value(pTheFill));
|
pFill->assign(json_string_value(pTheFill));
|
||||||
pValue->assign(json_string_value(pTheValue));
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
if (pTheValue)
|
||||||
|
{
|
||||||
|
pValue->assign(json_string_value(pTheValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
@ -889,26 +894,14 @@ auto_ptr<MaskingRules::Rule> MaskingRules::ReplaceRule::create_from(json_t* pRul
|
|||||||
KEY_REPLACE) &&
|
KEY_REPLACE) &&
|
||||||
rule_get_value_fill(pRule, &value, &fill)) // get value/fill
|
rule_get_value_fill(pRule, &value, &fill)) // get value/fill
|
||||||
{
|
{
|
||||||
if (!value.empty() && !fill.empty())
|
// Apply value/fill: instantiate the ReplaceRule class
|
||||||
{
|
sRule = auto_ptr<MaskingRules::ReplaceRule>(new MaskingRules::ReplaceRule(column,
|
||||||
// Apply value/fill: instantiate the ReplaceRule class
|
table,
|
||||||
sRule = auto_ptr<MaskingRules::ReplaceRule>(new MaskingRules::ReplaceRule(column,
|
database,
|
||||||
table,
|
applies_to,
|
||||||
database,
|
exempted,
|
||||||
applies_to,
|
value,
|
||||||
exempted,
|
fill));
|
||||||
value,
|
|
||||||
fill));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MXS_ERROR("Key '%s' or '%s' of masking '%s' rule object '%s' "
|
|
||||||
"has a non-string value or empty value.",
|
|
||||||
KEY_VALUE,
|
|
||||||
KEY_FILL,
|
|
||||||
KEY_REPLACE,
|
|
||||||
KEY_WITH);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sRule;
|
return sRule;
|
||||||
|
|||||||
Reference in New Issue
Block a user