forked from extern/shorewall_code
Change signature of get_action_params
- Accepts a number of parameters rather than a list - Change action.Drop and action.Reject accordingly - Define correct number of parameter variables in action.Drop and action.Reject Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
0d2e2a14d3
commit
106ba52362
@ -1840,13 +1840,16 @@ sub default_action_params {
|
||||
}
|
||||
}
|
||||
|
||||
sub get_action_params {
|
||||
sub get_action_params( $ ) {
|
||||
my $num = shift;
|
||||
|
||||
fatal_error "Invalid argument to get_action_params()" unless $num =~ /^\d+$/;
|
||||
|
||||
my @values;
|
||||
|
||||
for ( @_ ) {
|
||||
fatal_error "Parameter numbers must be numeric" unless $_ =~ /^\d+$/;
|
||||
push @values, $actparms{$_};
|
||||
}
|
||||
my $index = 1;
|
||||
|
||||
push @values, $actparms{$index++} while $num-- > 0;
|
||||
|
||||
@values;
|
||||
}
|
||||
|
@ -35,13 +35,13 @@ FORMAT 2
|
||||
BEGIN PERL
|
||||
use Shorewall::Config;
|
||||
|
||||
my ($p1, $p2, $p3 ) = get_action_params(1, 2, 3, 4, 5);
|
||||
my ( $p1, $p2, $p3 , $p4, $p5 ) = get_action_params( 5 );
|
||||
|
||||
if ( defined $p1 && $p1 eq 'audit' ) {
|
||||
set_action_param( 2, 'A_REJECT') unless defined $p2;
|
||||
set_action_param( 3, 'A_DROP') unless defined $p3;
|
||||
set_action_param( 4, 'A_ACCEPT' ) unless defined $p4;
|
||||
set_action_param( 5, 'A_DROP' ) unless defined $p5;
|
||||
set_action_param( 2, 'A_REJECT') unless supplied $p2;
|
||||
set_action_param( 3, 'A_DROP') unless supplied $p3;
|
||||
set_action_param( 4, 'A_ACCEPT' ) unless supplied $p4;
|
||||
set_action_param( 5, 'A_DROP' ) unless supplied $p5;
|
||||
};
|
||||
|
||||
1;
|
||||
|
@ -31,13 +31,13 @@ FORMAT 2
|
||||
BEGIN PERL
|
||||
use Shorewall::Config;
|
||||
|
||||
my ( $p1, $p2, $p3 ) = get_action_params(1, 2, 3, 4, 5);
|
||||
my ( $p1, $p2, $p3, $p4, $p5 ) = get_action_params( 5 );
|
||||
|
||||
if ( defined $p1 && $p1 eq 'audit' ) {
|
||||
set_action_param( 2, 'A_REJECT') unless defined $p2;
|
||||
set_action_param( 3, 'A_REJECT') unless defined $p3;
|
||||
set_action_param( 4, 'A_ACCEPT' ) unless defined $p5;
|
||||
set_action_param( 5, 'A_DROP' ) unless defined $p5;
|
||||
set_action_param( 2, 'A_REJECT') unless supplied $p2;
|
||||
set_action_param( 3, 'A_REJECT') unless supplied $p3;
|
||||
set_action_param( 4, 'A_ACCEPT' ) unless supplied $p5;
|
||||
set_action_param( 5, 'A_DROP' ) unless supplied $p5;
|
||||
};
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user