sendmail: don't mangle e-mail headers
authorAaro Koskinen <aaro.koskinen@iki.fi>
Sun, 24 Feb 2013 22:45:07 +0000 (00:45 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 18 Mar 2013 17:45:13 +0000 (18:45 +0100)
Leave the original To: and Cc: headers untouched, when we try to extract
addresses from them.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
mailutils/sendmail.c

index 4f73512e99402f0014a8a679ad9fd5730e94b273..0f536adae773ffc348423f9058a5de12a26e3a50 100644 (file)
@@ -299,7 +299,9 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
                // To: or Cc: headers add recipients
                if (opts & OPT_t) {
                        if (0 == strncasecmp("To:", s, 3) || 0 == strncasecmp("Bcc:" + 1, s, 3)) {
-                               rcptto(sane_address(s+3));
+                               char *r = xstrdup(s+3);
+                               rcptto(sane_address(r));
+                               free(r);
                                goto addheader;
                        }
                        // Bcc: header adds blind copy (hidden) recipient