From 3be071ca3daa467357ccc711d8e5c0aefd478f2d Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 12 Mar 2018 14:39:53 -0700 Subject: [PATCH] Up the INCLUDE depth limit to 20 Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 0b2efc7ae..b2647dddf 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -562,7 +562,9 @@ our %helpers = ( amanda => UDP, sip => UDP, snmp => UDP, tftp => UDP, - ); + ); + +use constant { INCLUDE_LIMIT => 20 }; our %helpers_map; @@ -3320,7 +3322,7 @@ sub copy1( $ ) { my @line = split / /; fatal_error "Invalid INCLUDE command" if @line != 2; - fatal_error "INCLUDEs nested too deeply" if @includestack >= 4; + fatal_error "INCLUDEs nested too deeply" if @includestack >= INCLUDE_LIMIT; my $filename = find_file $line[1]; @@ -3530,7 +3532,7 @@ sub read_a_line($); sub embedded_shell( $ ) { my $multiline = shift; - fatal_error "INCLUDEs nested too deeply" if @includestack >= 4; + fatal_error "INCLUDEs nested too deeply" if @includestack >= INCLUDE_LIMIT; my ( $command, $linenumber ) = ( "/bin/sh -c '$currentline", $currentlinenumber ); $directive_callback->( 'SHELL', $currentline ) if $directive_callback; @@ -3617,7 +3619,7 @@ sub embedded_perl( $ ) { $embedded--; if ( $perlscript ) { - fatal_error "INCLUDEs nested too deeply" if @includestack >= 4; + fatal_error "INCLUDEs nested too deeply" if @includestack >= INCLUDE_LIMIT; assert( close $perlscript ); @@ -3971,7 +3973,7 @@ sub read_a_line($) { my @line = split ' ', $currentline; fatal_error "Invalid INCLUDE command" if @line != 2; - fatal_error "INCLUDEs/Scripts nested too deeply" if @includestack >= 4; + fatal_error "INCLUDEs/Scripts nested too deeply" if @includestack >= INCLUDE_LIMIT; my $filename = find_file $line[1];