anonsendmail.in 825 Bytes
Newer Older
1
#!/usr/bin/perl -wT
Mike Hibler's avatar
Mike Hibler committed
2
3
4
5
6
#
# EMULAB-COPYRIGHT
# Copyright (c) 2007 University of Utah and the Flux Group.
# All rights reserved.
#
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

use English;

#
# Configure variables
#
my $TB       = "@prefix@";

#
# Untaint the path
# 
$ENV{'PATH'} = "$TB/bin:$TB/sbin:/bin:/usr/bin:/sbin:/usr/sbin";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};


#
#
#

if ($EUID != 0) {
    # We don't want to run this script unless its the real version.
    die("*** $0:\n".
	"    Must be root! Maybe its a development version?\n");
}

# Set the Real UID to 0 otherwise the real userid might end up in one
# of the Received lines.
$UID = $EUID;

# Even with the UID and EUID set to 0, sendmail will still manager to
# find the real user and use it for the envelope sender unless we
# explicitly set it to root.
exec("/usr/sbin/sendmail -t -froot");