Commit 24a62c11 authored by Leigh Stoller's avatar Leigh Stoller

Minor fix to SENDMAIL(); the use of a "local" to rebind %ENV fails on

older perl for reasons that are beyond me. Change to good old swap and
go.
parent 21824997
......@@ -102,15 +102,15 @@ sub SENDMAIL($$$;$$@)
my $tag = uc($MAILTAG);
#
# Untaint the path locally
# Untaint the path locally. Note that using a "local" fails on older perl!
#
local %ENV = %ENV;
my %SAVE_ENV = %ENV;
$ENV{PATH} = "/bin:/usr/bin";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (! open(MAIL, "|/usr/sbin/sendmail -t")) {
print STDERR "SENDMAIL: Could not start sendmail: $!\n";
return 0;
goto bad;
}
#
......@@ -147,9 +147,14 @@ sub SENDMAIL($$$;$$@)
print MAIL "\n";
if (! close(MAIL)) {
print STDERR "SENDMAIL: Could not finish sendmail: $!\n";
return 0;
goto bad;
}
%ENV = %SAVE_ENV;
return 1;
bad:
%ENV = %SAVE_ENV;
return 0;
}
#
......
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