Commit 355f5aa8 authored by Mike Hibler's avatar Mike Hibler

Make sure we use -i for sendmail when we pipe into it.

This prevents a line with a single "." from meaning EOF to sendmail.
How arcane!

I discovered this when I ran a create_image and I didn't get the complete
log mailed to me. This is because create_image did a frisbee download of an
image with a single chunk, which of course printed out:

  Using Multicast 235.252.1.187
  Joined the team after 0 sec. ID is 1586355915. File is 1 chunks (963200 bytes)
  .

Fortunately, "arcane" is my middle name, so it didn't take me long to find
this...
parent 7b1a9c6a
...@@ -94,6 +94,6 @@ Thanks, ...@@ -94,6 +94,6 @@ Thanks,
@TBOPSEMAIL_NOSLASH@ @TBOPSEMAIL_NOSLASH@
MESSAGE MESSAGE
) | /usr/sbin/sendmail -t ) | /usr/sbin/sendmail -i -t
done done
...@@ -3471,7 +3471,7 @@ sub SetupSendMail($$) ...@@ -3471,7 +3471,7 @@ sub SetupSendMail($$)
{ {
my ($isfatal, $msg) = @_; my ($isfatal, $msg) = @_;
if (! open(MAIL, "|/usr/sbin/sendmail -t")) { if (! open(MAIL, "|/usr/sbin/sendmail -i -t")) {
die("*** $0:\n". die("*** $0:\n".
" SENDMAIL: Could not start sendmail: $!\n". " SENDMAIL: Could not start sendmail: $!\n".
" $msg\n"); " $msg\n");
......
#!/usr/bin/perl -wT #!/usr/bin/perl -wT
# #
# Copyright (c) 2000-2013 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -68,7 +68,7 @@ sub SENDMAILWith($$$$;$$@); ...@@ -68,7 +68,7 @@ sub SENDMAILWith($$$$;$$@);
sub SENDMAIL($$$;$$@) sub SENDMAIL($$$;$$@)
{ {
my($To, $Subject, $Message, $From, $Headers, @Files) = @_; my($To, $Subject, $Message, $From, $Headers, @Files) = @_;
SENDMAILWith("/usr/sbin/sendmail -t", $To, $Subject, $Message, $From, $Headers, @Files); SENDMAILWith("/usr/sbin/sendmail -i -t", $To, $Subject, $Message, $From, $Headers, @Files);
} }
sub SENDMAILWith($$$$;$$@) sub SENDMAILWith($$$$;$$@)
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2008-2012 University of Utah and the Flux Group. # Copyright (c) 2008-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -735,7 +735,7 @@ sub DBError($$;$) ...@@ -735,7 +735,7 @@ sub DBError($$;$)
my($f, $message, $nomail) = @_; my($f, $message, $nomail) = @_;
if (! defined($nomail)) { if (! defined($nomail)) {
if (open(MAIL, "| /usr/sbin/sendmail -t")) { if (open(MAIL, "| /usr/sbin/sendmail -i -t")) {
print MAIL "To: $TBOPS\n"; print MAIL "To: $TBOPS\n";
print MAIL "Subject: DBError\n"; print MAIL "Subject: DBError\n";
print MAIL "\n"; print MAIL "\n";
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2000-2013 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -150,7 +150,7 @@ sub SENDMAILWith($$$$;$$@); ...@@ -150,7 +150,7 @@ sub SENDMAILWith($$$$;$$@);
sub SENDMAIL($$$;$$@) sub SENDMAIL($$$;$$@)
{ {
my($To, $Subject, $Message, $From, $Headers, @Files) = @_; my($To, $Subject, $Message, $From, $Headers, @Files) = @_;
SENDMAILWith("/usr/sbin/sendmail -t", $To, $Subject, $Message, $From, $Headers, @Files); SENDMAILWith("/usr/sbin/sendmail -i -t", $To, $Subject, $Message, $From, $Headers, @Files);
} }
sub AnonSENDMAIL($$$;$$@) sub AnonSENDMAIL($$$;$$@)
...@@ -238,7 +238,7 @@ sub OPENMAIL($$;$$) ...@@ -238,7 +238,7 @@ sub OPENMAIL($$;$$)
my($To, $Subject, $From, $Headers) = @_; my($To, $Subject, $From, $Headers) = @_;
local *MAIL; local *MAIL;
if (! open(MAIL, "|/usr/sbin/sendmail -t")) { if (! open(MAIL, "|/usr/sbin/sendmail -i -t")) {
print STDERR "OPENMAIL: Could not start sendmail: $!\n"; print STDERR "OPENMAIL: Could not start sendmail: $!\n";
return 0; return 0;
} }
......
# -*- python -*- # -*- python -*-
# #
# Copyright (c) 2000-2003 University of Utah and the Flux Group. # Copyright (c) 2000-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -106,7 +106,7 @@ def SENDMAIL(To, Subj, Msg, From = None, Headers = None, Files = ()): ...@@ -106,7 +106,7 @@ def SENDMAIL(To, Subj, Msg, From = None, Headers = None, Files = ()):
""" """
Tag = MAILTAG.upper() Tag = MAILTAG.upper()
# damn, no good way to tell if this fails # damn, no good way to tell if this fails
sm = os.popen("/usr/sbin/sendmail -t", "w") sm = os.popen("/usr/sbin/sendmail -i -t", "w")
# #
# Sendmail will figure this out if not given. # Sendmail will figure this out if not given.
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2004-2008 University of Utah and the Flux Group. # Copyright (c) 2004-2014 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -1831,7 +1831,7 @@ sub SetupSendMail($$) ...@@ -1831,7 +1831,7 @@ sub SetupSendMail($$)
{ {
my ($isfatal, $msg) = @_; my ($isfatal, $msg) = @_;
if (! open(MAIL, "|/usr/sbin/sendmail -t")) { if (! open(MAIL, "|/usr/sbin/sendmail -i -t")) {
die("*** $0:\n". die("*** $0:\n".
" SENDMAIL: Could not start sendmail: $!\n". " SENDMAIL: Could not start sendmail: $!\n".
" $msg\n"); " $msg\n");
......
...@@ -50,9 +50,7 @@ if ($EUID != 0) { ...@@ -50,9 +50,7 @@ if ($EUID != 0) {
# of the Received lines. # of the Received lines.
$UID = $EUID; $UID = $EUID;
# Even with the UID and EUID set to 0, sendmail will still manager to # Even with the UID and EUID set to 0, sendmail will still manage to
# find the real user and use it for the envelope sender unless we # find the real user and use it for the envelope sender unless we
# explicitly set it to root. # explicitly set it to root.
exec("/usr/sbin/sendmail -t -froot"); exec("/usr/sbin/sendmail -i -t -froot");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment