diff options
Diffstat (limited to 'web/attachments/27407-nagios-plugins-check_smtp.patch')
-rw-r--r-- | web/attachments/27407-nagios-plugins-check_smtp.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/web/attachments/27407-nagios-plugins-check_smtp.patch b/web/attachments/27407-nagios-plugins-check_smtp.patch new file mode 100644 index 0000000..be08038 --- /dev/null +++ b/web/attachments/27407-nagios-plugins-check_smtp.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | --- nagios-plugins/plugins/check_smtp.c Thu Jun 13 13:49:38 2002 | ||
2 | +++ nagios-plugins.patched/plugins/check_smtp.c Fri Jul 19 14:03:19 2002 | ||
3 | @@ -50,8 +50,13 @@ | ||
4 | */ | ||
5 | #define SMTP_DUMMYCMD "MAIL\r\n" | ||
6 | #define SMTP_USE_DUMMYCMD 1 | ||
7 | +#define SMTP_USE_HELOCMD 1 | ||
8 | #define SMTP_QUIT "QUIT\r\n" | ||
9 | |||
10 | +#ifdef SMTP_USE_HELOCMD | ||
11 | +#undef SMTP_USE_DUMMYCMD | ||
12 | +#endif /* SMTP_USE_HELOCMD */ | ||
13 | + | ||
14 | int process_arguments (int, char **); | ||
15 | int call_getopt (int, char **); | ||
16 | int validate_arguments (void); | ||
17 | @@ -74,6 +79,10 @@ | ||
18 | int sd; | ||
19 | int result; | ||
20 | char buffer[MAX_INPUT_BUFFER] = ""; | ||
21 | +#ifdef SMTP_USE_HELOCMD | ||
22 | + char helocmd[255] = "HELO "; | ||
23 | + char myhostname[248]; | ||
24 | +#endif /* SMTP_USE_HELOCMD */ | ||
25 | |||
26 | if (process_arguments (argc, argv) != OK) | ||
27 | usage ("Invalid command arguments supplied\n"); | ||
28 | @@ -137,13 +146,22 @@ | ||
29 | } | ||
30 | } | ||
31 | |||
32 | - /* close the connection */ | ||
33 | +#ifdef SMTP_USE_HELOCMD | ||
34 | + gethostname(myhostname, sizeof(myhostname)); | ||
35 | + strcat(helocmd,myhostname); | ||
36 | + strcat(helocmd,"\r\n"); | ||
37 | + send(sd,helocmd,strlen(helocmd),0); | ||
38 | + /* allow for response to helo command to reach us */ | ||
39 | + recv(sd,buffer,MAX_INPUT_BUFFER-1,0); | ||
40 | +#endif /* SMTP_USE_HELOCMD */ | ||
41 | + | ||
42 | #ifdef SMTP_USE_DUMMYCMD | ||
43 | send(sd,SMTP_DUMMYCMD,strlen(SMTP_DUMMYCMD),0); | ||
44 | /* allow for response to DUMMYCMD to reach us */ | ||
45 | recv(sd,buffer,MAX_INPUT_BUFFER-1,0); | ||
46 | #endif /* SMTP_USE_DUMMYCMD */ | ||
47 | |||
48 | + /* close the connection */ | ||
49 | send (sd, SMTP_QUIT, strlen (SMTP_QUIT), 0); | ||
50 | close (sd); | ||
51 | } | ||
52 | |||