summaryrefslogtreecommitdiff
path: root/src/analysis/binary.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-09-05 22:53:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-09-05 22:53:24 (GMT)
commit1a85f36e0505d75a51ab7b7f2c5078da7ef6bd98 (patch)
treea9a7d542f0ed00f418b61122a27ec9f1927e646f /src/analysis/binary.c
parent3d65cfcb6403d169b52045a9e5c242ad081539a7 (diff)
Made server connections easier while running analysis.
Diffstat (limited to 'src/analysis/binary.c')
-rw-r--r--src/analysis/binary.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index ec129b1..cf680c3 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -44,7 +44,6 @@
#include "../common/cpp.h"
#include "../common/xdg.h"
#include "../core/collections.h"
-#include "../core/global.h"
#include "../core/logs.h"
#include "../core/params.h"
#include "../core/processors.h"
@@ -169,7 +168,7 @@ static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *);
static const char *g_loaded_binary_get_format_name(const GLoadedBinary *);
/* Assure le désassemblage en différé. */
-static bool g_loaded_binary_analyze(GLoadedBinary *, bool, wgroup_id_t, GtkStatusStack *);
+static bool g_loaded_binary_analyze(GLoadedBinary *, bool, bool, wgroup_id_t, GtkStatusStack *);
/* Prend note d'une variation des instructions désassemblées. */
static void on_binary_processor_changed(GArchProcessor *, GArchInstruction *, gboolean, GLoadedBinary *);
@@ -1088,23 +1087,30 @@ bool _g_loaded_binary_add_to_collection(GLoadedBinary *binary, GDbItem *item, bo
if (storage == DBS_ALL_REMOTE)
client = binary->remote;
else
- client = NULL;
+ client = binary->local;
if (client == NULL)
- client = binary->local;
+ {
+ log_simple_message(LMT_ERROR, _("No connection to a server in order to forward the item"));
+ result = false;
+ }
- init_packed_buffer(&out_pbuf);
+ else
+ {
+ init_packed_buffer(&out_pbuf);
- fd = g_hub_client_get_fd(client);
+ fd = g_hub_client_get_fd(client);
- result = g_db_collection_pack(collec, &out_pbuf, DBA_ADD_ITEM, item);
+ result = g_db_collection_pack(collec, &out_pbuf, DBA_ADD_ITEM, item);
- g_hub_client_put_fd(client);
+ g_hub_client_put_fd(client);
- if (result)
- result = send_packed_buffer(&out_pbuf, fd);
+ if (result)
+ result = send_packed_buffer(&out_pbuf, fd);
- exit_packed_buffer(&out_pbuf);
+ exit_packed_buffer(&out_pbuf);
+
+ }
}
@@ -1645,10 +1651,11 @@ static const char *g_loaded_binary_get_format_name(const GLoadedBinary *binary)
/******************************************************************************
* *
-* Paramètres : binary = élément chargé dont l'analyse est lancée. *
-* cache = précise si la préparation d'un rendu est demandée. *
-* gid = groupe de travail dédié. *
-* status = barre de statut à tenir informée. *
+* Paramètres : binary = élément chargé dont l'analyse est lancée. *
+* connect = organise le lancement des connexions aux serveurs. *
+* cache = précise si la préparation d'un rendu est demandée. *
+* gid = groupe de travail dédié. *
+* status = barre de statut à tenir informée. *
* *
* Description : Assure le désassemblage en différé. *
* *
@@ -1658,7 +1665,7 @@ static const char *g_loaded_binary_get_format_name(const GLoadedBinary *binary)
* *
******************************************************************************/
-static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool cache, wgroup_id_t gid, GtkStatusStack *status)
+static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool connect, bool cache, wgroup_id_t gid, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
GBinFormat *format; /* Format lié au binaire */
@@ -1715,7 +1722,7 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool cache, wgroup_id
/* Phase de désassemblage pur */
- if (!is_batch_mode())
+ if (connect)
g_loaded_binary_connect_internal(binary);
disassemble_binary(binary, gid, status, &context);