From 65282c7685ca01c57d94d3df93c2f95d5b945e57 Mon Sep 17 00:00:00 2001 From: "M. Sean Finney" Date: Wed, 19 Oct 2005 12:59:55 +0000 Subject: - initial attempt at consolidating ssl-related code into netutils.{c,h} - added some #ifdefs to common.h and netutils.h to prevent multiple inclusions (as netlibs now includes common.h) - all ssl plugins (tcp/http/smtp) compile cleanly against gnutls, though certificate checking still needs to be done. - modified configure script so you can also explicitly say "without-gnutls" too (otherwise if you disable openssl you have no way of disabling gnutls too) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1255 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_smtp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'plugins/check_smtp.c') diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 3bb6a32b..19e9aea8 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -53,7 +53,9 @@ SSL_CTX *ctx; SSL *ssl; X509 *server_cert; int connect_STARTTLS (void); +# ifdef USE_OPENSSL int check_certificate (X509 **); +# endif #endif enum { @@ -241,6 +243,7 @@ main (int argc, char **argv) } else { ssl_established = TRUE; } +# ifdef USE_OPENSSL if ( check_cert ) { if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { result = check_certificate (&server_cert); @@ -254,6 +257,7 @@ main (int argc, char **argv) my_close(); return result; } +# endif /* USE_OPENSSL */ } #endif @@ -491,7 +495,7 @@ process_arguments (int argc, char **argv) break; case 'D': /* Check SSL cert validity */ -#ifdef HAVE_SSL +#ifdef USE_OPENSSL if (!is_intnonneg (optarg)) usage2 ("Invalid certificate expiration period",optarg); days_till_exp = atoi (optarg); @@ -645,7 +649,9 @@ connect_STARTTLS (void) I look for success instead (1) */ if (SSL_connect (ssl) == 1) return OK; +# ifdef USE_OPENSSL ERR_print_errors_fp (stderr); +# endif } else { @@ -656,6 +662,7 @@ connect_STARTTLS (void) return STATE_CRITICAL; } +# ifdef USE_OPENSSL int check_certificate (X509 ** certificate) { @@ -728,6 +735,7 @@ check_certificate (X509 ** certificate) return STATE_OK; } +# endif /* USE_OPENSSL */ #endif int -- cgit v1.2.3-74-g34f1