Limit INCLUDE nest level

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@529 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2003-03-29 15:15:05 +00:00
parent 02a42e2fb0
commit f16f401910
2 changed files with 37 additions and 30 deletions

View File

@ -185,13 +185,17 @@ mutex_off()
# Read a file and handle "INCLUDE" directives # Read a file and handle "INCLUDE" directives
# #
read_file() # $1 = file name read_file() # $1 = file name, $2 = nest count
{ {
local first rest local first rest
while read first rest; do while read first rest; do
if [ "x$first" = "xINCLUDE" ]; then if [ "x$first" = "xINCLUDE" ]; then
read_file `find_file ${rest%#*}` if [ $2 -lt 4 ]; then
read_file `find_file ${rest%#*}` $(($count + 1))
else
echo " WARNING: INCLUDE in $1 ignored (nested too deeply)" >&2
fi
else else
echo "$first $rest" echo "$first $rest"
fi fi
@ -216,7 +220,7 @@ strip_file() # $1 = Base Name of the file, $2 = Full Name of File (optional)
[ $# = 1 ] && fname=`find_file $1` || fname=$2 [ $# = 1 ] && fname=`find_file $1` || fname=$2
if [ -f $fname ]; then if [ -f $fname ]; then
read_file $fname | cut -d'#' -f1 | grep -v '^[[:space:]]*$' > $TMP_DIR/$1 read_file $fname 0 | cut -d'#' -f1 | grep -v '^[[:space:]]*$' > $TMP_DIR/$1
else else
> $TMP_DIR/$1 > $TMP_DIR/$1
fi fi

View File

@ -25,41 +25,44 @@ New Features:
configuration directory if one has been specified for the command. configuration directory if one has been specified for the command.
Examples: Examples:
shorewall/params.mgmt: shorewall/params.mgmt:
MGMT_SERVERS=1.1.1.1,2.2.2.2,3.3.3.3 MGMT_SERVERS=1.1.1.1,2.2.2.2,3.3.3.3
TIME_SERVERS=4.4.4.4 TIME_SERVERS=4.4.4.4
BACKUP_SERVERS=5.5.5.5 BACKUP_SERVERS=5.5.5.5
----- end params.mgmt ----- ----- end params.mgmt -----
shorewall/params: shorewall/params:
# Shorewall 1.3 /etc/shorewall/params # Shorewall 1.3 /etc/shorewall/params
[..] [..]
####################################### #######################################
INCLUDE params.mgmt INCLUDE params.mgmt
# params unique to this host here # params unique to this host here
#LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE #LAST LINE - ADD YOUR ENTRIES ABOVE THIS ONE - DO NOT REMOVE
----- end params ----- ----- end params -----
shorewall/rules.mgmt: shorewall/rules.mgmt:
ACCEPT net:$MGMT_SERVERS $FW tcp 22 ACCEPT net:$MGMT_SERVERS $FW tcp 22
ACCEPT $FW net:$TIME_SERVERS udp 123 ACCEPT $FW net:$TIME_SERVERS udp 123
ACCEPT $FW net:$BACKUP_SERVERS tcp 22 ACCEPT $FW net:$BACKUP_SERVERS tcp 22
----- end rules.mgmt ----- ----- end rules.mgmt -----
shorewall/rules: shorewall/rules:
# Shorewall version 1.3 - Rules File # Shorewall version 1.3 - Rules File
[..] [..]
####################################### #######################################
INCLUDE rules.mgmt INCLUDE rules.mgmt
# rules unique to this host here # rules unique to this host here
#LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE #LAST LINE -- ADD YOUR ENTRIES BEFORE THIS ONE -- DO NOT REMOVE
----- end rules ----- ----- end rules -----
INCLUDE's may be nested to a level of 3 -- further nested INCLUDE
directives are ignored.