From 14f1b8ff552dfb8aef6c66b3c65e816aa7820bb0 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Fri, 30 Aug 2019 00:16:59 +0200
Subject: Removed code relative to the old share server version.

---
 .gitignore                  |   1 -
 src/Makefile.am             |  16 +-
 src/analysis/Makefile.am    |   1 -
 src/analysis/binary.c       |  79 ++---
 src/analysis/binary.h       |   4 +-
 src/analysis/db/Makefile.am |  16 +-
 src/analysis/db/item.c      |  14 +-
 src/analysis/db/keymgn.c    | 707 --------------------------------------------
 src/analysis/db/keymgn.h    |  81 -----
 src/core/core.c             |   3 -
 src/core/logs.h             |  10 +-
 src/core/params.c           | 118 --------
 src/core/params.h           |  15 -
 src/csrvmng.c               | 369 -----------------------
 src/gui/dialogs/identity.c  |   7 +-
 15 files changed, 37 insertions(+), 1404 deletions(-)
 delete mode 100644 src/analysis/db/keymgn.c
 delete mode 100644 src/analysis/db/keymgn.h
 delete mode 100644 src/csrvmng.c

diff --git a/.gitignore b/.gitignore
index 9f7a214..e48ad9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,7 +69,6 @@ resources.[ch]
 # Binaries
 src/chrysalide
 src/chrysalide-hub
-src/csrvmng
 tools/d2c/d2c
 
 # Misc
diff --git a/src/Makefile.am b/src/Makefile.am
index f1fc25c..30a043e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
 
 lib_LTLIBRARIES = libchrysacore.la
 
-bin_PROGRAMS = chrysalide chrysalide-hub csrvmng
+bin_PROGRAMS = chrysalide chrysalide-hub
 
 
 
@@ -75,20 +75,6 @@ chrysalide_hub_LDFLAGS = $(LIBGTK_LIBS) -L.libs -lchrysacore
 
 
 ############################################################
-# Gestionnaire de serveurs distants
-############################################################
-
-EXTRA_csrvmng_DEPENDENCIES = $(lib_LTLIBRARIES)
-
-csrvmng_SOURCES =						\
-	csrvmng.c
-
-
-csrvmng_LDFLAGS = $(LIBXML_LIBS) -L.libs -lchrysacore
-
-
-
-############################################################
 # Le reste du monde
 ############################################################
 
diff --git a/src/analysis/Makefile.am b/src/analysis/Makefile.am
index 39b960c..c1fbc9f 100644
--- a/src/analysis/Makefile.am
+++ b/src/analysis/Makefile.am
@@ -21,7 +21,6 @@ libanalysis_la_SOURCES =				\
 libanalysis_la_LIBADD =					\
 	contents/libanalysiscontents.la		\
 	db/libanalysisdb.la					\
-	db/libanalysiskeys.la				\
 	disass/libanalysisdisass.la			\
 	human/libanalysishuman.la			\
 	types/libanalysistypes.la
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 5ac8e04..ec129b1 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -70,7 +70,7 @@ struct _GLoadedBinary
 
     bool use_remote;                        /* Enregistrements distants ?  */
     char *remote_host;                      /* Nom du serveur distant      */
-    unsigned short remote_port;             /* Port du serveur distant     */
+    char *remote_port;                      /* Port du serveur distant     */
 
     GHubClient *local;                      /* Enregistrements locaux      */
     GHubClient *remote;                     /* Enregistrements distants    */
@@ -246,7 +246,7 @@ static void g_loaded_binary_init(GLoadedBinary *binary)
 
     binary->use_remote = false;
     binary->remote_host = strdup("localhost");
-    binary->remote_port = 1337;
+    binary->remote_port = strdup("1337");
 
     binary->storages[DBF_BOOKMARKS] = DBS_ALL_LOCAL;
     binary->storages[DBF_COMMENTS] = DBS_ALL_LOCAL;
@@ -446,7 +446,7 @@ static bool g_loaded_binary_load_storage(GLoadedBinary *binary, xmlXPathContext
     char *storage_path;                     /* Partie "Enregistrement"     */
     char *value;                            /* Valeur lue à partie du XML  */
     char *access;                           /* Chemin d'accès à un élément */
-    unsigned short port;                    /* Port de communication       */
+    char *port;                             /* Port de communication       */
     DBFeatures i;                           /* Boucle de parcours          */
 
     result = true;
@@ -484,17 +484,21 @@ static bool g_loaded_binary_load_storage(GLoadedBinary *binary, xmlXPathContext
     value = get_node_prop_value(context, access, "port");
     if (value == NULL) goto glbls_features;
 
-    port = atoi(value);
-
-    free(value);
+    port = value;
 
     value = get_node_prop_value(context, access, "host");
-    if (value == NULL) goto glbls_features;
+    if (value == NULL)
+    {
+        free(port);
+        goto glbls_features;
+    }
 
     g_loaded_binary_set_remote_server(binary, value, port);
 
     free(value);
 
+    free(port);
+
  glbls_features:
 
     free(access);
@@ -571,7 +575,6 @@ static bool g_loaded_binary_save_storage(const GLoadedBinary *binary, xmlDoc *xd
     bool result;                            /* Bilan à faire remonter      */
     char *storage_path;                     /* Partie "Enregistrement"     */
     char *access;                           /* Chemin d'accès à un élément */
-    char port_str[sizeof(XSTR(USHRT_MAX)) + 1]; /* Version chaînée          */
     DBFeatures i;                           /* Boucle de parcours          */
 
     result = true;
@@ -598,8 +601,7 @@ static bool g_loaded_binary_save_storage(const GLoadedBinary *binary, xmlDoc *xd
 
     result &= add_string_attribute_to_node(xdoc, context, access, "host", binary->remote_host);
 
-    sprintf(port_str, "%hu", binary->remote_port);
-    result &= add_string_attribute_to_node(xdoc, context, access, "port", port_str);
+    result &= add_string_attribute_to_node(xdoc, context, access, "port", binary->remote_port);
 
     free(access);
 
@@ -747,7 +749,7 @@ void g_loaded_binary_set_remote_storage_usage(GLoadedBinary *binary, bool use)
 *                                                                             *
 ******************************************************************************/
 
-void g_loaded_binary_get_remote_server(const GLoadedBinary *binary, const char **host, unsigned short *port)
+void g_loaded_binary_get_remote_server(const GLoadedBinary *binary, const char **host, const char **port)
 {
     *host = binary->remote_host;
     *port = binary->remote_port;
@@ -769,12 +771,13 @@ void g_loaded_binary_get_remote_server(const GLoadedBinary *binary, const char *
 *                                                                             *
 ******************************************************************************/
 
-void g_loaded_binary_set_remote_server(GLoadedBinary *binary, const char *host, unsigned short port)
+void g_loaded_binary_set_remote_server(GLoadedBinary *binary, const char *host, const char *port)
 {
     free(binary->remote_host);
     binary->remote_host = strdup(host);
 
-    binary->remote_port = port;
+    free(binary->remote_port);
+    binary->remote_port = strdup(port);
 
 }
 
@@ -835,25 +838,9 @@ void g_loaded_binary_set_storage(GLoadedBinary *binary, DBFeatures feature, DBSt
 static bool g_loaded_binary_connect_internal(GLoadedBinary *binary)
 {
     bool result;                            /* Bilan à retourner           */
-    const char *tmp;                        /* Stockage temporaire         */
-    char *author;                           /* Identification à diffuser   */
-    char *priv;                             /* Chemin de la clef privée    */
     GBinContent *content;                   /* Contenu bianire manipulé    */
     const gchar *checksum;                  /* Identifiant de binaire      */
 
-    result = false;
-
-    /* Utilisateur représenté */
-
-    if (!g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &tmp))
-        goto glbcl_exit;
-
-    author = strdup(tmp);
-
-    /* Chemin vers la clef privée */
-
-    priv = get_xdg_config_dir("chrysalide" G_DIR_SEPARATOR_S "id_rsa.priv");
-
     /* Détermination de l'identifiant */
 
     content = g_binary_format_get_content(G_BIN_FORMAT(binary->format));
@@ -862,15 +849,10 @@ static bool g_loaded_binary_connect_internal(GLoadedBinary *binary)
 
     /* Tentative de connexion */
 
-    binary->local = g_hub_client_new(/*author, priv,
-                                    g_loaded_binary_get_name(binary, false),
-                                     */checksum,
-                                    binary->collections);
+    binary->local = g_hub_client_new(checksum, binary->collections);
 
     result = g_hub_client_start_internal(binary->local);
 
- glbcl_exit:
-
     return result;
 
 }
@@ -891,27 +873,11 @@ static bool g_loaded_binary_connect_internal(GLoadedBinary *binary)
 static bool g_loaded_binary_connect_remote(GLoadedBinary *binary)
 {
     bool result;                            /* Bilan à retourner           */
-    const char *tmp;                        /* Stockage temporaire         */
-    char *author;                           /* Identification à diffuser   */
-    char *priv;                             /* Chemin de la clef privée    */
     GBinContent *content;                   /* Contenu bianire manipulé    */
     const gchar *checksum;                  /* Identifiant de binaire      */
 
-    result = false;
-
     assert(binary->remote == NULL);
 
-    /* Utilisateur représenté */
-
-    if (!g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &tmp))
-        goto glbcl_exit;
-
-    author = strdup(tmp);
-
-    /* Chemin vers la clef privée */
-
-    priv = get_xdg_config_dir("chrysalide" G_DIR_SEPARATOR_S "id_rsa.priv");
-
     /* Détermination de l'identifiant */
 
     content = g_binary_format_get_content(G_BIN_FORMAT(binary->format));
@@ -920,24 +886,19 @@ static bool g_loaded_binary_connect_remote(GLoadedBinary *binary)
 
     /* Tentative de connexion */
 
-    binary->remote = g_hub_client_new(/*author, priv,
-                                     g_loaded_binary_get_name(binary, false),
-                                     */checksum,
-                                     binary->collections);
+    binary->remote = g_hub_client_new(checksum, binary->collections);
 
-    result = g_hub_client_start_remote(binary->local, binary->remote_host, "1337", true);//binary->remote_port);
+    result = g_hub_client_start_remote(binary->local, binary->remote_host, binary->remote_port, true);
 
     if (!result)
     {
-        log_variadic_message(LMT_ERROR, _("Failed to connect to remote host '%s:%hu'"),
+        log_variadic_message(LMT_ERROR, _("Failed to connect to remote host '%s:%s'"),
                              binary->remote_host, binary->remote_port);
 
         g_clear_object(&binary->remote);
 
     }
 
- glbcl_exit:
-
     return result;
 
 }
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 2c57283..9b3aa6b 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -97,10 +97,10 @@ bool g_loaded_binary_use_remote_storage(const GLoadedBinary *);
 void g_loaded_binary_set_remote_storage_usage(GLoadedBinary *, bool);
 
 /* Identifie le serveur distant associé au binaire courant. */
-void g_loaded_binary_get_remote_server(const GLoadedBinary *, const char **, unsigned short *);
+void g_loaded_binary_get_remote_server(const GLoadedBinary *, const char **, const char **);
 
 /* Définit le serveur distant associé au binaire courant. */
-void g_loaded_binary_set_remote_server(GLoadedBinary *, const char *, unsigned short);
+void g_loaded_binary_set_remote_server(GLoadedBinary *, const char *, const char *);
 
 /* Indique la forme d'enregistrement d'une fonctionnalité. */
 DBStorage g_loaded_binary_get_storage(const GLoadedBinary *, DBFeatures);
diff --git a/src/analysis/db/Makefile.am b/src/analysis/db/Makefile.am
index 2f7cddd..b3616bd 100644
--- a/src/analysis/db/Makefile.am
+++ b/src/analysis/db/Makefile.am
@@ -1,5 +1,5 @@
 
-noinst_LTLIBRARIES  = libanalysisdb.la libanalysiskeys.la
+noinst_LTLIBRARIES  = libanalysisdb.la
 
 
 libanalysisdb_la_SOURCES =				\
@@ -18,7 +18,7 @@ libanalysisdb_la_LIBADD =				\
 	items/libanalysisdbitems.la			\
 	misc/libanalysisdbmisc.la
 
-libanalysisdb_la_LDFLAGS = 
+libanalysisdb_la_LDFLAGS = $(LIBSSL_LIBS)
 
 
 devdir = $(includedir)/chrysalide/$(subdir:src/%=%)
@@ -26,17 +26,7 @@ devdir = $(includedir)/chrysalide/$(subdir:src/%=%)
 dev_HEADERS = $(libanalysisdb_la_SOURCES:%c=)
 
 
-libanalysiskeys_la_SOURCES =			\
-	keymgn.h keymgn.c
-
-libanalysiskeys_la_LIBADD =
-
-libanalysiskeys_la_CFLAGS = $(LIBSSL_CFLAGS)
-
-libanalysiskeys_la_LDFLAGS = $(LIBSSL_LIBS)
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS)
+AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS) $(LIBSSL_CFLAGS)
 
 AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
 
diff --git a/src/analysis/db/item.c b/src/analysis/db/item.c
index 6fa168f..2bbc683 100644
--- a/src/analysis/db/item.c
+++ b/src/analysis/db/item.c
@@ -116,19 +116,7 @@ static void g_db_item_class_init(GDbItemClass *klass)
 
 static void g_db_item_init(GDbItem *item)
 {
-    const char *author;                     /* Identification à diffuser   */
-#ifndef NDEBUG
-    bool status;                            /* Bilan d'une obtention       */
-#endif
-
-#ifndef NDEBUG
-    status = g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &author);
-    assert(status);
-#else
-    g_generic_config_get_value(get_main_configuration(), MPK_AUTHOR_NAME, &author);
-#endif
-
-    set_static_rle_string(&item->author, author);
+    set_static_rle_string(&item->author, "");
 
     item->is_volatile = false;
 
diff --git a/src/analysis/db/keymgn.c b/src/analysis/db/keymgn.c
deleted file mode 100644
index d2abd7c..0000000
--- a/src/analysis/db/keymgn.c
+++ /dev/null
@@ -1,707 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * keymgn.c - mise en place et gestion des clefs cryptographiques
- *
- * Copyright (C) 2016-2017 Cyrille Bagard
- *
- *  This file is part of Chrysalide.
- *
- *  Chrysalide is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  Chrysalide is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with Chrysalide.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "keymgn.h"
-
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-#include "../../common/extstr.h"
-#include "../../common/pathname.h"
-#include "../../common/xdg.h"
-#include "../../core/params.h"
-
-
-
-/* Mémorise en mémoire la définition d'une identité courante. */
-static void store_identity(const x509_entries *, bool);
-
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : client  = précise la nature de l'identité à représenter.     *
-*                entries = éléments d'identité à définir en mémoire. [OUT]    *
-*                                                                             *
-*  Description : Charge en mémoire la définition de l'identité courante.      *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-void load_identity(bool client, x509_entries *entries)
-{
-    GGenConfig *config;                     /* Configuration à manipuler   */
-    const char *path;                       /* Accès à la configuration    */
-    char *saved;                            /* Valeur sauvegardée          */
-    char *username;                         /* Dénomination affichée       */
-    char *lang;                             /* Langage de l'utilisateur    */
-    size_t length;                          /* Taille de valeur récupérée  */
-    size_t first;                           /* Indice de première majuscule*/
-    size_t i;                               /* Boucle de parcours          */
-
-    memset(entries, 0, sizeof(x509_entries));
-
-    /* Chargement à partir des sauvegardes */
-
-    config = get_main_configuration();
-
-    path = (client ? MPK_IDENTITY_CLIENT_C : MPK_IDENTITY_SERVER_C);
-
-    if (g_generic_config_get_value(get_main_configuration(), path, &saved))
-        entries->country = (saved != NULL ? strdup(saved) : NULL);
-
-    path = (client ? MPK_IDENTITY_CLIENT_ST : MPK_IDENTITY_SERVER_ST);
-
-    if (g_generic_config_get_value(get_main_configuration(), path, &saved))
-        entries->state = (saved != NULL ? strdup(saved) : NULL);
-
-    path = (client ? MPK_IDENTITY_CLIENT_L : MPK_IDENTITY_SERVER_L);
-
-    if (g_generic_config_get_value(get_main_configuration(), path, &saved))
-        entries->locality = (saved != NULL ? strdup(saved) : NULL);
-
-    path = (client ? MPK_IDENTITY_CLIENT_O : MPK_IDENTITY_SERVER_O);
-
-    if (g_generic_config_get_value(get_main_configuration(), path, &saved))
-        entries->organisation = (saved != NULL ? strdup(saved) : NULL);
-
-    path = (client ? MPK_IDENTITY_CLIENT_OU : MPK_IDENTITY_SERVER_OU);
-
-    if (g_generic_config_get_value(get_main_configuration(), path, &saved))
-        entries->organisational_unit = (saved != NULL ? strdup(saved) : NULL);
-
-    path = (client ? MPK_IDENTITY_CLIENT_CN : MPK_IDENTITY_SERVER_CN);
-
-    if (g_generic_config_get_value(get_main_configuration(), path, &saved))
-        entries->common_name = (saved != NULL ? strdup(saved) : NULL);
-
-    /* Si les valeurs n'étaient pas définies... */
-
-    if (are_x509_entries_empty(entries))
-    {
-        /* Identification de l'utilisateur */
-
-        username = getenv("USERNAME");
-
-        if (username == NULL)
-            username = getenv("USER");
-
-        if (username == NULL)
-            username = getenv("LOGNAME");
-
-        if (username != NULL)
-            entries->common_name = strdup(username);
-        else
-            entries->common_name = strdup("???");
-
-        /* Identification du pays */
-
-        lang = getenv("LANG");
-
-        if (lang != NULL)
-        {
-            length = strlen(lang);
-
-            first = length;
-
-            for (i = 0; i < length; i++)
-            {
-                if (isupper(lang[i]))
-                {
-                    if (first == length)
-                        first = i;
-                }
-
-                else if (first != length)
-                {
-                    entries->country = strndup(&lang[first], i - first);
-                    break;
-                }
-
-            }
-
-        }
-
-        if (entries->country == NULL)
-            entries->country = strdup("??");
-
-    }
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : entries = éléments d'identité à conserver en mémoire.        *
-*                client  = précise la nature de l'identité représentée.       *
-*                                                                             *
-*  Description : Mémorise en mémoire la définition d'une identité courante.   *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void store_identity(const x509_entries *entries, bool client)
-{
-    GGenConfig *config;                     /* Configuration à manipuler   */
-    const char *path;                       /* Accès à la configuration    */
-
-    config = get_main_configuration();
-
-    path = (client ? MPK_IDENTITY_CLIENT_C : MPK_IDENTITY_SERVER_C);
-
-    g_generic_config_set_value(config, path, entries->country);
-
-    path = (client ? MPK_IDENTITY_CLIENT_ST : MPK_IDENTITY_SERVER_ST);
-
-    g_generic_config_set_value(config, path, entries->state);
-
-    path = (client ? MPK_IDENTITY_CLIENT_L : MPK_IDENTITY_SERVER_L);
-
-    g_generic_config_set_value(config, path, entries->locality);
-
-    path = (client ? MPK_IDENTITY_CLIENT_O : MPK_IDENTITY_SERVER_O);
-
-    g_generic_config_set_value(config, path, entries->organisation);
-
-    path = (client ? MPK_IDENTITY_CLIENT_OU : MPK_IDENTITY_SERVER_OU);
-
-    g_generic_config_set_value(config, path, entries->organisational_unit);
-
-    path = (client ? MPK_IDENTITY_CLIENT_CN : MPK_IDENTITY_SERVER_CN);
-
-    g_generic_config_set_value(config, path, entries->common_name);
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : type = type de certificat à gérer.                           *
-*                name = dénomination du serveur visé.                         *
-*                                                                             *
-*  Description : Fournit le répertoire de travail pour les certifications.    *
-*                                                                             *
-*  Retour      : Définition d'emplacement à libérer de la mémoire après usage.*
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-char *get_cert_working_directory(const char *type, const char *name)
-{
-    char *result;                           /* Chemin à retourner          */
-    char *suffix;                           /* Fin de la destination       */
-
-    suffix = strdup("chrysalide");
-    suffix = stradd(suffix, G_DIR_SEPARATOR_S);
-    suffix = stradd(suffix, type);
-    suffix = stradd(suffix, G_DIR_SEPARATOR_S);
-    suffix = stradd(suffix, name);
-    suffix = stradd(suffix, G_DIR_SEPARATOR_S);
-
-    result = get_xdg_config_dir(suffix);
-
-    free(suffix);
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : entries = éléments d'identité à utiliser pour l'opération.   *
-*                                                                             *
-*  Description : Définit les certificats utilisés pour les échanges internes. *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-bool register_standalone_certs(const x509_entries *entries)
-{
-    bool result;                            /* Bilan de l'opération        */
-    char *working;                          /* Répertoire par le client    */
-    char *csr;                              /* Requête de signature        */
-    char *cert;                             /* Certificat signé en sortie  */
-
-    /* Certificats côtés serveur */
-
-    result = register_server_cert("standalone", entries);
-
-    if (result)
-    {
-        /* Demande de signature */
-
-        result = make_client_sign_request("standalone", entries);
-
-        /* Signature */
-
-        if (result)
-        {
-            working = get_cert_working_directory("clients", "standalone");
-
-            csr = build_absolute_filename(working, "client-csr.pem");
-            cert = build_absolute_filename(working, "client-cert.pem");
-
-            result = sign_client_request("standalone", csr, cert);
-
-            free(csr);
-            free(cert);
-
-            free(working);
-
-        }
-
-    }
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : name    = dénomination du serveur visé.                      *
-*                entries = éléments d'identité à utiliser pour l'opération.   *
-*                                                                             *
-*  Description : Définit les certificats utilisés pour par un serveur.        *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-bool register_server_cert(const char *name, const x509_entries *entries)
-{
-    bool result;                            /* Bilan de l'opération        */
-    char *suffix;                           /* Fin de la destination       */
-    char *working;                          /* Répertoire de travail       */
-    unsigned long valid;                    /* Durée de validité           */
-    char *csr;                              /* Requête de signature        */
-    char *cacert;                           /* Certificat d'autorité       */
-    char *cakey;                            /* Clef de cette autorité      */
-    char *cert;                             /* Certificat signé en sortie  */
-
-    result = false;
-
-    working = get_cert_working_directory("servers", name);
-
-    if (working != NULL)
-    {
-        result = mkpath(working);
-        if (!result) goto rsc_quick_exit;
-
-        result = g_generic_config_get_value(get_main_configuration(), MPK_IDENTITY_VALIDITY, &valid);
-
-        if (!result)
-            goto rsc_quick_exit;
-
-        result = build_keys_and_ca(working, "ca", valid, entries);
-        if (!result) goto rsc_quick_exit;
-
-        result = build_keys_and_request(working, "server", entries);
-        if (!result) goto rsc_quick_exit;
-
-        csr = build_absolute_filename(working, "server-csr.pem");
-        cacert = build_absolute_filename(working, "ca-cert.pem");
-        cakey = build_absolute_filename(working, "ca-key.pem");
-        cert = build_absolute_filename(working, "server-cert.pem");
-
-        result = sign_cert(csr, cacert, cakey, cert, valid);
-
-        if (result)
-            store_identity(entries, false);
-
-        free(csr);
-        free(cacert);
-        free(cakey);
-        free(cert);
-
- rsc_quick_exit:
-
-        free(working);
-
-    }
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : name    = dénomination du serveur visé.                      *
-*                entries = éléments d'identité à utiliser pour l'opération.   *
-*                                                                             *
-*  Description : Elabore une demande de signature de certificat.              *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-bool make_client_sign_request(const char *name, const x509_entries *entries)
-{
-    bool result;                            /* Bilan de l'opération        */
-    char *working;                          /* Répertoire par le client    */
-
-    working = get_cert_working_directory("clients", name);
-
-    result = mkpath(working);
-
-    if (result)
-        result = build_keys_and_request(working, "client", entries);
-
-    if (result)
-        store_identity(entries, true);
-
-    free(working);
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : name = dénomination du serveur visé.                         *
-*                csr  = fichier contenant le certificat à signer.             *
-*                cert = fichier contenant le certificat signé.                *
-*                                                                             *
-*  Description : Signe un certificat client pour un accès un serveur donné.   *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-bool sign_client_request(const char *name, const char *csr, const char *cert)
-{
-    bool result;                            /* Bilan de l'opération        */
-    char *working;                          /* Répertoire par le serveur   */
-    unsigned long valid;                    /* Durée de validité           */
-    char *cacert;                           /* Certificat d'autorité       */
-    char *cakey;                            /* Clef de cette autorité      */
-
-    working = get_cert_working_directory("servers", name);
-
-    result = g_generic_config_get_value(get_main_configuration(), MPK_IDENTITY_VALIDITY, &valid);
-
-    if (!result)
-        goto scr_exit;
-
-    cacert = build_absolute_filename(working, "ca-cert.pem");
-    cakey = build_absolute_filename(working, "ca-key.pem");
-
-    result = sign_cert(csr, cacert, cakey, cert, valid);
-
-    free(cacert);
-    free(cakey);
-
- scr_exit:
-
-    free(working);
-
-    return result;
-
-}
-
-
-
-
-
-
-
-
-
-
-#include <assert.h>
-#include <glib.h>
-#include <malloc.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/pem.h>
-
-
-#include <i18n.h>
-
-
-#include "../../common/xdg.h"
-
-
-
-/* Met en place de nouvelles clefs RSA. */
-static bool generate_user_rsa_keys(const char *, const char *);
-
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : -                                                            *
-*                                                                             *
-*  Description : S'assure que l'utilisateur dispose de clefs RSA.             *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-bool ensure_user_has_rsa_keys(void)
-{
-    bool result;                            /* Bilan à retourner           */
-    char *priv;                             /* Chemin de la clef privée    */
-    char *pub;                              /* Chemin de la clef publique  */
-    int priv_check;                         /* Bilan d'une vérification #1 */
-    int pub_check;                          /* Bilan d'une vérification #2 */
-
-    result = NULL;
-
-    priv = get_xdg_config_dir("chrysalide" G_DIR_SEPARATOR_S "id_rsa.priv");
-    pub = get_xdg_config_dir("chrysalide" G_DIR_SEPARATOR_S "id_rsa.pub");
-
-    priv_check = access(priv, R_OK);
-    pub_check = access(pub, R_OK);
-
-    result = (priv_check == 0 && pub_check == 0);
-
-    if (!result)
-    {
-        result = generate_user_rsa_keys(priv, pub);
-
-        if (!result)
-            fprintf(stderr, _("Unable to create new user RSA key pair.\n"));
-
-    }
-
-    free(priv);
-    free(pub);
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : priv = chemin d'accès pour la clef privée.                   *
-*                pub  = chemin d'accès pour la clef publique.                 *
-*                                                                             *
-*  Description : Met en place de nouvelles clefs RSA.                         *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static bool generate_user_rsa_keys(const char *priv, const char *pub)
-{
-    bool result;                            /* Bilan à retourner           */
-    EVP_PKEY_CTX *ctx;                      /* Contexte de génération      */
-    int ret;                                /* Bilan d'un appel            */
-    EVP_PKEY *pair;                         /* Paire de clefs RSA générée  */
-    FILE *stream;                           /* Flux ouvert en écriture     */
-
-    result = false;
-
-    /**
-     * Cf. https://www.openssl.org/docs/manmaster/crypto/EVP_PKEY_keygen.html
-     */
-
-    ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
-    if (ctx == NULL) goto euhrk_exit;
-
-    ret = EVP_PKEY_keygen_init(ctx);
-    if (ret != 1) goto euhrk_exit;
-
-    ret = EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, RSA_USED_SIZE * 8);
-    if (ret != 1) goto euhrk_exit;
-
-    pair = NULL;
-
-    ret = EVP_PKEY_keygen(ctx, &pair);
-    if (ret != 1) goto euhrk_exit;
-
-    /* Clef privée */
-
-    stream = fopen(priv, "wt");
-    if (stream == NULL) goto euhrk_bad_write;
-
-    ret = PEM_write_PrivateKey(stream, pair, NULL, NULL, 0, NULL, NULL);
-    if (ret != 1) goto euhrk_bad_write;
-
-    fclose(stream);
-
-    /* Clef publique */
-
-    stream = fopen(pub, "wt");
-    if (stream == NULL) goto euhrk_bad_write;
-
-    ret = PEM_write_PUBKEY(stream, pair);
-    if (ret != 1) goto euhrk_bad_write;
-
-    result = true;
-
- euhrk_bad_write:
-
-    fclose(stream);
-
-    EVP_PKEY_free(pair);
-
- euhrk_exit:
-
-    EVP_PKEY_CTX_free(ctx);
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : filename = chemin d'accès à la clef à charger.               *
-*                private  = nature de la clef visée.                          *
-*                                                                             *
-*  Description : Charge une clef RSA à partir d'un fichier PEM.               *
-*                                                                             *
-*  Retour      : Clef RSA ou NULL en cas de soucis.                           *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-RSA *load_rsa_key(const char *filename, bool private)
-{
-    RSA *result;                            /* Clef à retourner            */
-    FILE *stream;                           /* Flux ouvert en lecture      */
-    int bits;                               /* Taille de la clef en bits   */
-
-    result = NULL;
-
-    stream = fopen(filename, "r");
-    if (stream == NULL) goto lrk_exit;
-
-    if (private)
-        result = PEM_read_RSAPrivateKey(stream, &result, NULL, NULL);
-    else
-        result = PEM_read_RSA_PUBKEY(stream, &result, NULL, NULL);
-
-    fclose(stream);
-
-    if (result == NULL)
-        fprintf(stderr, _("Unable to read the RSA key from '%s'.\n"), filename);
-
-    else
-    {
-        bits = RSA_size(result);
-
-        if (bits != RSA_USED_SIZE)
-        {
-            fprintf(stderr, _("Wrong RSA key size for %s: expected %d, got %d.\n"), filename, RSA_USED_SIZE, bits);
-            RSA_free(result);
-            result = NULL;
-        }
-
-    }
-
- lrk_exit:
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : key  = clef RSA à utiliser.                                  *
-*                hash = empreinte à signer.                                   *
-*                sig  = signature calculée.                                   *
-*                                                                             *
-*  Description : Signe une empreinte MD5 à l'aide d'une clef RSA.             *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-bool sign_md5_hash(RSA *key, const unsigned char *hash, unsigned char *sig)
-{
-    int ret;                                /* Bilan de l'opération        */
-    unsigned int siglen;                    /* Taille de la signature      */
-
-    siglen = RSA_USED_SIZE;
-
-    ret = RSA_sign(NID_md5, hash, 16, sig, &siglen, key);
-
-    assert(siglen == RSA_USED_SIZE);
-
-    if (ret != 1)
-        fprintf(stderr, "Unable to sign hash (error=%lu).\n", ERR_get_error());
-
-    return (ret == 1);
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : key  = clef RSA à utiliser.                                  *
-*                hash = empreinte à signer.                                   *
-*                sig  = signature calculée.                                   *
-*                                                                             *
-*  Description : Vérifie la signature d'une empreinte MD5 avec une clef RSA.  *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-bool verify_md5_hash(RSA *key, const unsigned char *hash, unsigned char *sig)
-{
-    int ret;                                /* Bilan de l'opération        */
-
-    ret = RSA_verify(NID_md5, hash, 16, sig, RSA_USED_SIZE, key);
-
-    return (ret == 1);
-
-}
diff --git a/src/analysis/db/keymgn.h b/src/analysis/db/keymgn.h
deleted file mode 100644
index 24ada61..0000000
--- a/src/analysis/db/keymgn.h
+++ /dev/null
@@ -1,81 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * keymgn.h - prototypes pour la mise en place et la gestion des clefs cryptographiques
- *
- * Copyright (C) 2016-2017 Cyrille Bagard
- *
- *  This file is part of Chrysalide.
- *
- *  Chrysalide is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  Chrysalide is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with Chrysalide.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ANALYSIS_DB_KEYMGN_H
-#define _ANALYSIS_DB_KEYMGN_H
-
-
-#include <stdbool.h>
-
-
-#include "certs.h"
-
-
-#include "auth.h"
-
-
-/* Charge en mémoire la définition de l'identité courante. */
-void load_identity(bool, x509_entries *);
-
-/* Fournit le répertoire de travail pour les certifications. */
-char *get_cert_working_directory(const char *, const char *);
-
-/* Définit les certificats utilisés pour les échanges internes. */
-bool register_standalone_certs(const x509_entries *);
-
-/* Définit les certificats utilisés pour par un serveur. */
-bool register_server_cert(const char *, const x509_entries *);
-
-/* Elabore une demande de signature de certificat. */
-bool make_client_sign_request(const char *, const x509_entries *);
-
-/* Signe un certificat client pour un accès un serveur donné. */
-bool sign_client_request(const char *, const char *, const char *);
-
-
-
-
-
-#include <stdbool.h>
-#include <openssl/rsa.h>
-
-
-/* Taille des clefs RSA */
-#define RSA_USED_SIZE (2048 / 8)
-
-
-/* S'assure que l'utilisateur dispose de clefs RSA. */
-bool ensure_user_has_rsa_keys(void);
-
-/* Charge une clef RSA à partir d'un fichier PEM. */
-RSA *load_rsa_key(const char *, bool);
-
-/* Signe une empreinte MD5 à l'aide d'une clef RSA. */
-bool sign_md5_hash(RSA *, const unsigned char *, unsigned char *);
-
-/* Vérifie la signature d'une empreinte MD5 avec une clef RSA. */
-bool verify_md5_hash(RSA *, const unsigned char *, unsigned char *);
-
-
-
-#endif  /* _ANALYSIS_DB_KEYMGN_H */
diff --git a/src/core/core.c b/src/core/core.c
index 4b7e3ce..27061d6 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -40,7 +40,6 @@
 #include "params.h"
 #include "processors.h"
 #include "queue.h"
-#include "../analysis/db/keymgn.h"
 #include "../common/io.h"
 #include "../common/xdg.h"
 #include "../glibext/linesegment.h"
@@ -92,8 +91,6 @@ bool load_all_basic_components(void)
 
         result &= load_main_config_parameters();
 
-        result &= ensure_user_has_rsa_keys();
-
         result &= g_generic_config_read(get_main_configuration());
 
         result &= init_global_works();
diff --git a/src/core/logs.h b/src/core/logs.h
index 4ddb6ab..fd6e777 100644
--- a/src/core/logs.h
+++ b/src/core/logs.h
@@ -82,9 +82,8 @@ void log_variadic_message(LogMessageType, const char *, ...);
     do                                                                                                  \
     {                                                                                                   \
         char __msg[1024];                                                                               \
-        char *__msg_ptr;                                                                                \
-        __msg_ptr = strerror_r(errno, __msg, sizeof(__msg));                                            \
-        log_variadic_message(LMT_EXT_ERROR, "[%s:%u] %s: %s", __FUNCTION__, __LINE__, func, __msg_ptr); \
+        strerror_r(errno, __msg, sizeof(__msg));                                                        \
+        log_variadic_message(LMT_EXT_ERROR, "[%s:%u] %s: %s", __FUNCTION__, __LINE__, func, __msg);     \
     }                                                                                                   \
     while (0)
 
@@ -94,7 +93,10 @@ void log_variadic_message(LogMessageType, const char *, ...);
         char __msg[1024];                                                                               \
         const char *__msg_ptr;                                                                          \
         if (errcode == EAI_SYSTEM)                                                                      \
-            __msg_ptr = strerror_r(errno, __msg, sizeof(__msg));                                        \
+        {                                                                                               \
+            strerror_r(errno, __msg, sizeof(__msg));                                                    \
+            __msg_ptr = __msg;                                                                          \
+        }                                                                                               \
         else                                                                                            \
             __msg_ptr = gai_strerror(errcode);                                                          \
         log_variadic_message(LMT_EXT_ERROR, "[%s:%u] %s: %s", __FUNCTION__, __LINE__, func, __msg_ptr); \
diff --git a/src/core/params.c b/src/core/params.c
index ef331e7..89e3607 100644
--- a/src/core/params.c
+++ b/src/core/params.c
@@ -24,76 +24,6 @@
 #include "params.h"
 
 
-#include <limits.h>
-#include <malloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : -                                                            *
-*                                                                             *
-*  Description : Détermine une fois pour toute la désignation de l'usager.    *
-*                                                                             *
-*  Retour      : Nom déterminé à libérer de la mémoire.                       *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static char *get_author_name(void)
-{
-    char *result;                           /* Désignation à retourner     */
-    char *chrysalide_user;                  /* Eventuel nom spécifique     */
-    char *logname;                          /* Nom depuis l'environnement  */
-    char hostname[HOST_NAME_MAX];           /* Nom de la machine courante  */
-    int ret;                                /* Bilan d'un appel            */
-    size_t length;                          /* Taille de la désignation    */
-
-    chrysalide_user = getenv("CHRYSALIDE_USER");
-
-    if (chrysalide_user != NULL)
-        result = strdup(chrysalide_user);
-
-    else
-    {
-        logname = getenv("LOGNAME");
-
-        ret = gethostname(hostname, HOST_NAME_MAX);
-        if (ret != 0)
-            hostname[0] = '\0';
-
-        if (logname != NULL && hostname[0] != '\0')
-        {
-            length = strlen(logname) + 1 + strlen(hostname) + 1;
-            result = (char *)calloc(length, sizeof(char));
-            snprintf(result, length, "%s@%s", logname, hostname);
-        }
-        else if (logname != NULL && hostname[0] == '\0')
-        {
-            length = strlen(logname) + 1;
-            result = (char *)calloc(length, sizeof(char));
-            snprintf(result, length, "%s", logname);
-        }
-        else if (logname == NULL && hostname[0] != '\0')
-        {
-            length = 1 + strlen(hostname) + 1;
-            result = (char *)calloc(length, sizeof(char));
-            snprintf(result, length, "@%s", hostname);
-        }
-        else
-            result = strdup("anonymous");
-
-    }
-
-    return result;
-
-}
-
-
 /******************************************************************************
 *                                                                             *
 *  Paramètres  : -                                                            *
@@ -110,58 +40,10 @@ bool load_main_config_parameters(void)
 {
     GGenConfig *config;                     /* Configuration à charger     */
     GCfgParam *param;                       /* Paramètre chargé            */
-    char *string;                           /* Valeur sous forme de texte  */
 
     config = g_generic_config_new_from_file("main");
     set_main_configuration(config);
 
-    string = get_author_name();
-    param = g_generic_config_create_param(config, MPK_AUTHOR_NAME, CPT_STRING, string);
-    free(string);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_C, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_ST, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_L, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_O, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_OU, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_CLIENT_CN, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_C, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_ST, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_L, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_O, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_OU, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_SERVER_CN, CPT_STRING, NULL);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_IDENTITY_VALIDITY, CPT_ULONG, 10 * 365 * 24 * 60 * 60);
-    if (param == NULL) return false;
-
-    param = g_generic_config_create_param(config, MPK_SERVER_BACKLOG, CPT_INTEGER, 20);
-    if (param == NULL) return false;
-
     param = g_generic_config_create_param(config, MPK_FORMAT_NO_NAME, CPT_BOOLEAN, false);
     if (param == NULL) return false;
 
diff --git a/src/core/params.h b/src/core/params.h
index 85f4084..36dbe78 100644
--- a/src/core/params.h
+++ b/src/core/params.h
@@ -33,21 +33,6 @@
  * Clefs de paramètres de configuration principale.
  */
 
-#define MPK_AUTHOR_NAME         "cdb.default.author"
-#define MPK_IDENTITY_CLIENT_C   "cdb.identity.client.country"
-#define MPK_IDENTITY_CLIENT_ST  "cdb.identity.client.state"
-#define MPK_IDENTITY_CLIENT_L   "cdb.identity.client.locality"
-#define MPK_IDENTITY_CLIENT_O   "cdb.identity.client.organisation"
-#define MPK_IDENTITY_CLIENT_OU  "cdb.identity.client.organisational_unit"
-#define MPK_IDENTITY_CLIENT_CN  "cdb.identity.client.common_name"
-#define MPK_IDENTITY_SERVER_C   "cdb.identity.server.country"
-#define MPK_IDENTITY_SERVER_ST  "cdb.identity.server.state"
-#define MPK_IDENTITY_SERVER_L   "cdb.identity.server.locality"
-#define MPK_IDENTITY_SERVER_O   "cdb.identity.server.organisation"
-#define MPK_IDENTITY_SERVER_OU  "cdb.identity.server.organisational_unit"
-#define MPK_IDENTITY_SERVER_CN  "cdb.identity.server.common_name"
-#define MPK_IDENTITY_VALIDITY   "cdb.identity.validity"
-#define MPK_SERVER_BACKLOG      "cdb.network.server.backlog"
 #define MPK_FORMAT_NO_NAME      "format.symbols.use_phy_instead_of_virt"
 #define MPK_INTERNAL_THEME      "gui.editor.theme"
 #define MPK_TITLE_BAR           "gui.editor.hide_titlebar"
diff --git a/src/csrvmng.c b/src/csrvmng.c
deleted file mode 100644
index e0b01e1..0000000
--- a/src/csrvmng.c
+++ /dev/null
@@ -1,369 +0,0 @@
-
-#include <fcntl.h>
-#include <getopt.h>
-#include <malloc.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-
-
-#include <common/xml.h>
-
-
-
-/* Affiche des indications sur l'utilisation du programme. */
-static void show_usage(const char *);
-
-/* Inscrit les paramètres d'accès au serveur configuré. */
-static bool init_server_config(xmlDoc *, xmlXPathContextPtr, const char *, short int);
-
-/* Lie un nouvel utilisateur à un serveur configuré. */
-static bool add_new_user_into_server_config(xmlDoc *, xmlXPathContextPtr, const char *, const char *);
-
-/* Retire un utilisateur des connaissances d'un serveur. */
-static bool remove_user_from_server_config(xmlDoc *, xmlXPathContextPtr, const char *);
-
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : binary = désignation du programme binaire courant.           *
-*                                                                             *
-*  Description : Affiche des indications sur l'utilisation du programme.      *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void show_usage(const char *binary)
-{
-    printf("\n");
-
-    printf("%s --help | --file <conf> [options...]\n", binary);
-
-    printf("\n");
-
-    printf("\n");
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : argc = nombre d'arguments dans la ligne de commande.         *
-*                argv = arguments de la ligne de commande.                    *
-*                                                                             *
-*  Description : Point d'entrée du programme.                                 *
-*                                                                             *
-*  Retour      : EXIT_SUCCESS si le prgm s'est déroulé sans encombres.        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-int main(int argc, char **argv)
-{
-    int result;                             /* Bilan de l'exécution        */
-    bool need_help;                         /* Affichage de l'usage ?      */
-    char *filename;                         /* Fichier de configuration    */
-    char *address;                          /* Adresse d'un serveur        */
-    short int port;                         /* Port d'écoute associé       */
-    char *username;                         /* Utilisateur à manipuler     */
-    char *pubkey;                           /* Fichier de clef publique    */
-    bool need_removal;                      /* Suppression d'utilisateur   */
-    int opt_index;                          /* Indice de parcours          */
-    int ret;                                /* Bilan d'un appel            */
-    bool pair_ok;                           /* Associations correctes ?    */
-    xmlDoc *xdoc;                           /* Document XML à traiter      */
-    xmlXPathContextPtr ctx;                 /* Contexte XPath associé      */
-    bool has_conf;                          /* Fichier XML ouvert ?        */
-    bool status;                            /* Bilan d'un appel            */
-
-    static struct option long_options[] = {
-
-        { "help",   no_argument,        NULL,   'h' },
-
-        { "file",   required_argument,  NULL,   'f' },
-        { "addr",   required_argument,  NULL,   'a' },
-        { "port",   required_argument,  NULL,   'p' },
-        { "user",   required_argument,  NULL,   'u' },
-        { "key",    required_argument,  NULL,   'k' },
-        { "remove", no_argument,        NULL,   'r' },
-
-        { NULL,     0,                  NULL,   0   }
-
-    };
-
-    result = EXIT_FAILURE;
-
-    need_help = false;
-    filename = NULL;
-    address = NULL;
-    port = 0;
-    username = NULL;
-    pubkey = NULL;
-    need_removal = false;
-
-    for (opt_index = 0; ;)
-    {
-        ret = getopt_long(argc, argv, "hf:a:p:u:k:r", long_options, &opt_index);
-        if (ret == -1) break;
-
-        switch (ret)
-        {
-            case 'h':
-                need_help = true;
-                break;
-
-            case 'f':
-                filename = optarg;
-                break;
-
-            case 'a':
-                address = optarg;
-                break;
-
-            case 'p':
-                port = atoi(optarg);
-                break;
-
-            case 'u':
-                username = optarg;
-                break;
-
-            case 'k':
-                pubkey = optarg;
-                break;
-
-            case 'r':
-                need_removal = true;
-                break;
-
-            default:
-                need_help = true;
-                result = EXIT_FAILURE;
-                break;
-
-        }
-
-    }
-
-    /* Vérification des entrées */
-
-    pair_ok = true;
-
-    if (address != NULL)
-        pair_ok &= (port > 0);
-
-    if (port > 0)
-        pair_ok &= (address != NULL);
-
-    if (need_removal)
-        pair_ok &= (username != NULL);
-
-    else
-    {
-        if (username != NULL)
-            pair_ok &= (pubkey != NULL);
-
-        if (pubkey != NULL)
-            pair_ok &= (username != NULL);
-
-    }
-
-    if (need_help || filename == NULL || !pair_ok)
-    {
-        show_usage(argv[0]);
-
-        if (need_help)
-            result = EXIT_SUCCESS;
-
-        goto exit;
-
-    }
-
-    /* Traitement demandés */
-
-    has_conf = open_xml_file(filename, &xdoc, &ctx);
-
-    if (!has_conf)
-        has_conf = create_new_xml_file(&xdoc, &ctx);
-
-    if (address != NULL && port > 0)
-    {
-        status = init_server_config(xdoc, ctx, address, port);
-
-        result = (status ? EXIT_SUCCESS : EXIT_FAILURE);
-
-    }
-
-    if (username != NULL && pubkey != NULL)
-    {
-        status = add_new_user_into_server_config(xdoc, ctx, username, pubkey);
-
-        result = (status ? EXIT_SUCCESS : EXIT_FAILURE);
-
-    }
-
-    if (username != NULL && need_removal)
-    {
-        status = remove_user_from_server_config(xdoc, ctx, username);
-
-        if (status)
-            result = EXIT_SUCCESS;
-
-    }
-
-    save_xml_file(xdoc, filename);
-
-    close_xml_file(xdoc, ctx);
-
- exit:
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : xdoc    = document XML à compléter.                          *
-*                ctx     = contete XPath à utiliser pour les parcours.        *
-*                address = adresse IP ou nom de domaine à contacter.          *
-*                port    = port désigné pour les communications.              *
-*                                                                             *
-*  Description : Inscrit les paramètres d'accès au serveur configuré.         *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static bool init_server_config(xmlDoc *xdoc, xmlXPathContextPtr ctx, const char *address, short int port)
-{
-    bool result;                            /* Bilan à faire remonter      */
-    const char *path;                       /* Chemin d'accès XML          */
-
-    path = "/ChrysalideServerConfig/Server";
-
-    result = add_content_to_node(xdoc, ctx, path, "");
-
-    result &= add_string_attribute_to_node(xdoc, ctx, path, "address", address);
-
-    result &= add_long_attribute_to_node(xdoc, ctx, path, "port", port);
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : xdoc     = document XML à compléter.                         *
-*                ctx      = contete XPath à utiliser pour les parcours.       *
-*                username = nom de l'utilisateur à ajouter.                   *
-*                pubkey   = fichier contenant une clef publique.              *
-*                                                                             *
-*  Description : Lie un nouvel utilisateur à un serveur configuré.            *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static bool add_new_user_into_server_config(xmlDoc *xdoc, xmlXPathContextPtr ctx, const char *username, const char *pubkey)
-{
-    bool result;                            /* Bilan à faire remonter      */
-    int fd;                                 /* Descripteur du fichier      */
-    struct stat info;                       /* Informations sur le fichier */
-    int ret;                                /* Bilan d'un appel            */
-    void *content;                          /* Contenu brut du fichier     */
-    char *data;                             /* Données brutes à placer     */
-    const char *path;                       /* Chemin d'accès XML          */
-
-    result = false;
-
-    /* Récupération des données */
-
-    fd = open(pubkey, O_RDONLY);
-    if (fd == -1)
-    {
-        perror("open");
-        goto anuisc_exit;
-    }
-
-    ret = fstat(fd, &info);
-    if (ret == -1)
-    {
-        close(fd);
-        perror("fstat");
-        goto anuisc_exit;
-    }
-
-    content = mmap(NULL, info.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
-    if (content == MAP_FAILED)
-    {
-        close(fd);
-        perror("mmap");
-        goto anuisc_exit;
-    }
-
-    data = (char *)calloc(info.st_size, sizeof(char));
-    memcpy(data, content, info.st_size);
-
-    munmap(content, info.st_size);
-    close(fd);
-
-    /* Création de l'entrée XML */
-
-    path = "/ChrysalideServerConfig/Access/User";
-
-    result = add_content_to_node(xdoc, ctx, path, data);
-
-    result &= add_string_attribute_to_node(xdoc, ctx, path, "name", username);
-
-    free(data);
-
- anuisc_exit:
-
-    return result;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : xdoc     = document XML à compléter.                         *
-*                ctx      = contete XPath à utiliser pour les parcours.       *
-*                username = nom de l'utilisateur à ajouter.                   *
-*                                                                             *
-*  Description : Retire un utilisateur des connaissances d'un serveur.        *
-*                                                                             *
-*  Retour      : Bilan de l'opération.                                        *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static bool remove_user_from_server_config(xmlDoc *xdoc, xmlXPathContextPtr ctx, const char *username)
-{
-    bool result;                            /* Bilan à faire remonter      */
-    char *path;                             /* Chemin d'accès XML          */
-
-    asprintf(&path, "/ChrysalideServerConfig/Access/User[@name=\"%s\"]", username);
-
-    result = remove_node_from_doc(xdoc, ctx, path);
-
-    free(path);
-
-    return result;
-
-}
diff --git a/src/gui/dialogs/identity.c b/src/gui/dialogs/identity.c
index 5f51bc0..625c556 100644
--- a/src/gui/dialogs/identity.c
+++ b/src/gui/dialogs/identity.c
@@ -30,7 +30,7 @@
 #include <i18n.h>
 
 
-#include "../../analysis/db/keymgn.h"
+#include "../../analysis/db/certs.h"
 #include "../../core/logs.h"
 
 
@@ -69,7 +69,8 @@ GtkWidget *create_identity_dialog(GtkWindow *parent, GtkBuilder **outb)
 
     /* Mise à jour de l'interface */
 
-    load_identity(true, &entries);
+    memset(&entries, 0, sizeof(entries));
+    //load_identity(true, &entries);
 
     if (entries.country != NULL)
     {
@@ -177,7 +178,7 @@ static void update_identity(GtkButton *button, GtkBuilder *builder)
 
     /* Application de la nouvelle définition */
 
-    status = register_standalone_certs(&entries);
+    status = false;//register_standalone_certs(&entries);
 
     free_x509_entries(&entries);
 
-- 
cgit v0.11.2-87-g4458