Commit 24a62c11 authored by Leigh B. Stoller's avatar Leigh B. 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($$$;$$@) ...@@ -102,15 +102,15 @@ sub SENDMAIL($$$;$$@)
my $tag = uc($MAILTAG); 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"; $ENV{PATH} = "/bin:/usr/bin";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if (! open(MAIL, "|/usr/sbin/sendmail -t")) { if (! open(MAIL, "|/usr/sbin/sendmail -t")) {
print STDERR "SENDMAIL: Could not start sendmail: $!\n"; print STDERR "SENDMAIL: Could not start sendmail: $!\n";
return 0; goto bad;
} }
# #
...@@ -147,9 +147,14 @@ sub SENDMAIL($$$;$$@) ...@@ -147,9 +147,14 @@ sub SENDMAIL($$$;$$@)
print MAIL "\n"; print MAIL "\n";
if (! close(MAIL)) { if (! close(MAIL)) {
print STDERR "SENDMAIL: Could not finish sendmail: $!\n"; print STDERR "SENDMAIL: Could not finish sendmail: $!\n";
return 0; goto bad;
} }
%ENV = %SAVE_ENV;
return 1; 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