summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-10-16 23:01:32 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-10-16 23:01:32 (GMT)
commitec6aa436f4a1ae486feb7a88b2b8e793b59674d4 (patch)
tree49798a3502c3e4c807d48a41c11289850024959a /src/analysis
parent6d34dbbb00da0c276261d0e1ce4bf862f22fd8e0 (diff)
Allowed log messages from every thread contexts.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@415 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c4
-rw-r--r--src/analysis/db/client.c21
-rw-r--r--src/analysis/db/client.h2
3 files changed, 20 insertions, 7 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 0fcbe0d..18dca8c 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -281,7 +281,9 @@ GLoadedBinary *g_loaded_binary_new_from_xml(xmlXPathContextPtr context, const ch
g_checksum_update(result->checksum, result->bin_data, result->bin_length);
- result->local = g_db_client_new(g_loaded_binary_get_cheksum(result), result->collections);
+ result->local = g_db_client_new(g_loaded_binary_get_name(result, false),
+ g_loaded_binary_get_cheksum(result),
+ result->collections);
if (!g_generic_config_get_value(get_main_configuration(), MPK_LOCAL_HOST, &host))
diff --git a/src/analysis/db/client.c b/src/analysis/db/client.c
index 71df99c..c19a39e 100644
--- a/src/analysis/db/client.c
+++ b/src/analysis/db/client.c
@@ -32,6 +32,9 @@
#include <sys/socket.h>
+#include <i18n.h>
+
+
#include "protocol.h"
#include "misc/rlestr.h"
#include "../../common/io.h"
@@ -44,6 +47,8 @@ struct _GDbClient
{
GObject parent; /* A laisser en premier */
+ const char *name; /* Désignation du binaire */
+
rle_string hash; /* Empreinte du binaire lié */
GList *collections; /* Collections d'un binaire */
@@ -145,7 +150,8 @@ static void g_db_client_finalize(GDbClient *client)
/******************************************************************************
* *
-* Paramètres : hash = empreinte d'un binaire en cours d'analyse. *
+* Paramètres : name = désignation humaine du binaire associé. *
+* hash = empreinte d'un binaire en cours d'analyse. *
* collections = ensemble de collections existantes. *
* *
* Description : Prépare un client pour une connexion à une BD. *
@@ -156,12 +162,14 @@ static void g_db_client_finalize(GDbClient *client)
* *
******************************************************************************/
-GDbClient *g_db_client_new(const char *hash, GDbCollection *collections)
+GDbClient *g_db_client_new(const char *name, const char *hash, GDbCollection *collections)
{
GDbClient *result; /* Adresse à retourner */
result = g_object_new(G_TYPE_DB_CLIENT, NULL);
+ result->name = name;
+
set_rle_string(&result->hash, hash);
result->collections = collections;
@@ -361,9 +369,12 @@ static void *g_db_client_update(GDbClient *client)
error = be32toh(val32);
- printf("## CLIENT ## Saved ? %d\n", error);
-
-
+ if (error == DBE_NONE)
+ log_variadic_message(LMT_INFO, _("Archive saved for binary '%s'"),
+ client->name);
+ else
+ log_variadic_message(LMT_ERROR, _("Failed to save the archive for binary '%s'"),
+ client->name);
break;
diff --git a/src/analysis/db/client.h b/src/analysis/db/client.h
index 963744b..66ebb08 100644
--- a/src/analysis/db/client.h
+++ b/src/analysis/db/client.h
@@ -51,7 +51,7 @@ typedef struct _GDbClientClass GDbClientClass;
GType g_db_client_get_type(void);
/* Prépare un client pour une connexion à une BD. */
-GDbClient *g_db_client_new(const char *, GDbCollection *);
+GDbClient *g_db_client_new(const char *, const char *, GDbCollection *);
/* Démarre la connexion à la base de données. */
bool g_db_client_start(GDbClient *, const char *, unsigned short, const char *);