Correct handling of default-action macro when specified as "macro.Name"

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-11-25 10:16:43 -08:00
parent 629717f7cc
commit fb3194d96b
3 changed files with 12 additions and 7 deletions

View File

@ -361,10 +361,12 @@ sub process_a_policy() {
$default = supplied $param ? normalize_action( $def, 'none', $param ) : normalize_action_name $def;
use_policy_action( $default );
} elsif ( find_macro( $def ) ) {
$default = join( '.', 'macro', $def ) unless $default =~ /^macro./;
$def = join( '.', 'macro', $def ) unless $default =~ /^macro./;
if ( supplied $param ) {
validate_level($param);
$default = join( ':', $default, $param );
$default = join( ':', $def, $param );
} else {
$default = $def;
}
} else {
fatal_error "Unknown Default Action ($default)";
@ -1151,7 +1153,10 @@ sub merge_levels ($$) {
sub find_macro( $ )
{
my $macro = $_[0];
my $macrofile = find_file( $macro =~ /^macro\./ ? $macro : "macro.$macro" );
$macro =~ s/^macro.//;
my $macrofile = find_file "macro.$macro";
if ( -f $macrofile ) {
$macros{$macro} = $macrofile;

View File

@ -125,8 +125,8 @@
<para>Both actions and macros can have parameters specified. In the
case of a macro, only one parameter is allowed and specifies the log
level to be applied to each rule in the action; not recommended for
use.</para>
level to be applied to each bare LOG rule (e.g., a rule specifying
'LOG' with no level or tag in the ACTION column).</para>
<para>Possible actions are:</para>

View File

@ -125,8 +125,8 @@
<para>Both actions and macros can have parameters specified. In the
case of a macro, only one parameter is allowed and specifies the log
level to be applied to each rule in the action; not recommended for
use.</para>
level to be applied to each bare LOG rule (e.g., a rule specifying
'LOG' with no level or tag in the ACTION column).</para>
<para>Possible actions are:</para>