diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2012-06-29 15:09:34 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2012-06-29 15:09:34 +0200 |
| commit | b57aeb1e5f6099ef97a178ff0e9ed22f0e7a1caf (patch) | |
| tree | 1e861f0cc5aef5265f46bfef07a87bc6356a7914 | |
| parent | 973d147cef8e2362d74ea75fa9379ea4a8ba6989 (diff) | |
| download | monitoring-plugins-b57aeb1e5f6099ef97a178ff0e9ed22f0e7a1caf.tar.gz | |
check_smtp: Remove a comment regarding MAIL FROM
Earlier versions of check_smtp generated an (invalid) "MAIL FROM"
command without arguments by default. These days, a "MAIL FROM" command
is only sent if the --from option is specified.
This commit removes a comment which explains the old behaviour, and it
updates a variable name accordingly.
| -rw-r--r-- | plugins/check_smtp.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index 58367a36..3758fd91 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
| @@ -87,9 +87,7 @@ int errcode, excode; | |||
| 87 | int server_port = SMTP_PORT; | 87 | int server_port = SMTP_PORT; |
| 88 | char *server_address = NULL; | 88 | char *server_address = NULL; |
| 89 | char *server_expect = NULL; | 89 | char *server_expect = NULL; |
| 90 | int smtp_use_dummycmd = 0; | 90 | int send_mail_from=0; |
| 91 | char *mail_command = NULL; | ||
| 92 | char *from_arg = NULL; | ||
| 93 | int ncommands=0; | 91 | int ncommands=0; |
| 94 | int command_size=0; | 92 | int command_size=0; |
| 95 | int nresponses=0; | 93 | int nresponses=0; |
| @@ -166,7 +164,7 @@ main (int argc, char **argv) | |||
| 166 | /* initialize the MAIL command with optional FROM command */ | 164 | /* initialize the MAIL command with optional FROM command */ |
| 167 | xasprintf (&cmd_str, "%sFROM:<%s>%s", mail_command, from_arg, "\r\n"); | 165 | xasprintf (&cmd_str, "%sFROM:<%s>%s", mail_command, from_arg, "\r\n"); |
| 168 | 166 | ||
| 169 | if (verbose && smtp_use_dummycmd) | 167 | if (verbose && send_mail_from) |
| 170 | printf ("FROM CMD: %s", cmd_str); | 168 | printf ("FROM CMD: %s", cmd_str); |
| 171 | 169 | ||
| 172 | /* initialize alarm signal handling */ | 170 | /* initialize alarm signal handling */ |
| @@ -283,16 +281,7 @@ main (int argc, char **argv) | |||
| 283 | } | 281 | } |
| 284 | #endif | 282 | #endif |
| 285 | 283 | ||
| 286 | /* sendmail will syslog a "NOQUEUE" error if session does not attempt | 284 | if (send_mail_from) { |
| 287 | * to do something useful. This can be prevented by giving a command | ||
| 288 | * even if syntax is illegal (MAIL requires a FROM:<...> argument) | ||
| 289 | * | ||
| 290 | * According to rfc821 you can include a null reversepath in the from command | ||
| 291 | * - but a log message is generated on the smtp server. | ||
| 292 | * | ||
| 293 | * Use the -f option to provide a FROM address | ||
| 294 | */ | ||
| 295 | if (smtp_use_dummycmd) { | ||
| 296 | my_send(cmd_str, strlen(cmd_str)); | 285 | my_send(cmd_str, strlen(cmd_str)); |
| 297 | if (recvlines(buffer, MAX_INPUT_BUFFER) >= 1 && verbose) | 286 | if (recvlines(buffer, MAX_INPUT_BUFFER) >= 1 && verbose) |
| 298 | printf("%s", buffer); | 287 | printf("%s", buffer); |
| @@ -521,7 +510,7 @@ process_arguments (int argc, char **argv) | |||
| 521 | case 'f': /* from argument */ | 510 | case 'f': /* from argument */ |
| 522 | from_arg = optarg + strspn(optarg, "<"); | 511 | from_arg = optarg + strspn(optarg, "<"); |
| 523 | from_arg = strndup(from_arg, strcspn(from_arg, ">")); | 512 | from_arg = strndup(from_arg, strcspn(from_arg, ">")); |
| 524 | smtp_use_dummycmd = 1; | 513 | send_mail_from = 1; |
| 525 | break; | 514 | break; |
| 526 | case 'A': | 515 | case 'A': |
| 527 | authtype = optarg; | 516 | authtype = optarg; |
