summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenz <12514511+RincewindsHat@users.noreply.github.com>2023-02-10 10:31:09 +0100
committerGitHub <noreply@github.com>2023-02-10 10:31:09 +0100
commite92046f810658016b7c373677efefda3b21400e4 (patch)
treed5ba9cf26aeec59f817ae0c66ff3920aacb32f6d
parente0dfb0622d19a4b4340dab9a315cb4b649f6f1e4 (diff)
parent28b5a1cc454774474b98037acd283a1da4c3f7ad (diff)
downloadmonitoring-plugins-e92046f.tar.gz
Merge pull request #1839 from monitoring-plugins/gnutlsfix
fallback to SSL_CTX_use_certificate_file for gnutls
-rw-r--r--plugins/sslutils.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/sslutils.c b/plugins/sslutils.c
index 286273f6..a7d80196 100644
--- a/plugins/sslutils.c
+++ b/plugins/sslutils.c
@@ -134,7 +134,16 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int
134 return STATE_CRITICAL; 134 return STATE_CRITICAL;
135 } 135 }
136 if (cert && privkey) { 136 if (cert && privkey) {
137 SSL_CTX_use_certificate_chain_file(c, cert); 137#ifdef USE_OPENSSL
138 if (!SSL_CTX_use_certificate_chain_file(c, cert)) {
139#elif USE_GNUTLS
140 if (!SSL_CTX_use_certificate_file(c, cert, SSL_FILETYPE_PEM)) {
141#else
142#error Unported for unknown SSL library
143#endif
144 printf ("%s\n", _("CRITICAL - Unable to open certificate chain file!\n"));
145 return STATE_CRITICAL;
146 }
138 SSL_CTX_use_PrivateKey_file(c, privkey, SSL_FILETYPE_PEM); 147 SSL_CTX_use_PrivateKey_file(c, privkey, SSL_FILETYPE_PEM);
139#ifdef USE_OPENSSL 148#ifdef USE_OPENSSL
140 if (!SSL_CTX_check_private_key(c)) { 149 if (!SSL_CTX_check_private_key(c)) {