aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/0001-sendmail-automatically-determine-sender-if-not-speci.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/busybox/0001-sendmail-automatically-determine-sender-if-not-speci.patch')
-rw-r--r--main/busybox/0001-sendmail-automatically-determine-sender-if-not-speci.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/main/busybox/0001-sendmail-automatically-determine-sender-if-not-speci.patch b/main/busybox/0001-sendmail-automatically-determine-sender-if-not-speci.patch
new file mode 100644
index 0000000000..8b6df8ad96
--- /dev/null
+++ b/main/busybox/0001-sendmail-automatically-determine-sender-if-not-speci.patch
@@ -0,0 +1,57 @@
+From a2a978538c82999dc7d4018827e0f96188a135de Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Wed, 22 Jan 2014 00:41:49 +0200
+Subject: [PATCH] sendmail: automatically determine sender if not specified
+
+Make the -f option optional. If not given, construct the sender
+address from the username and fully qualified hostname.
+
+This is required to interoperate with the cron applet.
+---
+ mailutils/sendmail.c | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
+index b5aa1d1..b99c42f 100644
+--- a/mailutils/sendmail.c
++++ b/mailutils/sendmail.c
+@@ -199,8 +199,8 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
+ G.fp0 = xfdopen_for_read(3);
+
+ // parse options
+- // -v is a counter, -f is required. -H and -S are mutually exclusive, -a is a list
+- opt_complementary = "vv:f:w+:H--S:S--H:a::";
++ // -v is a counter, -H and -S are mutually exclusive, -a is a list
++ opt_complementary = "vv:w+:H--S:S--H:a::";
+ // N.B. since -H and -S are mutually exclusive they do not interfere in opt_connect
+ // -a is for ssmtp (http://downloads.openwrt.org/people/nico/man/man8/ssmtp.8.html) compatibility,
+ // it is still under development.
+@@ -279,7 +279,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) {
+@@ -305,12 +304,11 @@ int sendmail_main(int argc UNUSED_PARAM, char **argv)
+ // file descriptor (e.g. 4), or again from a secured file.
+
+ // got no sender address? -> use system username as a resort
+- // N.B. we marked -f as required option!
+- //if (!G.user) {
+- // // N.B. IMHO getenv("USER") can be way easily spoofed!
+- // G.user = xuid2uname(getuid());
+- // opt_from = xasprintf("%s@%s", G.user, domain);
+- //}
++ if (!G.user) G.user = xuid2uname(getuid());
++ if (!opt_from)
++ opt_from = xasprintf("%s@%s", G.user, xgethostbyname(host)->h_name);
++ free(host);
++
+ smtp_checkp("MAIL FROM:<%s>", opt_from, 250);
+
+ // process message
+--
+1.8.3.1
+