MXS-1461 Remove special handling for function + allow

No need for this when 'not_function' is available.
This commit is contained in:
Johan Wikman
2017-11-10 09:54:29 +02:00
parent 3215458b30
commit 3993ece209

View File

@ -184,27 +184,19 @@ bool FunctionRule::matches_query(DbfwSession* session, GWBUF* buffer, char** msg
size_t n_infos; size_t n_infos;
qc_get_function_info(buffer, &infos, &n_infos); qc_get_function_info(buffer, &infos, &n_infos);
if (n_infos == 0 && session->get_action() == FW_ACTION_ALLOW) for (size_t i = 0; i < n_infos; ++i)
{ {
rval = true; std::string tok = infos[i].name;
} std::transform(tok.begin(), tok.end(), tok.begin(), ::tolower);
else ValueList::const_iterator it = std::find(m_values.begin(), m_values.end(), tok);
{
for (size_t i = 0; i < n_infos; ++i) if (it != m_values.end())
{ {
std::string tok = infos[i].name; MXS_NOTICE("rule '%s': query uses forbidden function: %s",
std::transform(tok.begin(), tok.end(), tok.begin(), ::tolower); name().c_str(), tok.c_str());
ValueList::const_iterator it = std::find(m_values.begin(), m_values.end(), tok); *msg = create_error("Permission denied to function '%s'.", tok.c_str());
rval = true;
if (it != m_values.end()) break;
{
MXS_NOTICE("rule '%s': query uses forbidden function: %s",
name().c_str(), tok.c_str());
*msg = create_error("Permission denied to function '%s'.", tok.c_str());
rval = true;
break;
}
} }
} }
} }