[monitoring-plugins] fallback to SSL_CTX_use_certificate_file for ...
Andreas Baumann
git at monitoring-plugins.org
Sat Feb 4 16:30:11 CET 2023
Module: monitoring-plugins
Branch: gnutlsfix
Commit: 6f0ce3804a396ce89c09f50123e5f31b5b525b31
Author: Andreas Baumann <mail at andreasbaumann.cc>
Date: Sat Feb 4 16:19:46 2023 +0100
URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=6f0ce38
fallback to SSL_CTX_use_certificate_file for gnutls
---
plugins/sslutils.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/plugins/sslutils.c b/plugins/sslutils.c
index 286273f..d542c49 100644
--- a/plugins/sslutils.c
+++ b/plugins/sslutils.c
@@ -134,7 +134,18 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int
return STATE_CRITICAL;
}
if (cert && privkey) {
- SSL_CTX_use_certificate_chain_file(c, cert);
+#ifdef USE_OPENSSL
+ if (!SSL_CTX_use_certificate_chain_file(c, cert)) {
+#else
+#if USE_GNUTLS
+ if (!SSL_CTX_use_certificate_file(c, cert, SSL_FILETYPE_PEM)) {
+#else
+#error Unported for unknown SSL library
+#endif
+#endif
+ printf ("%s\n", _("CRITICAL - Unable to open certificate chain file!\n"));
+ return STATE_CRITICAL;
+ }
SSL_CTX_use_PrivateKey_file(c, privkey, SSL_FILETYPE_PEM);
#ifdef USE_OPENSSL
if (!SSL_CTX_check_private_key(c)) {
More information about the Commits
mailing list