Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f
Add back leading operator enforcement.
This commit is contained in:
@ -372,8 +372,8 @@ bool BinlogFilterSession::checkEvent(GWBUF* buffer,
|
||||
fixEvent(event + MYSQL_HEADER_LEN + 1, hdr.event_size);
|
||||
|
||||
MXS_INFO("Skipped events: Setting next_pos = 0 in %s",
|
||||
event[4] == XID_EVENT
|
||||
? "XID_EVENT" : "COMMIT");
|
||||
event[4] == XID_EVENT ?
|
||||
"XID_EVENT" : "COMMIT");
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -869,9 +869,9 @@ CacheFilterSession::cache_action_t CacheFilterSession::get_cache_action(GWBUF* p
|
||||
|
||||
if (log_decisions())
|
||||
{
|
||||
zPrimary_reason
|
||||
= "populating but not using cache inside transaction that is not "
|
||||
"explicitly read-only, but that has used only SELECTs sofar";
|
||||
zPrimary_reason =
|
||||
"populating but not using cache inside transaction that is not "
|
||||
"explicitly read-only, but that has used only SELECTs sofar";
|
||||
}
|
||||
action = CACHE_POPULATE;
|
||||
}
|
||||
|
10
server/modules/filter/cache/rules.cc
vendored
10
server/modules/filter/cache/rules.cc
vendored
@ -1394,8 +1394,8 @@ static bool cache_rule_matches_column_simple(CACHE_RULE* self, const char* defau
|
||||
{
|
||||
if (rule_database)
|
||||
{
|
||||
const char* check_database
|
||||
= info->database ? info->database : default_database;
|
||||
const char* check_database =
|
||||
info->database ? info->database : default_database;
|
||||
|
||||
if (check_database)
|
||||
{
|
||||
@ -1741,9 +1741,9 @@ static bool cache_rule_matches_table_simple(CACHE_RULE* self, const char* defaul
|
||||
|
||||
if (database)
|
||||
{
|
||||
matches
|
||||
= (strcasecmp(self->simple.database, database) == 0)
|
||||
&& (strcasecmp(self->simple.table, table) == 0);
|
||||
matches =
|
||||
(strcasecmp(self->simple.database, database) == 0)
|
||||
&& (strcasecmp(self->simple.table, table) == 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -393,10 +393,10 @@ int run()
|
||||
namespace
|
||||
{
|
||||
|
||||
char USAGE[]
|
||||
= "usage: test_dbfwfilter [-d]\n"
|
||||
"\n"
|
||||
"-d don't stop at first error\n";
|
||||
char USAGE[] =
|
||||
"usage: test_dbfwfilter [-d]\n"
|
||||
"\n"
|
||||
"-d don't stop at first error\n";
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
60
server/modules/filter/cache/test/testrules.cc
vendored
60
server/modules/filter/cache/test/testrules.cc
vendored
@ -420,36 +420,36 @@ int test_store()
|
||||
}
|
||||
|
||||
|
||||
static const char ARRAY_RULES[]
|
||||
= "["
|
||||
" {"
|
||||
" \"store\": ["
|
||||
" {"
|
||||
" \"attribute\": \"column\","
|
||||
" \"op\": \"=\","
|
||||
" \"value\": \"a\""
|
||||
" }"
|
||||
" ]"
|
||||
" },"
|
||||
" {"
|
||||
" \"store\": ["
|
||||
" {"
|
||||
" \"attribute\": \"column\","
|
||||
" \"op\": \"=\","
|
||||
" \"value\": \"b\""
|
||||
" }"
|
||||
" ]"
|
||||
" },"
|
||||
" {"
|
||||
" \"store\": ["
|
||||
" {"
|
||||
" \"attribute\": \"column\","
|
||||
" \"op\": \"=\","
|
||||
" \"value\": \"c\""
|
||||
" }"
|
||||
" ]"
|
||||
" }"
|
||||
"]";
|
||||
static const char ARRAY_RULES[] =
|
||||
"["
|
||||
" {"
|
||||
" \"store\": ["
|
||||
" {"
|
||||
" \"attribute\": \"column\","
|
||||
" \"op\": \"=\","
|
||||
" \"value\": \"a\""
|
||||
" }"
|
||||
" ]"
|
||||
" },"
|
||||
" {"
|
||||
" \"store\": ["
|
||||
" {"
|
||||
" \"attribute\": \"column\","
|
||||
" \"op\": \"=\","
|
||||
" \"value\": \"b\""
|
||||
" }"
|
||||
" ]"
|
||||
" },"
|
||||
" {"
|
||||
" \"store\": ["
|
||||
" {"
|
||||
" \"attribute\": \"column\","
|
||||
" \"op\": \"=\","
|
||||
" \"value\": \"c\""
|
||||
" }"
|
||||
" ]"
|
||||
" }"
|
||||
"]";
|
||||
|
||||
struct ARRAY_TEST_CASE
|
||||
{
|
||||
|
@ -356,13 +356,13 @@ static int routeQuery(MXS_FILTER* instance, MXS_FILTER_SESSION* session, GWBUF*
|
||||
}
|
||||
if (!decided)
|
||||
{
|
||||
trigger_ccr
|
||||
= mxs_pcre2_check_match_exclude(my_instance->re,
|
||||
my_instance->nore,
|
||||
my_session->md,
|
||||
sql,
|
||||
length,
|
||||
MXS_MODULE_NAME);
|
||||
trigger_ccr =
|
||||
mxs_pcre2_check_match_exclude(my_instance->re,
|
||||
my_instance->nore,
|
||||
my_session->md,
|
||||
sql,
|
||||
length,
|
||||
MXS_MODULE_NAME);
|
||||
}
|
||||
if (trigger_ccr)
|
||||
{
|
||||
|
@ -854,8 +854,8 @@ bool create_user_templates(void* scanner)
|
||||
|
||||
for (ValueList::const_iterator it = rstack->user.begin(); it != rstack->user.end(); it++)
|
||||
{
|
||||
SUserTemplate newtemp
|
||||
= SUserTemplate(new UserTemplate(*it, rstack->active_rules, rstack->active_mode));
|
||||
SUserTemplate newtemp =
|
||||
SUserTemplate(new UserTemplate(*it, rstack->active_rules, rstack->active_mode));
|
||||
rstack->templates.push_back(newtemp);
|
||||
}
|
||||
|
||||
@ -1668,9 +1668,9 @@ static char* create_parse_error(Dbfw* my_instance,
|
||||
{
|
||||
char* msg = NULL;
|
||||
|
||||
char format[]
|
||||
= "Query could not be %s and will hence be rejected. "
|
||||
"Please ensure that the SQL syntax is correct";
|
||||
char format[] =
|
||||
"Query could not be %s and will hence be rejected. "
|
||||
"Please ensure that the SQL syntax is correct";
|
||||
size_t len = sizeof(format) + strlen(reason); // sizeof includes the trailing NULL as well.
|
||||
char message[len];
|
||||
sprintf(message, format, reason);
|
||||
|
@ -965,10 +965,10 @@ int run()
|
||||
namespace
|
||||
{
|
||||
|
||||
char USAGE[]
|
||||
= "usage: test_dbfwfilter [-d]\n"
|
||||
"\n"
|
||||
"-d don't stop at first error\n";
|
||||
char USAGE[] =
|
||||
"usage: test_dbfwfilter [-d]\n"
|
||||
"\n"
|
||||
"-d don't stop at first error\n";
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
@ -475,8 +475,8 @@ static int32_t clientReply(MXS_FILTER* instance, MXS_FILTER_SESSION* session, GW
|
||||
gwbuf_free(reply);
|
||||
mxb_assert(my_session->queue);
|
||||
|
||||
my_session->state = my_session->state == DS_CLOSING_STREAM
|
||||
? DS_STREAM_CLOSED : DS_REQUEST_ACCEPTED;
|
||||
my_session->state = my_session->state == DS_CLOSING_STREAM ?
|
||||
DS_STREAM_CLOSED : DS_REQUEST_ACCEPTED;
|
||||
|
||||
GWBUF* queue = my_session->queue;
|
||||
my_session->queue = NULL;
|
||||
|
@ -374,9 +374,9 @@ bool create_rules_from_array(json_t* pRules, vector<shared_ptr<MaskingRules::Rul
|
||||
{
|
||||
json_t* pMatch = json_object_get(pReplace, KEY_MATCH);
|
||||
// Match takes the precedence
|
||||
sRule = pMatch
|
||||
? MaskingRules::MatchRule::create_from(pRule)
|
||||
: MaskingRules::ReplaceRule::create_from(pRule);
|
||||
sRule = pMatch ?
|
||||
MaskingRules::MatchRule::create_from(pRule) :
|
||||
MaskingRules::ReplaceRule::create_from(pRule);
|
||||
}
|
||||
|
||||
if (sRule.get())
|
||||
@ -1062,10 +1062,10 @@ bool MaskingRules::Rule::matches(const ComQueryResponse::ColumnDef& column_def,
|
||||
// we consider it a match if a table or database have been provided.
|
||||
// Otherwise it would be easy to bypass a table/database rule.
|
||||
|
||||
bool match
|
||||
= (m_column == column_def.org_name())
|
||||
&& (m_table.empty() || table.empty() || (m_table == table))
|
||||
&& (m_database.empty() || database.empty() || (m_database == database));
|
||||
bool match =
|
||||
(m_column == column_def.org_name())
|
||||
&& (m_table.empty() || table.empty() || (m_table == table))
|
||||
&& (m_database.empty() || database.empty() || (m_database == database));
|
||||
|
||||
if (match)
|
||||
{
|
||||
@ -1093,10 +1093,10 @@ bool MaskingRules::Rule::matches(const QC_FIELD_INFO& field,
|
||||
// we consider it a match if a table or database have been provided.
|
||||
// Otherwise it would be easy to bypass a table/database rule.
|
||||
|
||||
bool match
|
||||
= (m_column == zColumn)
|
||||
&& (m_table.empty() || !zTable || (m_table == zTable))
|
||||
&& (m_database.empty() || !zDatabase || (m_database == zDatabase));
|
||||
bool match =
|
||||
(m_column == zColumn)
|
||||
&& (m_table.empty() || !zTable || (m_table == zTable))
|
||||
&& (m_database.empty() || !zDatabase || (m_database == zDatabase));
|
||||
|
||||
if (match)
|
||||
{
|
||||
|
@ -18,86 +18,86 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
const char valid_minimal[]
|
||||
= "{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\" "
|
||||
" },"
|
||||
" \"with\": {"
|
||||
" \"value\": \"blah\" "
|
||||
" }"
|
||||
" },"
|
||||
" {"
|
||||
" \"obfuscate\": { "
|
||||
" \"column\": \"b\" "
|
||||
" }"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
const char valid_minimal[] =
|
||||
"{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\" "
|
||||
" },"
|
||||
" \"with\": {"
|
||||
" \"value\": \"blah\" "
|
||||
" }"
|
||||
" },"
|
||||
" {"
|
||||
" \"obfuscate\": { "
|
||||
" \"column\": \"b\" "
|
||||
" }"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
|
||||
const char valid_maximal[]
|
||||
= "{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\", "
|
||||
" \"table\": \"b\", "
|
||||
" \"database\": \"c\" "
|
||||
" },"
|
||||
" \"with\": {"
|
||||
" \"value\": \"blah\", "
|
||||
" \"fill\": \"blah\" "
|
||||
" },"
|
||||
" \"applies_to\": ["
|
||||
" \"'alice'@'host'\","
|
||||
" \"'bob'@'%'\","
|
||||
" \"'cecil'@'%.123.45.2'\""
|
||||
" ],"
|
||||
" \"exempted\": ["
|
||||
" \"'admin'\""
|
||||
" ]"
|
||||
" },"
|
||||
" {"
|
||||
" \"obfuscate\": { "
|
||||
" \"column\": \"c\", "
|
||||
" \"table\": \"d\", "
|
||||
" \"database\": \"e\" "
|
||||
" }"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
const char valid_maximal[] =
|
||||
"{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\", "
|
||||
" \"table\": \"b\", "
|
||||
" \"database\": \"c\" "
|
||||
" },"
|
||||
" \"with\": {"
|
||||
" \"value\": \"blah\", "
|
||||
" \"fill\": \"blah\" "
|
||||
" },"
|
||||
" \"applies_to\": ["
|
||||
" \"'alice'@'host'\","
|
||||
" \"'bob'@'%'\","
|
||||
" \"'cecil'@'%.123.45.2'\""
|
||||
" ],"
|
||||
" \"exempted\": ["
|
||||
" \"'admin'\""
|
||||
" ]"
|
||||
" },"
|
||||
" {"
|
||||
" \"obfuscate\": { "
|
||||
" \"column\": \"c\", "
|
||||
" \"table\": \"d\", "
|
||||
" \"database\": \"e\" "
|
||||
" }"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
|
||||
// Neither "obfuscate", nor "replace".
|
||||
const char invalid1[]
|
||||
= "{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"applies_to\": ["
|
||||
" \"'alice'@'host'\","
|
||||
" \"'bob'@'%'\""
|
||||
" ],"
|
||||
" \"exempted\": ["
|
||||
" \"'admin'\""
|
||||
" ]"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
const char invalid1[] =
|
||||
"{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"applies_to\": ["
|
||||
" \"'alice'@'host'\","
|
||||
" \"'bob'@'%'\""
|
||||
" ],"
|
||||
" \"exempted\": ["
|
||||
" \"'admin'\""
|
||||
" ]"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
|
||||
// No "column" in "replace"
|
||||
const char invalid2[]
|
||||
= "{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" },"
|
||||
" \"with\": { "
|
||||
" \"value\": \"blah\" "
|
||||
" }"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
const char invalid2[] =
|
||||
"{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" },"
|
||||
" \"with\": { "
|
||||
" \"value\": \"blah\" "
|
||||
" }"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
|
||||
// No "value" or "fill" in "with"
|
||||
/**
|
||||
@ -111,48 +111,48 @@ const char invalid2[]
|
||||
* void MaskingRules::ReplaceRule::rewrite(LEncString& s)
|
||||
*
|
||||
*/
|
||||
const char invalid3[]
|
||||
= "{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\", "
|
||||
" },"
|
||||
" \"with\": {"
|
||||
" },"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
const char invalid3[] =
|
||||
"{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\", "
|
||||
" },"
|
||||
" \"with\": {"
|
||||
" },"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
|
||||
// No "column" in "obfuscate"
|
||||
const char invalid4[]
|
||||
= "{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"obfuscate\": { "
|
||||
" }"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
const char invalid4[] =
|
||||
"{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"obfuscate\": { "
|
||||
" }"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
|
||||
// No "with" in "replace"
|
||||
const char invalid5[]
|
||||
= "{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\" "
|
||||
" },"
|
||||
" \"applies_to\": ["
|
||||
" \"'alice'@'host'\","
|
||||
" \"'bob'@'%'\""
|
||||
" ],"
|
||||
" \"exempted\": ["
|
||||
" \"'admin'\""
|
||||
" ]"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
const char invalid5[] =
|
||||
"{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\" "
|
||||
" },"
|
||||
" \"applies_to\": ["
|
||||
" \"'alice'@'host'\","
|
||||
" \"'bob'@'%'\""
|
||||
" ],"
|
||||
" \"exempted\": ["
|
||||
" \"'admin'\""
|
||||
" ]"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
|
||||
struct rule_test
|
||||
{
|
||||
@ -172,29 +172,29 @@ struct rule_test
|
||||
const size_t nRule_tests = (sizeof(rule_tests) / sizeof(rule_tests[0]));
|
||||
|
||||
// Valid, lot's of users.
|
||||
const char valid_users[]
|
||||
= "{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\" "
|
||||
" },"
|
||||
" \"with\": {"
|
||||
" \"value\": \"blah\" "
|
||||
" },"
|
||||
" \"applies_to\": ["
|
||||
" \"'alice'@'host'\","
|
||||
" \"'bob'@'%'\","
|
||||
" \"'cecil'@'%.123.45.2'\","
|
||||
" \"'david'\","
|
||||
" \"@'host'\""
|
||||
" ],"
|
||||
" \"exempted\": ["
|
||||
" \"'admin'\""
|
||||
" ]"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
const char valid_users[] =
|
||||
"{"
|
||||
" \"rules\": ["
|
||||
" {"
|
||||
" \"replace\": { "
|
||||
" \"column\": \"a\" "
|
||||
" },"
|
||||
" \"with\": {"
|
||||
" \"value\": \"blah\" "
|
||||
" },"
|
||||
" \"applies_to\": ["
|
||||
" \"'alice'@'host'\","
|
||||
" \"'bob'@'%'\","
|
||||
" \"'cecil'@'%.123.45.2'\","
|
||||
" \"'david'\","
|
||||
" \"@'host'\""
|
||||
" ],"
|
||||
" \"exempted\": ["
|
||||
" \"'admin'\""
|
||||
" ]"
|
||||
" }"
|
||||
" ]"
|
||||
"}";
|
||||
|
||||
struct expected_account
|
||||
{
|
||||
|
@ -242,10 +242,10 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
|
||||
"max_resultset_rows");
|
||||
cinstance->config.max_resultset_size = config_get_size(params,
|
||||
"max_resultset_size");
|
||||
cinstance->config.m_return
|
||||
= static_cast<maxrows_return_mode>(config_get_enum(params,
|
||||
"max_resultset_return",
|
||||
return_option_values));
|
||||
cinstance->config.m_return =
|
||||
static_cast<maxrows_return_mode>(config_get_enum(params,
|
||||
"max_resultset_return",
|
||||
return_option_values));
|
||||
cinstance->config.debug = config_get_integer(params, "debug");
|
||||
}
|
||||
|
||||
@ -1207,8 +1207,8 @@ static int send_error_upstream(MAXROWS_SESSION_DATA* csdata)
|
||||
* The input SQL statement added in the error message
|
||||
* has a limit of MAXROWS_INPUT_SQL_MAX_LEN bytes
|
||||
*/
|
||||
sql_len = (sql_len > MAXROWS_INPUT_SQL_MAX_LEN)
|
||||
? MAXROWS_INPUT_SQL_MAX_LEN : sql_len;
|
||||
sql_len = (sql_len > MAXROWS_INPUT_SQL_MAX_LEN) ?
|
||||
MAXROWS_INPUT_SQL_MAX_LEN : sql_len;
|
||||
uint8_t sql[sql_len];
|
||||
|
||||
mxb_assert(csdata->res.data != NULL);
|
||||
|
@ -585,8 +585,8 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
|
||||
my_instance->rconn_intv = 1;
|
||||
|
||||
my_instance->port = config_get_integer(params, "port");
|
||||
my_instance->trgtype
|
||||
= static_cast<log_trigger_t>(config_get_enum(params, "logging_trigger", trigger_values));
|
||||
my_instance->trgtype =
|
||||
static_cast<log_trigger_t>(config_get_enum(params, "logging_trigger", trigger_values));
|
||||
my_instance->log_all = config_get_bool(params, "logging_log_all");
|
||||
my_instance->strict_logging = config_get_bool(params, "logging_strict");
|
||||
my_instance->hostname = MXS_STRDUP_A(config_get_string(params, "hostname"));
|
||||
|
@ -122,16 +122,16 @@ int RegexHintFSession::routeQuery(GWBUF* queue)
|
||||
{
|
||||
if (modutil_extract_SQL(queue, &sql, &sql_len))
|
||||
{
|
||||
const RegexToServers* reg_serv
|
||||
= m_fil_inst.find_servers(sql, sql_len, m_match_data);
|
||||
const RegexToServers* reg_serv =
|
||||
m_fil_inst.find_servers(sql, sql_len, m_match_data);
|
||||
|
||||
if (reg_serv)
|
||||
{
|
||||
/* Add the servers in the list to the buffer routing hints */
|
||||
for (const auto& target : reg_serv->m_targets)
|
||||
{
|
||||
queue->hint
|
||||
= hint_create_route(queue->hint, reg_serv->m_htype, target.c_str());
|
||||
queue->hint =
|
||||
hint_create_route(queue->hint, reg_serv->m_htype, target.c_str());
|
||||
}
|
||||
m_n_diverted++;
|
||||
m_fil_inst.m_total_diverted++;
|
||||
@ -315,12 +315,12 @@ RegexHintFilter* RegexHintFilter::create(const char* name, MXS_CONFIG_PARAMETER*
|
||||
{
|
||||
RegexHintFilter* instance = NULL;
|
||||
std::string user(config_get_string(params, "user"));
|
||||
MXS_EXCEPTION_GUARD(instance
|
||||
= new RegexHintFilter(user,
|
||||
source_addresses,
|
||||
source_hostnames,
|
||||
mapping,
|
||||
max_capcount + 1));
|
||||
MXS_EXCEPTION_GUARD(instance =
|
||||
new RegexHintFilter(user,
|
||||
source_addresses,
|
||||
source_hostnames,
|
||||
mapping,
|
||||
max_capcount + 1));
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
@ -570,13 +570,13 @@ bool RegexHintFilter::regex_compile_and_add(int pcre_ops,
|
||||
bool success = true;
|
||||
int errorcode = -1;
|
||||
PCRE2_SIZE error_offset = -1;
|
||||
pcre2_code* regex
|
||||
= pcre2_compile((PCRE2_SPTR) match.c_str(),
|
||||
match.length(),
|
||||
pcre_ops,
|
||||
&errorcode,
|
||||
&error_offset,
|
||||
NULL);
|
||||
pcre2_code* regex =
|
||||
pcre2_compile((PCRE2_SPTR) match.c_str(),
|
||||
match.length(),
|
||||
pcre_ops,
|
||||
&errorcode,
|
||||
&error_offset,
|
||||
NULL);
|
||||
|
||||
if (regex)
|
||||
{
|
||||
|
@ -260,8 +260,8 @@ static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((my_instance->match_data
|
||||
= pcre2_match_data_create_from_pattern(my_instance->re, NULL)) == NULL)
|
||||
if ((my_instance->match_data =
|
||||
pcre2_match_data_create_from_pattern(my_instance->re, NULL)) == NULL)
|
||||
{
|
||||
MXS_ERROR("Failure to create PCRE2 matching data. "
|
||||
"This is most likely caused by a lack of available memory.");
|
||||
|
@ -286,8 +286,8 @@ static MXS_FILTER_SESSION* newSession(MXS_FILTER* instance, MXS_SESSION* session
|
||||
|
||||
if ((my_session = static_cast<TOPN_SESSION*>(MXS_CALLOC(1, sizeof(TOPN_SESSION)))) != NULL)
|
||||
{
|
||||
if ((my_session->filename
|
||||
= (char*) MXS_MALLOC(strlen(my_instance->filebase) + 20))
|
||||
if ((my_session->filename =
|
||||
(char*) MXS_MALLOC(strlen(my_instance->filebase) + 20))
|
||||
== NULL)
|
||||
{
|
||||
MXS_FREE(my_session);
|
||||
|
Reference in New Issue
Block a user