More log level editing; and fix odd cut/paste of macro module into actions module

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6979 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-07-28 14:56:39 +00:00
parent 29030e1dc1
commit ae62d5cd20
3 changed files with 26 additions and 22 deletions

View File

@ -117,6 +117,27 @@ sub merge_levels ($$) {
my $subparts = @subparts;
my $target = $subparts[0];
push @subparts, '' while @subparts < 3; #Avoid undefined values
my $level = $supparts[1];
my $tag = $supparts[2];
if ( @supparts == 3 ) {
return "$target:none!:$tag" if $level eq 'none!';
return "$target:$level:$tag" if $level =~ /!$/;
return $subordinate if $subparts >= 2;
return "$target:$level:$tag";
}
if ( @supparts == 2 ) {
return "$target:none!" if $level eq 'none!';
return "$target:$level" if ($level =~ /!$/) || ($subparts < 2);
}
$subordinate;
}
#
# Try to find a macro file -- RETURNS false if the file doesn't exist or MACRO if it does.
# If the file exists, the macro is entered into the 'targets' table and the fully-qualified
@ -195,27 +216,6 @@ sub merge_macro_column( $$ ) {
}
}
push @subparts, '' while @subparts < 3; #Avoid undefined values
my $level = $supparts[1];
my $tag = $supparts[2];
if ( @supparts == 3 ) {
return "$target:none!:$tag" if $level eq 'none!';
return "$target:$level:$tag" if $level =~ /!$/;
return $subordinate if $subparts >= 2;
return "$target:$level:$tag";
}
if ( @supparts == 2 ) {
return "$target:none!" if $level eq 'none!';
return "$target:$level" if ($level =~ /!$/) || ($subparts < 2);
}
$subordinate;
}
#
# Get Macro Name -- strips away trailing /* and :* from the first column in a rule, macro or action.
#

View File

@ -1274,6 +1274,10 @@ sub log_rule_limit( $$$$$$$$ ) {
my $prefix;
$level = validate_level $level;
return 1 if $level eq '';
unless ( $predicates =~ /-m limit / ) {
$limit = $globals{LOGLIMIT} unless $limit && $limit ne '-';
$predicates .= $limit if $limit;

View File

@ -948,7 +948,7 @@ my %validlevels = ( debug => 7,
ULOG => 'ULOG' );
#
# Validate a log level -- Drop the trailing '!' that some fools think is important.
# Validate a log level -- Drop the trailing '!' and translate to numeric value if appropriate"
#
sub validate_level( $ ) {
my $level = $_[0];