diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2021-07-20 22:13:59 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2021-07-20 22:13:59 (GMT) |
commit | 6fdf58c6f26b05b3b04f9ce68d837a69e18c848f (patch) | |
tree | b92f4d95fcdd315fd2943334a3b92bf07aea5c33 /src/analysis/db | |
parent | 466fef8473ab58a126ac15f5c4f8b9727d247913 (diff) |
Improve the log messages on error when signing certificates.
Diffstat (limited to 'src/analysis/db')
-rw-r--r-- | src/analysis/db/certs.c | 27 |
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; } |