summaryrefslogtreecommitdiff
path: root/src/analysis/db
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-31 17:09:17 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-31 17:09:17 (GMT)
commita1d2b44c4316be1567b209f0b3d584207c215477 (patch)
treee8883750f8f3514aa0f836a0ecbd00f6f4e70348 /src/analysis/db
parent0846c211ca24bc4e88bbc517362e1e08deb837b5 (diff)
Warned about missing local server certificates.
Diffstat (limited to 'src/analysis/db')
-rw-r--r--src/analysis/db/server.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/analysis/db/server.c b/src/analysis/db/server.c
index 5f6660f..deb54e9 100644
--- a/src/analysis/db/server.c
+++ b/src/analysis/db/server.c
@@ -277,6 +277,7 @@ GDbServer *g_db_server_new_internal(const char *author, char *kfile)
GDbServer *result; /* Adresse à retourner */
bool status; /* Bilan d'un chargement */
char *working; /* Répertoire par le client */
+ int ret[2]; /* Bilan d'une vérification */
result = g_object_new(G_TYPE_DB_SERVER, NULL);
@@ -292,6 +293,20 @@ GDbServer *g_db_server_new_internal(const char *author, char *kfile)
result->cert_file = build_absolute_filename(working, "server-cert.pem");
result->key_file = build_absolute_filename(working, "server-key.pem");
+ ret[0] = access(result->cert_file, R_OK);
+ ret[1] = access(result->key_file, R_OK);
+
+ if (ret[0] != 0 || ret[1] != 0)
+ {
+ log_variadic_message(LMT_ERROR, _("The serveur certificate is missing in the '%s' directory!"), working);
+ log_simple_message(LMT_ERROR, _("Generate it using the menu (Tool > Identity) and restart the program."));
+
+ free(working);
+
+ goto gdsni_missing_pem;
+
+ }
+
free(working);
/* Détermination du point d'écoute */
@@ -317,6 +332,8 @@ GDbServer *g_db_server_new_internal(const char *author, char *kfile)
return result;
+ gdsni_missing_pem:
+
gdsni_error:
g_object_unref(G_OBJECT(result));