summaryrefslogtreecommitdiff
path: root/src/analysis/db/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/db/server.c')
-rw-r--r--src/analysis/db/server.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index b08962c..79d5df1 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -1028,7 +1028,7 @@ static GServerBackend *g_hub_server_handle_admin(GHubServer *server, packed_buff
if (has_more_data_in_packed_buffer(in_pbuf))
{
- log_variadic_message(LMT_ERROR, _("The client from '%s' provided to much data!"), peer_name);
+ log_variadic_message(LMT_ERROR, _("The client from '%s' provided too much data!"), peer_name);
result = NULL;
@@ -1074,6 +1074,7 @@ static GServerBackend *g_hub_server_handle_analyst(GHubServer *server, packed_bu
{
GCdbArchive *result; /* Support de suivi à retourner*/
rle_string hash; /* Empreinte du binaire visé */
+ rle_string class; /* Nature du contenu visé */
bool status; /* Bilan d'une opération */
GList *iter; /* Boucle de parcours */
GCdbArchive *archive; /* Destinataire final du client*/
@@ -1087,6 +1088,8 @@ static GServerBackend *g_hub_server_handle_analyst(GHubServer *server, packed_bu
/* Fin de réception des données envoyées */
+ setup_empty_rle_string(&hash);
+
status = unpack_rle_string(&hash, in_pbuf);
if (!status)
{
@@ -1097,13 +1100,28 @@ static GServerBackend *g_hub_server_handle_analyst(GHubServer *server, packed_bu
if (is_rle_string_empty(&hash))
{
log_variadic_message(LMT_ERROR, _("The submitted binary hash from '%s' is empty!"), peer_name);
- goto wrong_receiving;
+ goto wrong_receiving_0;
+ }
+
+ setup_empty_rle_string(&class);
+
+ status = unpack_rle_string(&class, in_pbuf);
+ if (!status)
+ {
+ log_variadic_message(LMT_ERROR, _("Error while getting the content class from '%s'..."), peer_name);
+ goto wrong_receiving_0;
+ }
+
+ if (is_rle_string_empty(&class))
+ {
+ log_variadic_message(LMT_ERROR, _("The submitted content class from '%s' is empty!"), peer_name);
+ goto wrong_receiving_1;
}
if (has_more_data_in_packed_buffer(in_pbuf))
{
- log_variadic_message(LMT_ERROR, _("The client from '%s' provided to much data!"), peer_name);
- goto wrong_receiving;
+ log_variadic_message(LMT_ERROR, _("The client from '%s' provided too much data!"), peer_name);
+ goto wrong_receiving_1;
}
/* Recherche d'un support existant adapté */
@@ -1114,7 +1132,7 @@ static GServerBackend *g_hub_server_handle_analyst(GHubServer *server, packed_bu
{
archive = G_CDB_ARCHIVE(iter->data);
- if (g_cdb_archive_compare_hash(archive, &hash) == 0)
+ if (g_cdb_archive_compare_is_suitable_for(archive, &hash, &class))
break;
}
@@ -1137,7 +1155,7 @@ static GServerBackend *g_hub_server_handle_analyst(GHubServer *server, packed_bu
tmpdir = strdup(server->working);
tmpdir = stradd(tmpdir, "tmp" G_DIR_SEPARATOR_S);
- result = g_cdb_archive_new(basedir, tmpdir, &hash, error);
+ result = g_cdb_archive_new(basedir, tmpdir, &hash, &class, error);
free(tmpdir);
free(basedir);
@@ -1146,7 +1164,11 @@ static GServerBackend *g_hub_server_handle_analyst(GHubServer *server, packed_bu
}
- wrong_receiving:
+ wrong_receiving_1:
+
+ exit_rle_string(&class);
+
+ wrong_receiving_0:
exit_rle_string(&hash);