Don't allow reserved variables to be set in params

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-03-05 15:42:53 -08:00
parent dff5136134
commit b2842ae8d4

View File

@ -3381,6 +3381,8 @@ sub unsupported_yes_no_warning( $ ) {
sub get_params() {
my $fn = find_file 'params';
my %reserved = ( COMMAND => 1, CONFDIR => 1, SHAREDIR => 1, VARDIR => 1 );
if ( -f $fn ) {
progress_message2 "Processing $fn ...";
@ -3484,6 +3486,11 @@ sub get_params() {
}
}
for ( keys %params ) {
fatal_error "The variable name $_ is reserved and may not be set in the params file"
if /^SW_/ || /^SHOREWALL_/ || ( exists $config{$_} && ! exists $ENV{$_} ) || exists $reserved{$_};
}
if ( $debug ) {
print "PARAMS:\n";
my $value;