+#!/usr/bin/perl
+use strict;
+
+#######################################################
+#
+# run any (allowed) progam in the root context
+#
+#######################################################
+
+my @allowed = ("/bin/df"); # allowed commands
+my $cmdline;
+my $path;
+my $p;
+
+# read command line
+$cmdline = <STDIN>;
+chomp($cmdline);
+
+# identify the path
+if ($cmdline =~ /\s*(.+)\s+/) {
+ $path = $1;
+} else {
+ $path = $cmdline;
+}
+
+# run the program if it's executable and allowed to run
+if (-x $path) {
+ foreach $p (@allowed) {
+ if ($p eq $path) {
+ system($cmdline);
+ exit(0);
+ }
+ }
+ print "fatal: '$cmdline' is not allowed to run\n";
+} else {
+ print "fatal: $path either does not exist or is not executable\n";
+}
+
+# some error occurred
+exit(-1);