diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-08-29 22:16:59 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-08-29 22:16:59 (GMT) |
commit | 14f1b8ff552dfb8aef6c66b3c65e816aa7820bb0 (patch) | |
tree | 735e01df60a21d6c9ecb961af36ab61aefec6d2f /src/core | |
parent | fa40856e942a7e1bd1cb2729645182c1fa717468 (diff) |
Removed code relative to the old share server version.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.c | 3 | ||||
-rw-r--r-- | src/core/logs.h | 10 | ||||
-rw-r--r-- | src/core/params.c | 118 | ||||
-rw-r--r-- | src/core/params.h | 15 |
4 files changed, 6 insertions, 140 deletions
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" |