/usr/share/courier/webadmin/admin-save.pl is in courier-webadmin 0.76.3-5+deb9u1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | #!/usr/bin/perl
#
#
# Copyright 2001 Double Precision, Inc. See COPYING for
# distribution information.
my $fh=new FileHandle;
my $pid;
die $cgi->header("text/plain") . "Cannot start process: $!\n"
unless (defined $fh) && (defined ($pid=open($fh, "-|")));
if (! $pid)
{
my $errflag=0;
open(STDERR, ">&STDOUT");
foreach (ReadDirList("added"))
{
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat("$sysconfdir/webadmin/added/$_");
next unless $mode;
print "Creating $_...\n";
mkdir("$sysconfdir/$_", $mode);
}
unlink("$sysconfdir/webadmin/subdirs-added");
foreach (ReadConfigFiles())
{
if ( -f "$sysconfdir/webadmin/added/$_" )
{
print "Installing $_...\n";
my $newfilename="$sysconfdir/$_";
$newfilename=$authdaemonrc if $newfilename eq "$sysconfdir/authdaemonrc";
$newfilename=$authldaprc if $newfilename eq "$sysconfdir/authldaprc";
$newfilename=$authmysqlrc if $newfilename eq "$sysconfdir/authmysqlrc";
$newfilename=$authpgsqlrc if $newfilename eq "$sysconfdir/authpgsqlrc";
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($newfilename);
if ($mode)
{
chmod ($mode, "$sysconfdir/webadmin/added/$_");
chown ($uid, $gid, "$sysconfdir/webadmin/added/$_");
}
($errflag=1, print "ERROR: $!\n")
if ! rename ("$sysconfdir/webadmin/added/$_", $newfilename);
}
if ( -f "$sysconfdir/webadmin/removed/$_" )
{
print "Deleting $_...\n";
($errflag=1, print "ERROR: $!\n")
if ! unlink ("$sysconfdir/webadmin/removed/$_",
"$sysconfdir/$_");
}
}
foreach (ReadDirList("removed"))
{
print "Removing $_...\n";
rmdir("$sysconfdir/$_");
}
unlink("$sysconfdir/webadmin/subdirs-removed");
$fh=new FileHandle "$sysconfdir/webadmin/changed";
if (defined $fh)
{
my $line;
while (defined($line=<$fh>))
{
next if $errflag;
chomp $line;
next unless $line =~ /(.+)/;
$line=$1;
print "Executing $line...\n";
$errflag=1 if system($line) != 0;
}
close($fh);
}
my @leftovers=ReadConfigFiles();
unlink ("$sysconfdir/webadmin/changed")
if $#leftovers < 0 && $errflag == 0;
exit 0;
}
my $output=htmlescape(join("", <$fh>));
close($fh);
display_form("admin-save.html",
{
"OUTPUT" => $output
}
);
exit 0
|