summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/analysis/db/certs.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/analysis/db/certs.c b/src/analysis/db/certs.c
index 11d12fd..148abf2 100644
--- a/src/analysis/db/certs.c
+++ b/src/analysis/db/certs.c
@@ -734,7 +734,12 @@ bool sign_cert(const char *csr, const char *cacert, const char *cakey, const cha
/* Chargement de la requête */
stream = fopen(csr, "rb");
- if (stream == NULL) goto csr_read_failed;
+
+ if (stream == NULL)
+ {
+ log_variadic_message(LMT_ERROR, _("Unable to open the certificate signing request file '%s'"), csr);
+ goto csr_read_failed;
+ }
req = PEM_read_X509_REQ(stream, NULL, NULL, NULL);
@@ -742,7 +747,7 @@ bool sign_cert(const char *csr, const char *cacert, const char *cakey, const cha
if (req == NULL)
{
- log_variadic_message(LMT_ERROR, _("Unable to read the certificate signing request from '%s'"), cert);
+ log_variadic_message(LMT_ERROR, _("Unable to read the certificate signing request from '%s'"), csr);
goto csr_read_failed;
}
@@ -755,7 +760,12 @@ bool sign_cert(const char *csr, const char *cacert, const char *cakey, const cha
/* Chargement des éléments de l'autorité */
stream = fopen(cacert, "rb");
- if (stream == NULL) goto cacert_read_failed;
+
+ if (stream == NULL)
+ {
+ log_variadic_message(LMT_ERROR, _("Unable to open the CA certificate file '%s'"), cacert);
+ goto cacert_read_failed;
+ }
ca_cert = PEM_read_X509(stream, NULL, NULL, NULL);
@@ -763,12 +773,17 @@ bool sign_cert(const char *csr, const char *cacert, const char *cakey, const cha
if (ca_cert == NULL)
{
- log_variadic_message(LMT_ERROR, _("Unable to read the certificate from '%s'"), cert);
+ log_variadic_message(LMT_ERROR, _("Unable to read the CA certificate from '%s'"), cacert);
goto cacert_read_failed;
}
stream = fopen(cakey, "rb");
- if (stream == NULL) goto cakey_read_failed;
+
+ if (stream == NULL)
+ {
+ log_variadic_message(LMT_ERROR, _("Unable to open the CA private key file '%s'"), cakey);
+ goto cakey_read_failed;
+ }
ca_pk = PEM_read_PrivateKey(stream, NULL, NULL, NULL);
@@ -776,7 +791,7 @@ bool sign_cert(const char *csr, const char *cacert, const char *cakey, const cha
if (ca_pk == NULL)
{
- log_variadic_message(LMT_ERROR, _("Unable to read the CA private key from %s"), cakey);
+ log_variadic_message(LMT_ERROR, _("Unable to read the CA private key from '%s'"), cakey);
goto cakey_read_failed;
}