diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2013-02-25 00:45:12 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-03-18 18:46:31 +0100 |
commit | e82bfef8395bc0aff7c770bfadcd9e58a48ffc04 (patch) | |
tree | b7bc02664313653fa903890c43338b29e3658dc7 | |
parent | 4a732220e907bfed95e87be38cea6e15253a9ad8 (diff) | |
download | busybox-w32-e82bfef8395bc0aff7c770bfadcd9e58a48ffc04.tar.gz busybox-w32-e82bfef8395bc0aff7c770bfadcd9e58a48ffc04.tar.bz2 busybox-w32-e82bfef8395bc0aff7c770bfadcd9e58a48ffc04.zip |
sendmail: don't add multiple To: headers
When adding To: header, add only a single header. If there are multiple
addresses, make it multiline.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | mailutils/sendmail.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c index 36a1b97cb..d58f503a0 100644 --- a/mailutils/sendmail.c +++ b/mailutils/sendmail.c | |||
@@ -365,7 +365,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) | |||
365 | continue; // N.B. Bcc: vanishes from headers! | 365 | continue; // N.B. Bcc: vanishes from headers! |
366 | } | 366 | } |
367 | } | 367 | } |
368 | check_hdr = list && isspace(s[0]); | 368 | check_hdr = (list && isspace(s[0])); |
369 | if (strchr(s, ':') || check_hdr) { | 369 | if (strchr(s, ':') || check_hdr) { |
370 | // other headers go verbatim | 370 | // other headers go verbatim |
371 | // N.B. RFC2822 2.2.3 "Long Header Fields" allows for headers to occupy several lines. | 371 | // N.B. RFC2822 2.2.3 "Long Header Fields" allows for headers to occupy several lines. |
@@ -389,14 +389,27 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) | |||
389 | // so stop "analyze headers" mode | 389 | // so stop "analyze headers" mode |
390 | reenter: | 390 | reenter: |
391 | // put recipients specified on cmdline | 391 | // put recipients specified on cmdline |
392 | check_hdr = 1; | ||
392 | while (*argv) { | 393 | while (*argv) { |
393 | char *t = sane_address(*argv); | 394 | char *t = sane_address(*argv); |
394 | rcptto(t); | 395 | rcptto(t); |
395 | //if (MAX_HEADERS && ++nheaders >= MAX_HEADERS) | 396 | //if (MAX_HEADERS && ++nheaders >= MAX_HEADERS) |
396 | // goto bail; | 397 | // goto bail; |
397 | if (!has_to) | 398 | if (!has_to) { |
399 | const char *hdr; | ||
400 | |||
401 | if (check_hdr && argv[1]) | ||
402 | hdr = "To: %s,"; | ||
403 | else if (check_hdr) | ||
404 | hdr = "To: %s"; | ||
405 | else if (argv[1]) | ||
406 | hdr = "To: %s," + 3; | ||
407 | else | ||
408 | hdr = "To: %s" + 3; | ||
398 | llist_add_to_end(&list, | 409 | llist_add_to_end(&list, |
399 | xasprintf("To: %s", t)); | 410 | xasprintf(hdr, t)); |
411 | check_hdr = 0; | ||
412 | } | ||
400 | argv++; | 413 | argv++; |
401 | } | 414 | } |
402 | // enter "put message" mode | 415 | // enter "put message" mode |