summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-02-09 08:49:36 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2014-02-09 08:49:36 (GMT)
commit4e03d4134202b117a29ecf5933a7a55e2a8532a4 (patch)
treedc0dcb3fcd39600f6c7c6c9f795ef3ac00ade2f9
parent744ee5db1c2d6c34c1988343728b2fc37a908f83 (diff)
downloadbusybox-4e03d4134202b117a29ecf5933a7a55e2a8532a4.tar.gz
busybox-4e03d4134202b117a29ecf5933a7a55e2a8532a4.tar.bz2
sendmail: use FQDN in default envelope sender
RFC 5321 requires the return path to be supplied with a proper domain name. Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--mailutils/sendmail.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index 824109d..9455b4e 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -326,7 +326,6 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
// we should start with modern EHLO
if (250 != smtp_checkp("EHLO %s", host, -1))
smtp_checkp("HELO %s", host, 250);
- free(host);
// perform authentication
if (opts & OPT_a) {
@@ -353,8 +352,11 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
// got no sender address? use auth name, then UID username as a last resort
if (!opt_from) {
- opt_from = G.user ? G.user : xuid2uname(getuid());
+ opt_from = xasprintf("%s@%s",
+ G.user ? G.user : xuid2uname(getuid()),
+ xgethostbyname(host)->h_name);
}
+ free(host);
smtp_checkp("MAIL FROM:<%s>", opt_from, 250);