summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d18b8f5)
raw | patch | inline | side by side (parent: d18b8f5)
author | Holger Weiss <hweiss@users.sourceforge.net> | |
Tue, 31 Jul 2007 14:47:04 +0000 (14:47 +0000) | ||
committer | Holger Weiss <hweiss@users.sourceforge.net> | |
Tue, 31 Jul 2007 14:47:04 +0000 (14:47 +0000) |
(noted by Dieter Hendricks on nagiosplug-help@)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1769 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1769 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_smtp.c | patch | blob | history |
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index a7a07838f9b10f5d08063467045b5f27f0aeaf25..8d392cc68c8e6b29a9b36dcfb3bbe67594acf1bd 100644 (file)
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
int validate_arguments (void);
void print_help (void);
void print_usage (void);
+void smtp_quit(void);
int my_close(void);
#include "regex.h"
if(use_ssl && ! supports_tls){
printf(_("WARNING - TLS not supported by server\n"));
- send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0);
+ smtp_quit();
return STATE_WARNING;
}
recv(sd,buffer, MAX_INPUT_BUFFER-1, 0); /* wait for it */
if (!strstr (buffer, server_expect)) {
printf (_("Server does not support STARTTLS\n"));
- send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0);
+ smtp_quit();
return STATE_UNKNOWN;
}
result = np_net_ssl_init(sd);
}
/* tell the server we're done */
- my_send (SMTP_QUIT, strlen (SMTP_QUIT));
+ smtp_quit();
/* finally close the connection */
close (sd);
}
+void
+smtp_quit(void)
+{
+ int bytes;
+
+ my_send(SMTP_QUIT, strlen(SMTP_QUIT));
+ if (verbose)
+ printf(_("sent %s\n"), "QUIT");
+
+ /* read the response but don't care about problems */
+ bytes = my_recv(buffer, MAXBUF - 1);
+ if (verbose) {
+ if (bytes < 0)
+ printf(_("recv() failed after QUIT."));
+ else if (bytes == 0)
+ printf(_("Connection reset by peer."));
+ else {
+ buffer[bytes] = '\0';
+ printf(_("received %s\n"), buffer);
+ }
+ }
+}
+
+
int
my_close (void)
{