diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-02-17 21:27:52 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-02-17 21:27:52 (GMT) |
commit | 3ba750662837541a5df510046c0a3fc521cca785 (patch) | |
tree | 711f412439e4b0d154207bbcbceeafce5f1b0864 /src/analysis/binary.c | |
parent | 5c6680287b4b6ba38cc04e6d7cb80c87cb9e256d (diff) |
Defined, computed and stored the checksum in the binary content manager.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@474 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/binary.c')
-rw-r--r-- | src/analysis/binary.c | 76 |
1 files changed, 7 insertions, 69 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 911e239..b94071c 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -179,9 +179,6 @@ static void g_loaded_binary_init(GLoadedBinary *binary) static void g_loaded_binary_dispose(GLoadedBinary *binary) { - if (binary->checksum != NULL) - g_checksum_free(binary->checksum); - if (binary->format != NULL) g_object_unref(G_OBJECT(binary->format)); if (binary->proc != NULL) @@ -237,14 +234,6 @@ GLoadedBinary *g_loaded_binary_new_from_xml(xmlXPathContextPtr context, const ch - char *host; /* Nom du serveur à contacter */ - int port; /* Numéro du port associé */ - char *author; /* Identification à diffuser */ - - - - bool status; /* Etat de la connexion à la BD*/ - result = NULL; type = get_node_prop_value(context, path, "type"); @@ -272,36 +261,6 @@ GLoadedBinary *g_loaded_binary_new_from_xml(xmlXPathContextPtr context, const ch - - printf("data :: %p length :: %d\n", result->bin_data, result->bin_length); - - - - /* Détermination de l'identifiant */ - - result->checksum = g_checksum_new(G_CHECKSUM_SHA256); - g_checksum_update(result->checksum, result->bin_data, result->bin_length); - - - 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)) - /* ... */; - - if (!g_generic_config_get_value(get_main_configuration(), MPK_LOCAL_PORT, &port)) - /* ... */; - - if (!g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &author)) - /* ... */; - - - status = g_db_client_start(result->local, host, port, author); - - printf("DB status :: %d\n", status); - return result; glbnfx_error: @@ -716,6 +675,9 @@ bool g_loaded_binary_connect(GLoadedBinary *binary) { bool result; /* Bilan à retourner */ + GBinContent *content; /* Contenu bianire manipulé */ + const gchar *checksum; /* Identifiant de binaire */ + char *host; /* Nom du serveur à contacter */ int port; /* Numéro du port associé */ char *author; /* Identification à diffuser */ @@ -724,13 +686,11 @@ bool g_loaded_binary_connect(GLoadedBinary *binary) /* Détermination de l'identifiant */ - - binary->checksum = g_checksum_new(G_CHECKSUM_SHA256); - g_checksum_update(binary->checksum, binary->bin_data, binary->bin_length); - + content = g_binary_format_get_conten_(G_BIN_FORMAT(binary->format)); + checksum = g_binary_content_get_cheksum(content); binary->local = g_db_client_new(g_loaded_binary_get_name(binary, false), - g_loaded_binary_get_cheksum(binary), + checksum, binary->collections); @@ -867,10 +827,7 @@ void g_loaded_binary_analyse(GLoadedBinary *binary) { /* Détermination de l'identifiant */ - /* déplacé - binary->checksum = g_checksum_new(G_CHECKSUM_SHA256); - g_checksum_update(binary->checksum, binary->bin_data, binary->bin_length); - */ + /* Contacts avec les serveurs */ @@ -909,25 +866,6 @@ const char *g_loaded_binary_get_name(const GLoadedBinary *binary, bool full) /****************************************************************************** * * * Paramètres : binary = élément binaire à consulter. * -* * -* Description : Fournit une empreinte unique (SHA256) pour le binaire. * -* * -* Retour : Chaîne représentant l'empreinte du binaire. * -* * -* Remarques : - * -* * -******************************************************************************/ - -const gchar *g_loaded_binary_get_cheksum(const GLoadedBinary *binary) -{ - return g_checksum_get_string(binary->checksum); - -} - - -/****************************************************************************** -* * -* Paramètres : binary = élément binaire à consulter. * * length = taille en octets des données chargées. [OUT] * * * * Description : Fournit les détails du contenu binaire chargé en mémoire. * |