diff options
Diffstat (limited to 'plugins/check_smtp.c')
| -rw-r--r-- | plugins/check_smtp.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 2e9b68b1..587a7245 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
| @@ -59,10 +59,6 @@ enum { | |||
| 59 | #define SMTP_STARTTLS "STARTTLS\r\n" | 59 | #define SMTP_STARTTLS "STARTTLS\r\n" |
| 60 | #define SMTP_AUTH_LOGIN "AUTH LOGIN\r\n" | 60 | #define SMTP_AUTH_LOGIN "AUTH LOGIN\r\n" |
| 61 | 61 | ||
| 62 | #ifndef HOST_MAX_BYTES | ||
| 63 | #define HOST_MAX_BYTES 255 | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #define EHLO_SUPPORTS_STARTTLS 1 | 62 | #define EHLO_SUPPORTS_STARTTLS 1 |
| 67 | 63 | ||
| 68 | int process_arguments (int, char **); | 64 | int process_arguments (int, char **); |
| @@ -231,7 +227,7 @@ main (int argc, char **argv) | |||
| 231 | send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0); | 227 | send(sd, SMTP_STARTTLS, strlen(SMTP_STARTTLS), 0); |
| 232 | 228 | ||
| 233 | recvlines(buffer, MAX_INPUT_BUFFER); /* wait for it */ | 229 | recvlines(buffer, MAX_INPUT_BUFFER); /* wait for it */ |
| 234 | if (!strstr (buffer, server_expect)) { | 230 | if (!strstr (buffer, SMTP_EXPECT)) { |
| 235 | printf (_("Server does not support STARTTLS\n")); | 231 | printf (_("Server does not support STARTTLS\n")); |
| 236 | smtp_quit(); | 232 | smtp_quit(); |
| 237 | return STATE_UNKNOWN; | 233 | return STATE_UNKNOWN; |
| @@ -239,8 +235,8 @@ main (int argc, char **argv) | |||
| 239 | result = np_net_ssl_init(sd); | 235 | result = np_net_ssl_init(sd); |
| 240 | if(result != STATE_OK) { | 236 | if(result != STATE_OK) { |
| 241 | printf (_("CRITICAL - Cannot create SSL context.\n")); | 237 | printf (_("CRITICAL - Cannot create SSL context.\n")); |
| 242 | np_net_ssl_cleanup(); | ||
| 243 | close(sd); | 238 | close(sd); |
| 239 | np_net_ssl_cleanup(); | ||
| 244 | return STATE_CRITICAL; | 240 | return STATE_CRITICAL; |
| 245 | } else { | 241 | } else { |
| 246 | ssl_established = 1; | 242 | ssl_established = 1; |
| @@ -764,10 +760,12 @@ recvlines(char *buf, size_t bufsize) | |||
| 764 | int | 760 | int |
| 765 | my_close (void) | 761 | my_close (void) |
| 766 | { | 762 | { |
| 763 | int result; | ||
| 764 | result = close(sd); | ||
| 767 | #ifdef HAVE_SSL | 765 | #ifdef HAVE_SSL |
| 768 | np_net_ssl_cleanup(); | 766 | np_net_ssl_cleanup(); |
| 769 | #endif | 767 | #endif |
| 770 | return close(sd); | 768 | return result; |
| 771 | } | 769 | } |
| 772 | 770 | ||
| 773 | 771 | ||
