--- nagiosplug-1.3-beta1/plugins/check_smtp.c Mon Jun 10 05:24:06 2002 +++ nagiosplug-1.3-beta1-BALU/plugins/check_smtp.c Tue Sep 3 15:01:09 2002 @@ -49,7 +49,8 @@ * You can disable sending DUMMYCMD by undefining SMTP_USE_DUMMYCMD. */ #define SMTP_DUMMYCMD "MAIL\n" -#define SMTP_USE_DUMMYCMD 1 +// BALU 20020903: added "--sendmail", so it is not needed anymore +// #define SMTP_USE_DUMMYCMD 1 #define SMTP_QUIT "QUIT\n" int process_arguments (int, char **); @@ -67,6 +68,7 @@ int critical_time = 0; int check_critical_time = FALSE; int verbose = FALSE; +int sendmail = FALSE; int main (int argc, char **argv) @@ -138,11 +140,11 @@ } /* close the connection */ -#ifdef SMTP_USE_DUMMYCMD - send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0); - /* allow for response to DUMMYCMD to reach us */ - recv(sd,buffer,MAX_INPUT_BUFFER-1,0); -#endif /* SMTP_USE_DUMMYCMD */ + if (sendmail == TRUE) { + send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0); + /* allow for response to DUMMYCMD to reach us */ + recv(sd,buffer,MAX_INPUT_BUFFER-1,0); + } send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); close (sd); @@ -225,17 +227,17 @@ {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, + {"sendmail", no_argument, 0, 's'}, {0, 0, 0, 0} }; #endif while (1) { #ifdef HAVE_GETOPT_H - c = - getopt_long (argc, argv, "+hVvt:p:e:c:w:H:", long_options, + c = getopt_long (argc, argv, "+?hVvst:p:e:c:w:H:", long_options, &option_index); #else - c = getopt (argc, argv, "+?hVvt:p:e:c:w:H:"); + c = getopt (argc, argv, "+?hVvst:p:e:c:w:H:"); #endif i++; @@ -250,6 +252,7 @@ case 'c': case 'w': case 'H': + case 's': i++; } @@ -302,6 +305,9 @@ usage ("Time interval must be a nonnegative integer\n"); } break; + case 's': /* sendmail-quirk? */ + sendmail = TRUE; + break; case 'V': /* version */ print_revision (PROGNAME, "$Revision: 1.2 $"); exit (STATE_OK); @@ -356,7 +362,9 @@ " -h, --help\n" " Print detailed help screen\n" " -V, --version\n" - " Print version information\n\n", + " Print version information\n" + " -s, --sendmail\n" + " Enable dummy command to stop sendmail from logging NOQUEUE\n\n", SMTP_PORT, SMTP_EXPECT, DEFAULT_SOCKET_TIMEOUT); support (); } @@ -369,7 +377,7 @@ print_usage (void) { printf - ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit] [-t timeout] [-v]\n" + ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit] [-t timeout] [-v] [-s]\n" " %s --help\n" " %s --version\n", PROGNAME, PROGNAME, PROGNAME); }