v0.7.5 - Complete debug logging cleanup - remove all remaining DEBUG messages from websockets.c, config.c, and dm_admin.c
This commit is contained in:
49
src/config.c
49
src/config.c
@@ -1791,9 +1791,7 @@ int process_configuration_event(const cJSON* event) {
|
||||
log_error("Invalid configuration event");
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_info("Processing configuration event...");
|
||||
|
||||
|
||||
// Validate event structure
|
||||
cJSON* kind_obj = cJSON_GetObjectItem(event, "kind");
|
||||
cJSON* pubkey_obj = cJSON_GetObjectItem(event, "pubkey");
|
||||
@@ -2262,22 +2260,10 @@ int process_admin_event_in_config(cJSON* event, char* error_message, size_t erro
|
||||
}
|
||||
|
||||
int kind = (int)cJSON_GetNumberValue(kind_obj);
|
||||
printf(" Event kind: %d\n", kind);
|
||||
|
||||
// Extract and log event details for debugging
|
||||
// Get event pubkey for authorization logging
|
||||
cJSON* pubkey_obj = cJSON_GetObjectItem(event, "pubkey");
|
||||
cJSON* content_obj = cJSON_GetObjectItem(event, "content");
|
||||
cJSON* tags_obj = cJSON_GetObjectItem(event, "tags");
|
||||
|
||||
const char* event_pubkey = pubkey_obj ? cJSON_GetStringValue(pubkey_obj) : "unknown";
|
||||
const char* event_content = content_obj ? cJSON_GetStringValue(content_obj) : "unknown";
|
||||
|
||||
printf(" Pubkey: %.16s...\n", event_pubkey ? event_pubkey : "null");
|
||||
printf(" Content length: %zu\n", event_content ? strlen(event_content) : 0);
|
||||
printf(" Has tags: %s\n", tags_obj ? "yes" : "no");
|
||||
if (tags_obj && cJSON_IsArray(tags_obj)) {
|
||||
printf(" Tags count: %d\n", cJSON_GetArraySize(tags_obj));
|
||||
}
|
||||
const char* event_pubkey = pubkey_obj ? cJSON_GetStringValue(pubkey_obj) : NULL;
|
||||
|
||||
// DEFENSE-IN-DEPTH: Use comprehensive admin authorization validation
|
||||
if (!is_authorized_admin_event(event)) {
|
||||
@@ -2308,10 +2294,7 @@ int process_admin_event_in_config(cJSON* event, char* error_message, size_t erro
|
||||
int process_admin_config_event(cJSON* event, char* error_message, size_t error_size) {
|
||||
cJSON* kind_obj = cJSON_GetObjectItem(event, "kind");
|
||||
int kind = kind_obj ? (int)cJSON_GetNumberValue(kind_obj) : 0;
|
||||
|
||||
log_info("Processing admin configuration event");
|
||||
printf(" Kind: %d\n", kind);
|
||||
|
||||
|
||||
// Parse tags to find query commands according to API specification
|
||||
cJSON* tags_obj = cJSON_GetObjectItem(event, "tags");
|
||||
if (tags_obj && cJSON_IsArray(tags_obj)) {
|
||||
@@ -2407,8 +2390,6 @@ int process_admin_auth_event(cJSON* event, char* error_message, size_t error_siz
|
||||
cJSON* kind_obj = cJSON_GetObjectItem(event, "kind");
|
||||
int kind = kind_obj ? (int)cJSON_GetNumberValue(kind_obj) : 0;
|
||||
|
||||
printf(" Kind: %d\n", kind);
|
||||
|
||||
// Extract and log additional event details for debugging
|
||||
cJSON* content_obj = cJSON_GetObjectItem(event, "content");
|
||||
cJSON* tags_obj = cJSON_GetObjectItem(event, "tags");
|
||||
@@ -3072,9 +3053,6 @@ int handle_auth_query_unified(cJSON* event, const char* query_type, char* error_
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_info("Processing unified auth query");
|
||||
printf(" Query type: %s\n", query_type);
|
||||
|
||||
const char* sql = NULL;
|
||||
int use_pattern_param = 0;
|
||||
char* pattern_value = NULL;
|
||||
@@ -3193,9 +3171,6 @@ int handle_config_query_unified(cJSON* event, const char* query_type, char* erro
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_info("Processing unified config query");
|
||||
printf(" Query type: %s\n", query_type);
|
||||
|
||||
const char* sql = NULL;
|
||||
int use_pattern_param = 0;
|
||||
char* pattern_value = NULL;
|
||||
@@ -3320,10 +3295,6 @@ int handle_config_set_unified(cJSON* event, const char* config_key, const char*
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_info("Processing unified config set command");
|
||||
printf(" Key: %s\n", config_key);
|
||||
printf(" Value: %s\n", config_value);
|
||||
|
||||
// Validate the configuration field before updating
|
||||
char validation_error[512];
|
||||
if (validate_config_field(config_key, config_value, validation_error, sizeof(validation_error)) != 0) {
|
||||
@@ -3406,9 +3377,6 @@ int handle_system_command_unified(cJSON* event, const char* command, char* error
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_info("Processing unified system command");
|
||||
printf(" Command: %s\n", command);
|
||||
|
||||
if (strcmp(command, "clear_all_auth_rules") == 0) {
|
||||
// Count existing rules first
|
||||
const char* count_sql = "SELECT COUNT(*) FROM auth_rules";
|
||||
@@ -3772,9 +3740,6 @@ int handle_stats_query_unified(cJSON* event, char* error_message, size_t error_s
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_info("Processing unified stats query");
|
||||
printf(" Query type: stats_query\n");
|
||||
|
||||
// Build response with database statistics
|
||||
cJSON* response = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(response, "query_type", "stats_query");
|
||||
@@ -4009,11 +3974,6 @@ int handle_config_update_unified(cJSON* event, char* error_message, size_t error
|
||||
const char* category = category_obj && cJSON_IsString(category_obj) ?
|
||||
cJSON_GetStringValue(category_obj) : "general";
|
||||
|
||||
log_info("Processing config object");
|
||||
printf(" Key: %s\n", key);
|
||||
printf(" Value: %s\n", value);
|
||||
printf(" Data type: %s\n", data_type);
|
||||
printf(" Category: %s\n", category);
|
||||
|
||||
// Validate the configuration field before updating
|
||||
char validation_error[512];
|
||||
@@ -4571,7 +4531,6 @@ int process_startup_config_event(const cJSON* event) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
log_info("Processing startup configuration event through admin API...");
|
||||
|
||||
// Validate event structure first
|
||||
cJSON* kind_obj = cJSON_GetObjectItem(event, "kind");
|
||||
|
||||
Reference in New Issue
Block a user