[Pkg-nagios-devel] nagios-plugins/debian/patches 00list, 1.8,
1.9 14_check_log_paths.dpatch, 1.1,
1.2 16_check_smtp_protocolfix.dpatch, NONE, 1.1
seanius at haydn.debian.org
seanius at haydn.debian.org
Sun Oct 9 22:31:20 UTC 2005
Update of /cvsroot/pkg-nagios/nagios-plugins/debian/patches
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv32766/debian/patches
Modified Files:
00list 14_check_log_paths.dpatch
Added Files:
16_check_smtp_protocolfix.dpatch
Log Message:
protocol fix in check_smtp
Index: 00list
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios-plugins/debian/patches/00list,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- 00list 9 Oct 2005 15:45:40 -0000 1.8
+++ 00list 9 Oct 2005 22:31:17 -0000 1.9
@@ -5,3 +5,4 @@
13_subst.in_again.dpatch
14_check_log_paths.dpatch
15_check_mrtg_wtf_conditionals.dpatch
+16_check_smtp_protocolfix.dpatch
Index: 14_check_log_paths.dpatch
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios-plugins/debian/patches/14_check_log_paths.dpatch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- 14_check_log_paths.dpatch 9 Oct 2005 15:02:15 -0000 1.1
+++ 14_check_log_paths.dpatch 9 Oct 2005 22:31:17 -0000 1.2
@@ -7,7 +7,7 @@
@DPATCH@
diff -urNad nagios-plugins~/plugins-scripts/check_log.sh nagios-plugins/plugins-scripts/check_log.sh
--- nagios-plugins~/plugins-scripts/check_log.sh 2005-02-04 00:51:35.000000000 +0100
-+++ nagios-plugins/plugins-scripts/check_log.sh 2005-10-09 16:59:27.000000000 +0200
++++ nagios-plugins/plugins-scripts/check_log.sh 2005-10-09 17:29:46.000000000 +0200
@@ -62,12 +62,12 @@
ECHO="/bin/echo"
--- NEW FILE: 16_check_smtp_protocolfix.dpatch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 16_check_smtp_protocolfix.dpatch by <seanius at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad nagios-plugins~/plugins/check_smtp.c nagios-plugins/plugins/check_smtp.c
--- nagios-plugins~/plugins/check_smtp.c 2005-10-10 00:26:43.000000000 +0200
+++ nagios-plugins/plugins/check_smtp.c 2005-10-10 00:27:00.000000000 +0200
@@ -59,10 +59,17 @@
enum {
SMTP_PORT = 25
};
-const char *SMTP_EXPECT = "220";
-const char *SMTP_HELO = "HELO ";
-const char *SMTP_QUIT = "QUIT\r\n";
-const char *SMTP_STARTTLS = "STARTTLS\r\n";
+#define SMTP_EXPECT "220"
+#define SMTP_HELO "HELO "
+#define SMTP_EHLO "EHLO "
+#define SMTP_QUIT "QUIT\r\n"
+#define SMTP_STARTTLS "STARTTLS\r\n"
+
+#ifndef HOST_MAX_BYTES
+#define HOST_MAX_BYTES 255
+#endif
+
+#define EHLO_SUPPORTS_STARTTLS 1
int process_arguments (int, char **);
int validate_arguments (void);
@@ -101,6 +108,7 @@
int check_critical_time = FALSE;
int verbose = 0;
int use_ssl = FALSE;
+short use_ehlo = FALSE;
int sd;
char buffer[MAX_INPUT_BUFFER];
enum {
@@ -112,13 +120,14 @@
int
main (int argc, char **argv)
{
-
+ short supports_tls=FALSE;
int n = 0;
double elapsed_time;
long microsec;
- int result = STATE_UNKNOWN;
+ int amt_read=0, result = STATE_UNKNOWN;
char *cmd_str = NULL;
char *helocmd = NULL;
+ char *ehlo_resp = NULL;
struct timeval tv;
setlocale (LC_ALL, "");
@@ -129,12 +138,12 @@
usage4 (_("Could not parse arguments"));
/* initialize the HELO command with the localhostname */
-#ifndef HOST_MAX_BYTES
-#define HOST_MAX_BYTES 255
-#endif
helocmd = malloc (HOST_MAX_BYTES);
gethostname(helocmd, HOST_MAX_BYTES);
- asprintf (&helocmd, "%s%s%s", SMTP_HELO, helocmd, "\r\n");
+ if(use_ehlo)
+ asprintf (&helocmd, "%s%s%s", SMTP_EHLO, helocmd, "\r\n");
+ else
+ asprintf (&helocmd, "%s%s%s", SMTP_HELO, helocmd, "\r\n");
/* initialize the MAIL command with optional FROM command */
asprintf (&cmd_str, "%sFROM: %s%s", mail_command, from_arg, "\r\n");
@@ -178,11 +187,25 @@
}
}
- /* send the HELO command */
+ /* send the HELO/EHLO command */
send(sd, helocmd, strlen(helocmd), 0);
/* allow for response to helo command to reach us */
- read (sd, buffer, MAXBUF - 1);
+ if(read (sd, buffer, MAXBUF - 1) < 0){
+ printf (_("recv() failed\n"));
+ return STATE_WARNING;
+ } else if(use_ehlo){
+ buffer[MAXBUF-1]='\0';
+ if(strstr(buffer, "250 STARTTLS") != NULL ||
+ strstr(buffer, "250-STARTTLS") != NULL){
+ supports_tls=TRUE;
+ }
+ }
+
+ if(use_ssl && ! supports_tls){
+ printf(_("WARNING - TLS not supported by server\n"));
+ return STATE_WARNING;
+ }
#ifdef HAVE_SSL
if(use_ssl) {
@@ -439,6 +462,7 @@
case 'S':
/* starttls */
use_ssl = TRUE;
+ use_ehlo = TRUE;
break;
case 'D':
/* Check SSL cert validity */
More information about the Pkg-nagios-devel
mailing list