diff options
author | Aaro Koskinen | 2013-02-25 00:45:12 +0200 |
---|---|---|
committer | Denys Vlasenko | 2013-03-18 18:46:31 +0100 |
commit | e82bfef8395bc0aff7c770bfadcd9e58a48ffc04 (patch) | |
tree | b7bc02664313653fa903890c43338b29e3658dc7 /mailutils | |
parent | 4a732220e907bfed95e87be38cea6e15253a9ad8 (diff) | |
download | busybox-e82bfef8395bc0aff7c770bfadcd9e58a48ffc04.zip busybox-e82bfef8395bc0aff7c770bfadcd9e58a48ffc04.tar.gz |
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>
Diffstat (limited to 'mailutils')
-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 36a1b97..d58f503 100644 --- a/mailutils/sendmail.c +++ b/mailutils/sendmail.c @@ -365,7 +365,7 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv) continue; // N.B. Bcc: vanishes from headers! } } - check_hdr = list && isspace(s[0]); + check_hdr = (list && isspace(s[0])); if (strchr(s, ':') || check_hdr) { // other headers go verbatim // 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) // so stop "analyze headers" mode reenter: // put recipients specified on cmdline + check_hdr = 1; while (*argv) { char *t = sane_address(*argv); rcptto(t); //if (MAX_HEADERS && ++nheaders >= MAX_HEADERS) // goto bail; - if (!has_to) + if (!has_to) { + const char *hdr; + + if (check_hdr && argv[1]) + hdr = "To: %s,"; + else if (check_hdr) + hdr = "To: %s"; + else if (argv[1]) + hdr = "To: %s," + 3; + else + hdr = "To: %s" + 3; llist_add_to_end(&list, - xasprintf("To: %s", t)); + xasprintf(hdr, t)); + check_hdr = 0; + } argv++; } // enter "put message" mode |