Recheck statements in forks to avoid edge-case collisions possibly leading to a crash in heavy TCP worker activity

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2023-12-27 19:08:36 +01:00
parent 7c29048009
commit e022600fef
+15
View File
@@ -1244,6 +1244,11 @@ enum db_result in_allowlist(const char *domain, DNSCacheData *dns_cache, clients
// Check if this client needs a rechecking of group membership
gravityDB_client_check_again(client);
// Check again as the client may have been reloaded if this is a TCP
// worker
if(whitelist_stmt == NULL)
return LIST_NOT_AVAILABLE;
// Get whitelist statement from vector of prepared statements if available
sqlite3_stmt *stmt = whitelist_stmt->get(whitelist_stmt, client->id);
@@ -1377,6 +1382,11 @@ enum db_result in_gravity(const char *domain, clientsData *client, const bool an
// Check if this client needs a rechecking of group membership
gravityDB_client_check_again(client);
// Check again as the client may have been reloaded if this is a TCP
// worker
if(gravity_stmt == NULL || antigravity_stmt == NULL)
return LIST_NOT_AVAILABLE;
// Get whitelist statement from vector of prepared statements
sqlite3_stmt *stmt = antigravity ?
antigravity_stmt->get(antigravity_stmt, client->id) :
@@ -1451,6 +1461,11 @@ enum db_result in_denylist(const char *domain, DNSCacheData *dns_cache, clientsD
// Check if this client needs a rechecking of group membership
gravityDB_client_check_again(client);
// Check again as the client may have been reloaded if this is a TCP
// worker
if(blacklist_stmt == NULL)
return LIST_NOT_AVAILABLE;
// Get whitelist statement from vector of prepared statements
sqlite3_stmt *stmt = blacklist_stmt->get(blacklist_stmt, client->id);