diff options
Diffstat (limited to 'plugins/check_smtp.c')
-rw-r--r-- | plugins/check_smtp.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index fc0ae2c..d1c2466 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -40,7 +40,7 @@ const char *email = "devel@monitoring-plugins.org"; | |||
40 | #include <ctype.h> | 40 | #include <ctype.h> |
41 | 41 | ||
42 | #ifdef HAVE_SSL | 42 | #ifdef HAVE_SSL |
43 | int check_cert = FALSE; | 43 | bool check_cert = false; |
44 | int days_till_exp_warn, days_till_exp_crit; | 44 | int days_till_exp_warn, days_till_exp_crit; |
45 | # define my_recv(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | 45 | # define my_recv(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) |
46 | # define my_send(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) | 46 | # define my_send(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) |
@@ -100,17 +100,17 @@ char *authtype = NULL; | |||
100 | char *authuser = NULL; | 100 | char *authuser = NULL; |
101 | char *authpass = NULL; | 101 | char *authpass = NULL; |
102 | double warning_time = 0; | 102 | double warning_time = 0; |
103 | int check_warning_time = FALSE; | 103 | bool check_warning_time = false; |
104 | double critical_time = 0; | 104 | double critical_time = 0; |
105 | int check_critical_time = FALSE; | 105 | bool check_critical_time = false; |
106 | int verbose = 0; | 106 | int verbose = 0; |
107 | int use_ssl = FALSE; | 107 | bool use_ssl = false; |
108 | int use_starttls = FALSE; | 108 | bool use_starttls = false; |
109 | int use_sni = FALSE; | 109 | bool use_sni = false; |
110 | short use_proxy_prefix = FALSE; | 110 | bool use_proxy_prefix = false; |
111 | short use_ehlo = FALSE; | 111 | bool use_ehlo = false; |
112 | short use_lhlo = FALSE; | 112 | bool use_lhlo = false; |
113 | short ssl_established = 0; | 113 | bool ssl_established = false; |
114 | char *localhostname = NULL; | 114 | char *localhostname = NULL; |
115 | int sd; | 115 | int sd; |
116 | char buffer[MAX_INPUT_BUFFER]; | 116 | char buffer[MAX_INPUT_BUFFER]; |
@@ -118,13 +118,13 @@ enum { | |||
118 | TCP_PROTOCOL = 1, | 118 | TCP_PROTOCOL = 1, |
119 | UDP_PROTOCOL = 2, | 119 | UDP_PROTOCOL = 2, |
120 | }; | 120 | }; |
121 | int ignore_send_quit_failure = FALSE; | 121 | bool ignore_send_quit_failure = false; |
122 | 122 | ||
123 | 123 | ||
124 | int | 124 | int |
125 | main (int argc, char **argv) | 125 | main (int argc, char **argv) |
126 | { | 126 | { |
127 | short supports_tls=FALSE; | 127 | bool supports_tls = false; |
128 | int n = 0; | 128 | int n = 0; |
129 | double elapsed_time; | 129 | double elapsed_time; |
130 | long microsec; | 130 | long microsec; |
@@ -230,7 +230,7 @@ main (int argc, char **argv) | |||
230 | } else if(use_ehlo || use_lhlo){ | 230 | } else if(use_ehlo || use_lhlo){ |
231 | if(strstr(buffer, "250 STARTTLS") != NULL || | 231 | if(strstr(buffer, "250 STARTTLS") != NULL || |
232 | strstr(buffer, "250-STARTTLS") != NULL){ | 232 | strstr(buffer, "250-STARTTLS") != NULL){ |
233 | supports_tls=TRUE; | 233 | supports_tls=true; |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
@@ -466,7 +466,7 @@ main (int argc, char **argv) | |||
466 | fperfdata ("time", elapsed_time, "s", | 466 | fperfdata ("time", elapsed_time, "s", |
467 | (int)check_warning_time, warning_time, | 467 | (int)check_warning_time, warning_time, |
468 | (int)check_critical_time, critical_time, | 468 | (int)check_critical_time, critical_time, |
469 | TRUE, 0, FALSE, 0)); | 469 | true, 0, false, 0)); |
470 | 470 | ||
471 | return result; | 471 | return result; |
472 | } | 472 | } |
@@ -560,7 +560,7 @@ process_arguments (int argc, char **argv) | |||
560 | break; | 560 | break; |
561 | case 'A': | 561 | case 'A': |
562 | authtype = optarg; | 562 | authtype = optarg; |
563 | use_ehlo = TRUE; | 563 | use_ehlo = true; |
564 | break; | 564 | break; |
565 | case 'U': | 565 | case 'U': |
566 | authuser = optarg; | 566 | authuser = optarg; |
@@ -600,7 +600,7 @@ process_arguments (int argc, char **argv) | |||
600 | usage4 (_("Critical time must be a positive")); | 600 | usage4 (_("Critical time must be a positive")); |
601 | else { | 601 | else { |
602 | critical_time = strtod (optarg, NULL); | 602 | critical_time = strtod (optarg, NULL); |
603 | check_critical_time = TRUE; | 603 | check_critical_time = true; |
604 | } | 604 | } |
605 | break; | 605 | break; |
606 | case 'w': /* warning time threshold */ | 606 | case 'w': /* warning time threshold */ |
@@ -608,14 +608,14 @@ process_arguments (int argc, char **argv) | |||
608 | usage4 (_("Warning time must be a positive")); | 608 | usage4 (_("Warning time must be a positive")); |
609 | else { | 609 | else { |
610 | warning_time = strtod (optarg, NULL); | 610 | warning_time = strtod (optarg, NULL); |
611 | check_warning_time = TRUE; | 611 | check_warning_time = true; |
612 | } | 612 | } |
613 | break; | 613 | break; |
614 | case 'v': /* verbose */ | 614 | case 'v': /* verbose */ |
615 | verbose++; | 615 | verbose++; |
616 | break; | 616 | break; |
617 | case 'q': | 617 | case 'q': |
618 | ignore_send_quit_failure++; /* ignore problem sending QUIT */ | 618 | ignore_send_quit_failure = true; /* ignore problem sending QUIT */ |
619 | break; | 619 | break; |
620 | case 't': /* timeout */ | 620 | case 't': /* timeout */ |
621 | if (is_intnonneg (optarg)) { | 621 | if (is_intnonneg (optarg)) { |
@@ -645,33 +645,33 @@ process_arguments (int argc, char **argv) | |||
645 | usage2 ("Invalid certificate expiration period", optarg); | 645 | usage2 ("Invalid certificate expiration period", optarg); |
646 | days_till_exp_warn = atoi (optarg); | 646 | days_till_exp_warn = atoi (optarg); |
647 | } | 647 | } |
648 | check_cert = TRUE; | 648 | check_cert = true; |
649 | ignore_send_quit_failure = TRUE; | 649 | ignore_send_quit_failure = true; |
650 | #else | 650 | #else |
651 | usage (_("SSL support not available - install OpenSSL and recompile")); | 651 | usage (_("SSL support not available - install OpenSSL and recompile")); |
652 | #endif | 652 | #endif |
653 | case 's': | 653 | case 's': |
654 | /* ssl */ | 654 | /* ssl */ |
655 | use_ssl = TRUE; | 655 | use_ssl = true; |
656 | server_port = SMTPS_PORT; | 656 | server_port = SMTPS_PORT; |
657 | break; | 657 | break; |
658 | case 'S': | 658 | case 'S': |
659 | /* starttls */ | 659 | /* starttls */ |
660 | use_starttls = TRUE; | 660 | use_starttls = true; |
661 | use_ehlo = TRUE; | 661 | use_ehlo = true; |
662 | break; | 662 | break; |
663 | case SNI_OPTION: | 663 | case SNI_OPTION: |
664 | #ifdef HAVE_SSL | 664 | #ifdef HAVE_SSL |
665 | use_sni = TRUE; | 665 | use_sni = true; |
666 | #else | 666 | #else |
667 | usage (_("SSL support not available - install OpenSSL and recompile")); | 667 | usage (_("SSL support not available - install OpenSSL and recompile")); |
668 | #endif | 668 | #endif |
669 | break; | 669 | break; |
670 | case 'r': | 670 | case 'r': |
671 | use_proxy_prefix = TRUE; | 671 | use_proxy_prefix = true; |
672 | break; | 672 | break; |
673 | case 'L': | 673 | case 'L': |
674 | use_lhlo = TRUE; | 674 | use_lhlo = true; |
675 | break; | 675 | break; |
676 | case '4': | 676 | case '4': |
677 | address_family = AF_INET; | 677 | address_family = AF_INET; |