Make 'map_old_actions' a little cleaner

This commit is contained in:
Tom Eastep 2009-09-09 12:37:49 -07:00
parent 7c1dd35a00
commit 212937a29d

View File

@ -268,25 +268,29 @@ sub add_requiredby ( $$ ) {
# #
# Map pre-3.0 actions to the corresponding Macro invocation # Map pre-3.0 actions to the corresponding Macro invocation
# #
sub find_old_action ( $$$ ) {
my ( $target, $macro, $param ) = @_;
if ( my $actiontype = find_macro( $macro ) ) {
( $macro, $actiontype , $param );
} else {
( $target, 0, '' );
}
}
sub map_old_actions( $ ) { sub map_old_actions( $ ) {
my $target = shift; my $target = shift;
my $macro;
my $param;
if ( $target =~ /^Allow(.*)$/ ) { if ( $target =~ /^Allow(.*)$/ ) {
$macro = $1; find_old_action( $target, $1, 'ACCEPT' );
$param = 'ACCEPT'; } elsif ( $target =~ /^Drop(.*)$/ ) {
} elsif ( $target =~ /^Drop(.*)$/ ) { find_old_action( $target, $1, 'DROP' );
$macro = $1;
$param = 'DROP';
} elsif ( $target = /^Reject(.*)$/ ) { } elsif ( $target = /^Reject(.*)$/ ) {
$macro = $1; find_old_action( $target, $1, 'REJECT' );
$param = 'REJECT';
} else { } else {
return ( $target, 0, '' ); ( $target, 0, '' );
} }
( $macro, find_macro( $macro ) , $param );
} }
# #