diff options
Diffstat (limited to 'web/attachments/30350-check_smtp.c.diff')
| -rw-r--r-- | web/attachments/30350-check_smtp.c.diff | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/web/attachments/30350-check_smtp.c.diff b/web/attachments/30350-check_smtp.c.diff new file mode 100644 index 0000000..aa1c86c --- /dev/null +++ b/web/attachments/30350-check_smtp.c.diff | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | --- nagiosplug-1.3-beta1/plugins/check_smtp.c Mon Jun 10 05:24:06 2002 | ||
| 2 | +++ nagiosplug-1.3-beta1-BALU/plugins/check_smtp.c Tue Sep 3 15:01:09 2002 | ||
| 3 | @@ -49,7 +49,8 @@ | ||
| 4 | * You can disable sending DUMMYCMD by undefining SMTP_USE_DUMMYCMD. | ||
| 5 | */ | ||
| 6 | #define SMTP_DUMMYCMD "MAIL\n" | ||
| 7 | -#define SMTP_USE_DUMMYCMD 1 | ||
| 8 | +// BALU 20020903: added "--sendmail", so it is not needed anymore | ||
| 9 | +// #define SMTP_USE_DUMMYCMD 1 | ||
| 10 | #define SMTP_QUIT "QUIT\n" | ||
| 11 | |||
| 12 | int process_arguments (int, char **); | ||
| 13 | @@ -67,6 +68,7 @@ | ||
| 14 | int critical_time = 0; | ||
| 15 | int check_critical_time = FALSE; | ||
| 16 | int verbose = FALSE; | ||
| 17 | +int sendmail = FALSE; | ||
| 18 | |||
| 19 | int | ||
| 20 | main (int argc, char **argv) | ||
| 21 | @@ -138,11 +140,11 @@ | ||
| 22 | } | ||
| 23 | |||
| 24 | /* close the connection */ | ||
| 25 | -#ifdef SMTP_USE_DUMMYCMD | ||
| 26 | - send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0); | ||
| 27 | - /* allow for response to DUMMYCMD to reach us */ | ||
| 28 | - recv(sd,buffer,MAX_INPUT_BUFFER-1,0); | ||
| 29 | -#endif /* SMTP_USE_DUMMYCMD */ | ||
| 30 | + if (sendmail == TRUE) { | ||
| 31 | + send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0); | ||
| 32 | + /* allow for response to DUMMYCMD to reach us */ | ||
| 33 | + recv(sd,buffer,MAX_INPUT_BUFFER-1,0); | ||
| 34 | + } | ||
| 35 | |||
| 36 | send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); | ||
| 37 | close (sd); | ||
| 38 | @@ -225,17 +227,17 @@ | ||
| 39 | {"verbose", no_argument, 0, 'v'}, | ||
| 40 | {"version", no_argument, 0, 'V'}, | ||
| 41 | {"help", no_argument, 0, 'h'}, | ||
| 42 | + {"sendmail", no_argument, 0, 's'}, | ||
| 43 | {0, 0, 0, 0} | ||
| 44 | }; | ||
| 45 | #endif | ||
| 46 | |||
| 47 | while (1) { | ||
| 48 | #ifdef HAVE_GETOPT_H | ||
| 49 | - c = | ||
| 50 | - getopt_long (argc, argv, "+hVvt:p:e:c:w:H:", long_options, | ||
| 51 | + c = getopt_long (argc, argv, "+?hVvst:p:e:c:w:H:", long_options, | ||
| 52 | &option_index); | ||
| 53 | #else | ||
| 54 | - c = getopt (argc, argv, "+?hVvt:p:e:c:w:H:"); | ||
| 55 | + c = getopt (argc, argv, "+?hVvst:p:e:c:w:H:"); | ||
| 56 | #endif | ||
| 57 | |||
| 58 | i++; | ||
| 59 | @@ -250,6 +252,7 @@ | ||
| 60 | case 'c': | ||
| 61 | case 'w': | ||
| 62 | case 'H': | ||
| 63 | + case 's': | ||
| 64 | i++; | ||
| 65 | } | ||
| 66 | |||
| 67 | @@ -302,6 +305,9 @@ | ||
| 68 | usage ("Time interval must be a nonnegative integer\n"); | ||
| 69 | } | ||
| 70 | break; | ||
| 71 | + case 's': /* sendmail-quirk? */ | ||
| 72 | + sendmail = TRUE; | ||
| 73 | + break; | ||
| 74 | case 'V': /* version */ | ||
| 75 | print_revision (PROGNAME, "$Revision: 1.2 $"); | ||
| 76 | exit (STATE_OK); | ||
| 77 | @@ -356,7 +362,9 @@ | ||
| 78 | " -h, --help\n" | ||
| 79 | " Print detailed help screen\n" | ||
| 80 | " -V, --version\n" | ||
| 81 | - " Print version information\n\n", | ||
| 82 | + " Print version information\n" | ||
| 83 | + " -s, --sendmail\n" | ||
| 84 | + " Enable dummy command to stop sendmail from logging NOQUEUE\n\n", | ||
| 85 | SMTP_PORT, SMTP_EXPECT, DEFAULT_SOCKET_TIMEOUT); | ||
| 86 | support (); | ||
| 87 | } | ||
| 88 | @@ -369,7 +377,7 @@ | ||
| 89 | print_usage (void) | ||
| 90 | { | ||
| 91 | printf | ||
| 92 | - ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit] [-t timeout] [-v]\n" | ||
| 93 | + ("Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit] [-t timeout] [-v] [-s]\n" | ||
| 94 | " %s --help\n" | ||
| 95 | " %s --version\n", PROGNAME, PROGNAME, PROGNAME); | ||
| 96 | } | ||
