summaryrefslogtreecommitdiff
path: root/src/analysis/binary.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-09-29 20:57:16 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-09-29 20:57:16 (GMT)
commit55bc8570f25a479b222733c4093f9ae996c9f68e (patch)
tree258773ab9cbcab5ec459527f3b3a40bf2897ce00 /src/analysis/binary.c
parent2de826110c85feb68d6e5b09c133e2300ae4c0d0 (diff)
Handled disabled update items.
Diffstat (limited to 'src/analysis/binary.c')
-rw-r--r--src/analysis/binary.c90
1 files changed, 32 insertions, 58 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index fb715bb..61dbbf1 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -1056,12 +1056,10 @@ GDbCollection *g_loaded_binary_find_collection(const GLoadedBinary *binary, DBFe
}
-
/******************************************************************************
* *
* Paramètres : binary = élément binaire à consulter. *
* item = élémnent à pousser vers un serveur de collection. *
-* lock = indique si le verrou d'écriture doit être posé. *
* *
* Description : Demande l'intégration d'une modification dans une collection.*
* *
@@ -1071,84 +1069,44 @@ GDbCollection *g_loaded_binary_find_collection(const GLoadedBinary *binary, DBFe
* *
******************************************************************************/
-bool _g_loaded_binary_add_to_collection(GLoadedBinary *binary, GDbItem *item, bool lock)
+bool g_loaded_binary_add_to_collection(GLoadedBinary *binary, GDbItem *item)
{
bool result; /* Bilan à faire remonter */
DBFeatures feature; /* Domaine de fonctionnalité */
- GDbCollection *collec; /* Collection visée au final */
DBStorage storage; /* Forme d'enregistrement */
GHubClient *client; /* Liaison à utiliser */
- packed_buffer out_pbuf; /* Tampon d'émission */
- SSL *tls_fd; /* Canal de communication SSL */
feature = g_db_item_get_feature(item);
- collec = g_loaded_binary_find_collection(binary, feature);
- if (collec == NULL) return false;
-
- /* S'il n'y a pas besoin de sauvegarde... */
- if (g_db_item_get_flags(item) & DIF_VOLATILE)
- result = _g_db_collection_add_item(collec, item, lock);
+ storage = g_loaded_binary_get_storage(binary, feature);
- /* Sinon on envoie par le réseau ! */
+ if (storage == DBS_ALL_REMOTE)
+ client = binary->remote;
else
- {
- storage = g_loaded_binary_get_storage(binary, feature);
-
- if (storage == DBS_ALL_REMOTE)
- client = binary->remote;
- else
- client = binary->local;
-
- if (client == NULL)
- {
- log_simple_message(LMT_ERROR, _("No connection to a server in order to forward the item"));
- result = false;
- }
-
- else
- {
- init_packed_buffer(&out_pbuf);
-
- tls_fd = g_hub_client_get_ssl_fd(client);
-
- if (tls_fd == NULL)
- result = false;
-
- else
- {
- result = g_db_collection_pack(collec, &out_pbuf, DBA_ADD_ITEM, item);
-
- if (result)
- result = ssl_send_packed_buffer(&out_pbuf, tls_fd);
-
- g_hub_client_put_ssl_fd(client, tls_fd);
-
- }
-
- exit_packed_buffer(&out_pbuf);
-
- }
-
- g_object_unref(G_OBJECT(item));
+ client = binary->local;
+ if (client == NULL)
+ {
+ log_simple_message(LMT_ERROR, _("No connection to a server in order to forward the item"));
+ result = false;
}
- g_object_unref(G_OBJECT(collec));
+ else
+ result = g_hub_client_add_item(client, item);
+
+ g_object_unref(G_OBJECT(item));
return result;
}
-
-
/******************************************************************************
* *
* Paramètres : binary = élément binaire à consulter. *
* timestamp = date du dernier élément à garder comme actif. *
* *
-* Description : Active les éléments en amont d'un horodatage donné. XXXXXXXXXXXXXXXXX *
+* Description : Spécifie la bordure temporelle limite des activations. *
* *
* Retour : true si la commande a bien été envoyée, false sinon. *
* *
@@ -1159,12 +1117,28 @@ bool _g_loaded_binary_add_to_collection(GLoadedBinary *binary, GDbItem *item, bo
bool g_loaded_binary_set_last_active(GLoadedBinary *binary, timestamp_t timestamp)
{
bool result; /* Bilan à retourner */
+ bool done; /* Suivi des actions menées */
+ result = true;
+ done = false;
- result = false;
-
+ if (binary->local != NULL)
+ {
+ result = g_hub_client_set_last_active(binary->local, timestamp);
+ done = true;
+ }
+ if (result && binary->remote != NULL)
+ {
+ result = g_hub_client_set_last_active(binary->remote, timestamp);
+ done = true;
+ }
+ if (!done)
+ {
+ log_simple_message(LMT_ERROR, _("No connection to a server found in order to set timestamp"));
+ result = false;
+ }
return result;