summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_smtp.c94
1 files changed, 46 insertions, 48 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index bc17528..c73693c 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -64,61 +64,59 @@ enum {
64 64
65#define EHLO_SUPPORTS_STARTTLS 1 65#define EHLO_SUPPORTS_STARTTLS 1
66 66
67int process_arguments (int, char **); 67static int process_arguments (int, char **);
68int validate_arguments (void); 68static int validate_arguments (void);
69void print_help (void); 69static void print_help (void);
70void print_usage (void); 70void print_usage (void);
71void smtp_quit(void); 71static void smtp_quit(void);
72int recvline(char *, size_t); 72static int recvline(char *, size_t);
73int recvlines(char *, size_t); 73static int recvlines(char *, size_t);
74int my_close(void); 74static int my_close(void);
75 75
76#include "regex.h" 76#include "regex.h"
77char regex_expect[MAX_INPUT_BUFFER] = ""; 77static regex_t preg;
78regex_t preg; 78static regmatch_t pmatch[10];
79regmatch_t pmatch[10]; 79static char errbuf[MAX_INPUT_BUFFER];
80char timestamp[20] = ""; 80static int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
81char errbuf[MAX_INPUT_BUFFER]; 81static int eflags = 0;
82int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; 82static int errcode, excode;
83int eflags = 0; 83
84int errcode, excode; 84static int server_port = SMTP_PORT;
85 85static int server_port_option = 0;
86int server_port = SMTP_PORT; 86static char *server_address = NULL;
87int server_port_option = 0; 87static char *server_expect = NULL;
88char *server_address = NULL; 88static char *mail_command = NULL;
89char *server_expect = NULL; 89static char *from_arg = NULL;
90char *mail_command = NULL; 90static int send_mail_from=0;
91char *from_arg = NULL; 91static int ncommands=0;
92int send_mail_from=0; 92static int command_size=0;
93int ncommands=0; 93static int nresponses=0;
94int command_size=0; 94static int response_size=0;
95int nresponses=0; 95static char **commands = NULL;
96int response_size=0; 96static char **responses = NULL;
97char **commands = NULL; 97static char *authtype = NULL;
98char **responses = NULL; 98static char *authuser = NULL;
99char *authtype = NULL; 99static char *authpass = NULL;
100char *authuser = NULL; 100static double warning_time = 0;
101char *authpass = NULL; 101static bool check_warning_time = false;
102double warning_time = 0; 102static double critical_time = 0;
103bool check_warning_time = false; 103static bool check_critical_time = false;
104double critical_time = 0; 104static int verbose = 0;
105bool check_critical_time = false; 105static bool use_ssl = false;
106int verbose = 0; 106static bool use_starttls = false;
107bool use_ssl = false; 107static bool use_sni = false;
108bool use_starttls = false; 108static bool use_proxy_prefix = false;
109bool use_sni = false; 109static bool use_ehlo = false;
110bool use_proxy_prefix = false; 110static bool use_lhlo = false;
111bool use_ehlo = false; 111static bool ssl_established = false;
112bool use_lhlo = false; 112static char *localhostname = NULL;
113bool ssl_established = false; 113static int sd;
114char *localhostname = NULL; 114static char buffer[MAX_INPUT_BUFFER];
115int sd;
116char buffer[MAX_INPUT_BUFFER];
117enum { 115enum {
118 TCP_PROTOCOL = 1, 116 TCP_PROTOCOL = 1,
119 UDP_PROTOCOL = 2, 117 UDP_PROTOCOL = 2,
120}; 118};
121bool ignore_send_quit_failure = false; 119static bool ignore_send_quit_failure = false;
122 120
123 121
124int 122int