Implement transition from individual domain lists into a unified domainlist (see core PR #3015).

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-12-02 17:39:00 +00:00
parent 5385098dc8
commit 257fcbf695
3 changed files with 49 additions and 39 deletions
+10 -10
View File
@@ -172,17 +172,17 @@ static int api_dns_somelist_POST(struct mg_connection *conn,
}
const char *domain = elem->valuestring;
const char *table;
int table;
if(whitelist)
if(store_exact)
table = "whitelist";
table = GRAVITY_DOMAINLIST_EXACT_WHITELIST;
else
table = "regex_whitelist";
table = GRAVITY_DOMAINLIST_REGEX_WHITELIST;
else
if(store_exact)
table = "blacklist";
table = GRAVITY_DOMAINLIST_EXACT_BLACKLIST;
else
table = "regex_blacklist";
table = GRAVITY_DOMAINLIST_REGEX_BLACKLIST;
cJSON *json = JSON_NEW_OBJ();
if(gravityDB_addToTable(table, domain))
@@ -215,17 +215,17 @@ static int api_dns_somelist_DELETE(struct mg_connection *conn,
// Decode URL (necessar for regular expressions, harmless for domains)
mg_url_decode(encoded_uri, strlen(encoded_uri), domain, sizeof(domain)-1u, 0);
const char *table;
int table;
if(whitelist)
if(store_exact)
table = "whitelist";
table = GRAVITY_DOMAINLIST_EXACT_WHITELIST;
else
table = "regex_whitelist";
table = GRAVITY_DOMAINLIST_REGEX_WHITELIST;
else
if(store_exact)
table = "blacklist";
table = GRAVITY_DOMAINLIST_EXACT_BLACKLIST;
else
table = "regex_blacklist";
table = GRAVITY_DOMAINLIST_REGEX_BLACKLIST;
cJSON *json = JSON_NEW_OBJ();
if(gravityDB_delFromTable(table, domain))