in reply to RPC
my @CMDS = ("ps", "top", "df", "vmstat", "blah"); my @FILES = ( "/etc/running.cfg", "/home/me/lastchecked.txt", "/var/l +og/httpd/error_log"); my ($cmd, @ARGS) = split(/\s/, $input); my $ok; for(@CMDS) { if($cmd eq $_) { $ok=1; } } if(!$ok) { die "tried to do something that wasn't cool: $input\n"; } # then check for files in args my $ok=0; my $arg; foreach $arg (@ARGS) if(-e $arg) { # we have a file $file=true; for(@FILES) { if($arg eq $_) { $ok=1; } } } } if($file && !$ok) { die "tried to access a bad thing: $input\n"; } # We're pretty much safe to continue
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) RE: Re: RPC
by jeffa (Bishop) on Nov 08, 2000 at 19:30 UTC |