diff options
Diffstat (limited to 'plugins/check_smtp.c')
-rw-r--r-- | plugins/check_smtp.c | 10 |
1 files changed, 9 insertions, 1 deletions
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; | |||
53 | SSL *ssl; | 53 | SSL *ssl; |
54 | X509 *server_cert; | 54 | X509 *server_cert; |
55 | int connect_STARTTLS (void); | 55 | int connect_STARTTLS (void); |
56 | # ifdef USE_OPENSSL | ||
56 | int check_certificate (X509 **); | 57 | int check_certificate (X509 **); |
58 | # endif | ||
57 | #endif | 59 | #endif |
58 | 60 | ||
59 | enum { | 61 | enum { |
@@ -241,6 +243,7 @@ main (int argc, char **argv) | |||
241 | } else { | 243 | } else { |
242 | ssl_established = TRUE; | 244 | ssl_established = TRUE; |
243 | } | 245 | } |
246 | # ifdef USE_OPENSSL | ||
244 | if ( check_cert ) { | 247 | if ( check_cert ) { |
245 | if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { | 248 | if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { |
246 | result = check_certificate (&server_cert); | 249 | result = check_certificate (&server_cert); |
@@ -254,6 +257,7 @@ main (int argc, char **argv) | |||
254 | my_close(); | 257 | my_close(); |
255 | return result; | 258 | return result; |
256 | } | 259 | } |
260 | # endif /* USE_OPENSSL */ | ||
257 | } | 261 | } |
258 | #endif | 262 | #endif |
259 | 263 | ||
@@ -491,7 +495,7 @@ process_arguments (int argc, char **argv) | |||
491 | break; | 495 | break; |
492 | case 'D': | 496 | case 'D': |
493 | /* Check SSL cert validity */ | 497 | /* Check SSL cert validity */ |
494 | #ifdef HAVE_SSL | 498 | #ifdef USE_OPENSSL |
495 | if (!is_intnonneg (optarg)) | 499 | if (!is_intnonneg (optarg)) |
496 | usage2 ("Invalid certificate expiration period",optarg); | 500 | usage2 ("Invalid certificate expiration period",optarg); |
497 | days_till_exp = atoi (optarg); | 501 | days_till_exp = atoi (optarg); |
@@ -645,7 +649,9 @@ connect_STARTTLS (void) | |||
645 | I look for success instead (1) */ | 649 | I look for success instead (1) */ |
646 | if (SSL_connect (ssl) == 1) | 650 | if (SSL_connect (ssl) == 1) |
647 | return OK; | 651 | return OK; |
652 | # ifdef USE_OPENSSL | ||
648 | ERR_print_errors_fp (stderr); | 653 | ERR_print_errors_fp (stderr); |
654 | # endif | ||
649 | } | 655 | } |
650 | else | 656 | else |
651 | { | 657 | { |
@@ -656,6 +662,7 @@ connect_STARTTLS (void) | |||
656 | return STATE_CRITICAL; | 662 | return STATE_CRITICAL; |
657 | } | 663 | } |
658 | 664 | ||
665 | # ifdef USE_OPENSSL | ||
659 | int | 666 | int |
660 | check_certificate (X509 ** certificate) | 667 | check_certificate (X509 ** certificate) |
661 | { | 668 | { |
@@ -728,6 +735,7 @@ check_certificate (X509 ** certificate) | |||
728 | 735 | ||
729 | return STATE_OK; | 736 | return STATE_OK; |
730 | } | 737 | } |
738 | # endif /* USE_OPENSSL */ | ||
731 | #endif | 739 | #endif |
732 | 740 | ||
733 | int | 741 | int |