JSON: check the source id, not the server id.

This commit is contained in:
Ian Gulliver
2016-02-26 21:14:28 -08:00
parent 7d83d122df
commit c315de6354

View File

@@ -99,10 +99,6 @@ static bool json_parse_header(json_t *in, struct packet *packet, struct json_par
state->mlat_timestamp_max = (uint64_t) mlat_timestamp_max; state->mlat_timestamp_max = (uint64_t) mlat_timestamp_max;
state->rssi_max = (uint32_t) rssi_max; state->rssi_max = (uint32_t) rssi_max;
if (!packet_validate_id((const uint8_t *) json_server_id)) {
return false;
}
if (!strcmp(json_server_id, (const char *) server_id)) { if (!strcmp(json_server_id, (const char *) server_id)) {
fprintf(stderr, "R %s: Attempt to receive json data from our own server ID (%s); loop!\n", packet->source_id, server_id); fprintf(stderr, "R %s: Attempt to receive json data from our own server ID (%s); loop!\n", packet->source_id, server_id);
return false; return false;
@@ -124,6 +120,10 @@ static bool json_parse_common(json_t *in, struct packet *packet, struct json_par
return false; return false;
} }
if (!packet_validate_id(packet->source_id)) {
return false;
}
json_t *mlat_timestamp = json_object_get(in, "mlat_timestamp"); json_t *mlat_timestamp = json_object_get(in, "mlat_timestamp");
if (mlat_timestamp && json_is_integer(mlat_timestamp)) { if (mlat_timestamp && json_is_integer(mlat_timestamp)) {
json_int_t val = json_integer_value(mlat_timestamp); json_int_t val = json_integer_value(mlat_timestamp);