Preparing SAVE MYSQL FIREWALL FROM RUNTIME

pull/2403/head
René Cannaò 7 years ago
parent 27284444dd
commit 94f27716b7

@ -350,6 +350,7 @@ class Query_Processor {
unsigned long long get_mysql_firewall_memory_users_config();
unsigned long long get_mysql_firewall_memory_rules_table();
unsigned long long get_mysql_firewall_memory_rules_config();
void get_current_mysql_firewall_whitelist(SQLite3_result **u, SQLite3_result **r);
};
typedef Query_Processor * create_Query_Processor_t();

@ -7522,7 +7522,24 @@ void ProxySQL_Admin::save_mysql_query_rules_from_runtime(bool _runtime) {
}
void ProxySQL_Admin::save_mysql_firewall_from_runtime(bool _runtime) {
// FIXME: to be completed
if (_runtime) {
admindb->execute("DELETE FROM runtime_mysql_firewall_whitelist_rules");
admindb->execute("DELETE FROM runtime_mysql_firewall_whitelist_users");
} else {
admindb->execute("DELETE FROM mysql_firewall_whitelist_rules");
admindb->execute("DELETE FROM mysql_firewall_whitelist_users");
}
SQLite3_result * resultset_rules = NULL;
SQLite3_result * resultset_users = NULL;
GloQPro->get_current_mysql_firewall_whitelist(&resultset_users, &resultset_rules);
if (resultset_users) {
delete resultset_users;
}
if (resultset_rules) {
delete resultset_rules;
}
}
void ProxySQL_Admin::flush_admin_variables___runtime_to_database(SQLite3DB *db, bool replace, bool del, bool onlyifempty, bool runtime) {

@ -2891,6 +2891,17 @@ int Query_Processor::testing___find_HG_in_mysql_query_rules_fast_routing(char *u
return ret;
}
void Query_Processor::get_current_mysql_firewall_whitelist(SQLite3_result **u, SQLite3_result **r) {
pthread_mutex_lock(&global_mysql_firewall_whitelist_mutex);
if (global_mysql_firewall_whitelist_rules_runtime) {
*r = new SQLite3_result(global_mysql_firewall_whitelist_rules_runtime);
}
if (global_mysql_firewall_whitelist_users_runtime) {
*u = new SQLite3_result(global_mysql_firewall_whitelist_users_runtime);
}
pthread_mutex_unlock(&global_mysql_firewall_whitelist_mutex);
}
void Query_Processor::load_mysql_firewall(SQLite3_result *u, SQLite3_result *r) {
pthread_mutex_lock(&global_mysql_firewall_whitelist_mutex);
if (global_mysql_firewall_whitelist_rules_runtime) {

Loading…
Cancel
Save