forked from extern/shorewall_code
Add action normalization routines
This commit is contained in:
parent
c659f05491
commit
21166e07f3
@ -37,6 +37,8 @@ our @ISA = qw(Exporter);
|
|||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
split_action
|
split_action
|
||||||
get_target_param
|
get_target_param
|
||||||
|
normalize_action
|
||||||
|
normalize_action_name
|
||||||
createactionchain
|
createactionchain
|
||||||
%actions
|
%actions
|
||||||
%usedactions
|
%usedactions
|
||||||
@ -133,6 +135,26 @@ sub get_target_param( $ ) {
|
|||||||
( $target, $param );
|
( $target, $param );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Create a normalized action name from the passed pieces
|
||||||
|
#
|
||||||
|
sub normalize_action( $$ ) {
|
||||||
|
my $target = shift;
|
||||||
|
my $param = shift;
|
||||||
|
|
||||||
|
my ($action, $level, $tag ) = split /:/, $target;
|
||||||
|
|
||||||
|
$level = 'none' unless defined $level && $level ne '';
|
||||||
|
$tag = '' unless defined $tag;
|
||||||
|
$param = '' unless defined $param;
|
||||||
|
|
||||||
|
( $action, $level, $tag, $param );
|
||||||
|
}
|
||||||
|
|
||||||
|
sub normalize_action_name( $$ ) {
|
||||||
|
join (':', &normalize_action( @_ ) );
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create and record a log action chain -- Log action chains have names
|
# Create and record a log action chain -- Log action chains have names
|
||||||
# that are formed from the action name by prepending a "%" and appending
|
# that are formed from the action name by prepending a "%" and appending
|
||||||
|
@ -86,7 +86,7 @@ sub initialize( $ ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# This function determines the logging for a subordinate action or a rule within a superior action
|
# This function determines the logging and params for a subordinate action or a rule within a superior action
|
||||||
#
|
#
|
||||||
sub merge_levels ($$) {
|
sub merge_levels ($$) {
|
||||||
my ( $superior, $subordinate ) = @_;
|
my ( $superior, $subordinate ) = @_;
|
||||||
|
Loading…
Reference in New Issue
Block a user